1
フォロー
0
フォロワー

スポットファンドを15分ごとに読み取るにはどうすればいいですか?

作成日:: 2023-10-11 02:30:09, 更新日::
comments   3
hits   829

15分毎に現金を読ませて下さい. 資金の流れを図示してください.

必要なライブラリをインポートする

import time import requests import matplotlib.pyplot as plt

API リクエストのパラメータを設定する

api_url = “https://api.binance.com/api/v3/account” headers = {‘X-MBX-APIKEY’: ‘wCDLQUiV6o1EDfDsEFAMDWWGqZ8tzmOaEgAd’}

初期化資金のリスト

funds = []

def main(): while True: try: 資金調達のためのAPIのリクエスト 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() #15分間寝る time.sleep(900) except Exception as e:

誤った情報

Log(“Error:”, str(e)) time.sleep(5)