我有以下代码:
from plotly.subplots import make_subplots
import requests
import json
import datetime as dt
import pandas as pd
import plotly.graph_objects as go
def get_candles(symbol, window, interval='1h'):
url = "https://api.binance.com/api/v1/klines"
end_time = dt.datetime.utcnow()
delta = dt.timedelta(hours = window)
start_time = end_time - delta
start_date = str(int(start_time.timestamp() * 1000))
end_date = str(int(end_time.timestamp() * 1000))
limit = '1000'
market = symbol + 'BUSD'
req_param = {"symbol": market, "interval": interval, "startTime": start_date, "endTime": end_date, "limit": limit}
text = requests.get(url, params = req_param).text
data = json.loads(text) …Run Code Online (Sandbox Code Playgroud)