chatgpt/btc_tracker/01042023/TheClient/bin/TheClient.py

21 lines
585 B
Python

import os
import configparser
import requests
from datetime import datetime
from TheClient.database.db_utils import Database
from TheClient.graphing.graph_utils import Graph
def load_config(config_file):
config = configparser.ConfigParser()
config.read(config_file)
return config
def get_btc_price():
response = requests.get('https://api.binance.com/api/v3/avgPrice', params={'symbol': 'BTCUSDT'})
json_data = response.json()
return float(json_data['price'])
def main():
config = load_config(os.path.join(os.path.dirname(__file__), '..', 'config', 'The