【发布时间】:2018-04-23 12:13:00
【问题描述】:
from binance.client import Client
import pandas as pd
#Binance Api data
api_key = 'hidden'
api_secret = 'hidden'
#connect Binance
client = Client(api_key, api_secret)
#klines/candlesticks
candles = client.get_klines(symbol='BTCUSDT', interval=Client.KLINE_INTERVAL_1MINUTE)
#create dataframe for candles
candles_dataframe = pd.DataFrame(columns= ['Open time', 'Open', 'High', 'Low', 'Close', 'Volume', 'Close time', \
'Quote asset volume', 'Number of trades', 'Taker buy base asset volume', 'Taker buy quote asset volume', \
'Can be ignored'])
candle0 = candles[0]
candles_dataframe.append(candle0, ignore_index=True)
print(candles_dataframe)
所以蜡烛是一个列表,它返回数据框列中描述的值:
[1524425400000, '8918.00000000', '8918.01000000', '8911.07000000',
'8913.94000000', '9.39563900', 1524425459999, '83771.29790726', 78,
'6.44918600', '57506.87361929', '0']
我明白了
/Volumes/Data/Dropbox/Dropbox/Coding/btc_forecast/venv/lib/python3.6/site-packages/pandas/core/indexes/api.py:77: RuntimeWarning: '<' not supported between instances of 'str' and 'int', sort order is undefined for incomparable objects`
result = result.union(other)
我的数据框是空的。 我该怎么办?
【问题讨论】: