avatar of feizai008 feizai008
집중하다 사신
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)