def download_binance_candles(symbol, time_frame):
connected = False
while not connected:
try:
candles = client.futures_continous_klines(pair=symbol, contractType="PERPETUAL", interval=time_frame, limit=400)
connected = True
except:
print("[ERROR] Failed download_binance_candles - universal.py on ticker "+symbol)
pass
ticker_data = pd.DataFrame(columns=["Date", "Open", "High", "Low", "Close", "Volume", "Adj Close"])
i = 0
for candlestick in candles:
candle_date_formatted = candlestick[0] / 1000
ts = str(datetime.fromtimestamp(candle_date_formatted))
data_candle = (ts, candlestick[1], candlestick[2], candlestick[3], candlestick[4], candlestick[5], candlestick[4])
ticker_data.loc[i] = data_candle
i = i + 1
ticker_data.set_index("Date")
return ticker_data
ticker_data_15min["RSI"] = talib.RSI(ticker_data_15min["Close"], timeperiod=12)
print(ticker_data_15min["RSI"].tail(1)
这给出了与正确 RSI 值相差 3-4 的答案,是否有另一种方法可以更准确地计算出来?