From 7c01038c7724ea763669006ab0aaea572a870f72 Mon Sep 17 00:00:00 2001 From: msincenselee Date: Fri, 19 Oct 2018 18:10:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/data/binance/binance_data.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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)