Skip to content

Commit dbf45ca

Browse files
committed
fix(data): 调整股票数据导入时的数值差异检查阈值
将pytdx_to_h5.py和pytdx_to_mysql.py中股票数据导入时的成交量和成交额差异检查阈值 从10调整为10000,以避免因数据精度问题导致的误报错误
1 parent b99e7c3 commit dbf45ca

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

hikyuu/data/pytdx_to_h5.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,11 @@ def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, sta
327327
hku_error(
328328
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord close: {last_krecord['closePrice']*0.001}, bar: {bar['close']}")
329329
return (0, False, Datetime(last_datetime))
330-
if ktype == 'DAY' and last_krecord['transAmount'] != 0 and (abs(float(last_krecord['transAmount']) - round(bar["amount"]*0.001))) > 10:
330+
if ktype == 'DAY' and last_krecord['transAmount'] != 0 and (abs(float(last_krecord['transAmount']) - round(bar["amount"]*0.001))) > 10000:
331331
hku_error(
332332
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord amount: {float(last_krecord['transAmount'])}, bar: {round(bar['amount']*0.001)}")
333333
return (0, False, Datetime(last_datetime))
334-
if ktype == 'DAY' and last_krecord['transCount'] != 0 and abs(float(last_krecord['transCount']) - bar["vol"]) > 10:
334+
if ktype == 'DAY' and last_krecord['transCount'] != 0 and abs(float(last_krecord['transCount']) - bar["vol"]) > 10000:
335335
hku_error(
336336
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord count: {last_krecord['transCount']}, bar: {bar['vol']}")
337337
return (0, False, Datetime(last_datetime))

hikyuu/data/pytdx_to_mysql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,11 @@ def import_one_stock_data(
371371
hku_error(
372372
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord close: {last_krecord[4]}, bar: {bar['close']}")
373373
return (0, False, Datetime(last_datetime))
374-
if ktype == 'DAY' and last_krecord[5] != 0.0 and abs(last_krecord[5] - bar["amount"]*0.001) > 10:
374+
if ktype == 'DAY' and last_krecord[5] != 0.0 and abs(last_krecord[5] - bar["amount"]*0.001) > 10000:
375375
hku_error(
376376
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord amount: {last_krecord[5]}, bar: {bar['amount']*0.001}")
377377
return (0, False, Datetime(last_datetime))
378-
if ktype == 'DAY' and last_krecord[6] != 0.0 and abs(last_krecord[6] - bar["vol"]) > 10:
378+
if ktype == 'DAY' and last_krecord[6] != 0.0 and abs(last_krecord[6] - bar["vol"]) > 10000:
379379
hku_error(
380380
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord count: {last_krecord[6]}, bar: {bar['vol']}")
381381
return (0, False, Datetime(last_datetime))

0 commit comments

Comments
 (0)