براہ کرم ہر 15 منٹ میں نقد رقم کا حساب لگائیں اور رقم کا نقشہ بنائیں۔ یہ کیسے لکھا جائے؟ نیچے لکھا ہوا کام نہیں کر سکتا۔
import time import requests import matplotlib.pyplot as plt
api_url = “https://api.binance.com/api/v3/account” headers = {‘X-MBX-APIKEY’: ‘wCDLQUiV6o1EDfDsEFAMDWWGqZ8tzmOaEgAd’}
funds = []
def main(): while True: try:
response = requests.get(api_url, headers=headers).json() usdt_balance = float(next(item for item in response[‘balances’] if item[‘asset’] == ‘USDT’)[‘free’])
funds.append(usdt_balance) پیسے کی منحنی خطوط کا نقشہ plt.plot(funds) plt.xlabel(‘Time’) plt.ylabel(‘Funds’) plt.title(‘USDT Funds’) plt.grid(True) plt.savefig(‘funds_plot.png’) plt.close()
time.sleep(900) except Exception as e:
Log(“Error:”, str(e)) time.sleep(5)