diff --git a/vnpy/data/binance/binance_data.py b/vnpy/data/binance/binance_data.py index 210b6e79..702bbfe7 100644 --- a/vnpy/data/binance/binance_data.py +++ b/vnpy/data/binance/binance_data.py @@ -216,8 +216,8 @@ class BinanceData(object): return ret_bars if __name__ == '__main__': - binance_data = BinanceData() + binance_data = BinanceData() # 下载最近500条日线数据 #bars = binance_data.download_bars(symbol='btc_usdt', period='1day') @@ -239,5 +239,6 @@ if __name__ == '__main__': # 导出到csv文件 import pandas as pd df = pd.DataFrame(bars) - df.set_index('datetime') - df.to_csv('binance_btc_usdt_{}_{}_1min.csv'.format(start_date.strftime('%Y%m%d'),datetime.now().strftime('%Y%m%d')),index=True) \ No newline at end of file + df = df.set_index('datetime') + df.index.name = 'index' + df.to_csv('binance_btc_usdt_{}_{}_1min.csv'.format(start_date.strftime('%Y%m%d'),datetime.now().strftime('%Y%m%d')),index=True)