💰

Python Crypto Price Checker with GUI

Oct 3, 2024

Python Cryptocurrency Price Checker with GUI

Overview

  • Creating a Python program to check cryptocurrency prices
  • Using a Graphical User Interface (GUI)
  • Step-by-step explanation provided

Requirements

  • Python Packages Used:
    • Requests: For accessing and sending HTTP requests
    • Tkinter: For creating the GUI
  • Code Editor: Visual Studio Code recommended
    • Install Visual Studio Code from the provided link

Installation of Modules

  • Open terminal or command prompt
  • Install Requests:
    pip install requests  
    
  • Install Tkinter (abbreviated as TK):
    pip install tk  
    

API Usage

  • Utilizing the CoinGecko API for cryptocurrency data
  • CoinGecko provides real-time prices and financial data
  • API key provided for accessing data

Program Functionality

  1. User Input:
    • Cryptocurrency name
    • Price threshold for notifications
  2. Notification System:
    • Alerts when the price crosses the set threshold
  3. Supported Cryptocurrencies:
    • Bitcoin, Ethereum, Dogecoin, etc.

Code Demonstration

  • The program opens a GUI where users can:
    • Input cryptocurrency name
    • Set a price threshold
    • Click "Check Price" button
  • Example:
    • Input "Bitcoin" with a threshold of $30,000
    • Notification received: "Bitcoin price has crossed $30,000"
  • Displays the current price of the selected cryptocurrency

Error Handling

  • Basic error management implemented
  • If a cryptocurrency is not found, a notification alerts the user:
    • Example: "Cryptocurrency mana not found"

Step-by-Step Code Explanation

  1. Import Required Modules:
    import requests  
    import tkinter as tk  
    from tkinter import messagebox  
    
  2. Fetch Cryptocurrency Prices:
    • Function getCryptoPrice() to retrieve current price using API
  3. Build User Interface:
    • Create a simple window with input fields and buttons
  4. Check Price Function:
    • Compares current price with user-defined threshold and sends alerts via message box
  5. Loop:
    • Program continues running until closed by the user

Additional Resources

  • Source code and documentation links in the description
  • Encouragement to explore and modify the program for educational purposes

Note: This summary captures key points from the presentation, focusing on the essentials of setting up a Python program for cryptocurrency price checking using a user-friendly GUI.