[bug fix] 修复取不到数据得bug
This commit is contained in:
parent
324afc25bf
commit
6a6a3408dd
@ -20,7 +20,7 @@ from vnpy.data.tdx.tdx_future_data import *
|
|||||||
bar_data_folder = os.path.abspath(os.path.join(vnpy_root, 'bar_data'))
|
bar_data_folder = os.path.abspath(os.path.join(vnpy_root, 'bar_data'))
|
||||||
|
|
||||||
# 开始日期(每年大概需要几分钟)
|
# 开始日期(每年大概需要几分钟)
|
||||||
start_date = '20160101'
|
start_date = '20190101'
|
||||||
|
|
||||||
# 创建API对象
|
# 创建API对象
|
||||||
api_01 = TdxFutureData()
|
api_01 = TdxFutureData()
|
||||||
@ -55,6 +55,8 @@ for underlying_symbol in api_01.future_contracts.keys():
|
|||||||
start_dt=start_dt,
|
start_dt=start_dt,
|
||||||
return_bar=False)
|
return_bar=False)
|
||||||
# [dict] => dataframe
|
# [dict] => dataframe
|
||||||
|
if not result or len(bars) == 0:
|
||||||
|
continue
|
||||||
df_extern = pd.DataFrame(bars)
|
df_extern = pd.DataFrame(bars)
|
||||||
df_extern.set_index('datetime', inplace=True)
|
df_extern.set_index('datetime', inplace=True)
|
||||||
|
|
||||||
@ -74,4 +76,4 @@ for underlying_symbol in api_01.future_contracts.keys():
|
|||||||
print(data_df.tail())
|
print(data_df.tail())
|
||||||
data_df.to_csv(bar_file_path, index=True)
|
data_df.to_csv(bar_file_path, index=True)
|
||||||
print(f'更新{index_symbol}数据 => 文件{bar_file_path}')
|
print(f'更新{index_symbol}数据 => 文件{bar_file_path}')
|
||||||
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user