hikyuu 2.6.8.5__py3-none-win_amd64.whl → 2.7.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hikyuu/__init__.py +31 -16
- hikyuu/__init__.pyi +610 -590
- hikyuu/analysis/__init__.pyi +584 -563
- hikyuu/analysis/analysis.pyi +585 -564
- hikyuu/core.py +2 -0
- hikyuu/core.pyi +586 -565
- hikyuu/cpp/__init__.pyi +2 -2
- hikyuu/cpp/boost_date_time-mt.dll +0 -0
- hikyuu/cpp/boost_serialization-mt.dll +0 -0
- hikyuu/cpp/boost_system-mt.dll +0 -0
- hikyuu/cpp/boost_wserialization-mt.dll +0 -0
- hikyuu/cpp/core310.pyd +0 -0
- hikyuu/cpp/core310.pyi +501 -104
- hikyuu/cpp/core311.pyd +0 -0
- hikyuu/cpp/core311.pyi +501 -104
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core312.pyi +501 -104
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core313.pyi +501 -104
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
- hikyuu/data/clickhouse_upgrade/createdb.sql +105 -105
- hikyuu/data/common.py +3 -3
- hikyuu/data/common_clickhouse.py +1 -1
- hikyuu/data/download_block.py +351 -0
- hikyuu/data/em_block_to_clickhouse.py +26 -74
- hikyuu/data/em_block_to_mysql.py +25 -75
- hikyuu/data/em_block_to_sqlite.py +26 -78
- hikyuu/data/hku_config_template.py +3 -3
- hikyuu/data/pytdx_to_clickhouse.py +15 -11
- hikyuu/data/pytdx_to_h5.py +6 -2
- hikyuu/data/pytdx_to_mysql.py +5 -1
- hikyuu/data/pytdx_weight_to_clickhouse.py +1 -1
- hikyuu/data/pytdx_weight_to_mysql.py +1 -1
- hikyuu/data/pytdx_weight_to_sqlite.py +1 -1
- hikyuu/data/zh_bond10_to_clickhouse.py +1 -1
- hikyuu/draw/drawplot/__init__.pyi +8 -8
- hikyuu/draw/drawplot/bokeh_draw.pyi +600 -580
- hikyuu/draw/drawplot/common.pyi +1 -1
- hikyuu/draw/drawplot/echarts_draw.pyi +602 -582
- hikyuu/draw/drawplot/matplotlib_draw.py +4 -74
- hikyuu/draw/drawplot/matplotlib_draw.pyi +612 -592
- hikyuu/draw/elder.pyi +11 -11
- hikyuu/draw/kaufman.pyi +18 -18
- hikyuu/draw/volume.pyi +10 -10
- hikyuu/examples/notebook/Demo/Demo1.ipynb +48 -33
- hikyuu/extend.py +0 -8
- hikyuu/extend.pyi +594 -574
- hikyuu/fetcher/stock/zh_block_em.py +12 -40
- hikyuu/gui/HikyuuTDX.py +99 -31
- hikyuu/gui/data/CollectSpotThread.py +1 -1
- hikyuu/gui/data/EscapetimeThread.py +8 -14
- hikyuu/gui/data/ImportBlockInfoTask.py +3 -10
- hikyuu/gui/data/MainWindow.py +1196 -717
- hikyuu/gui/data/SchedImportThread.py +2 -2
- hikyuu/gui/data/UsePytdxImportToH5Thread.py +3 -3
- hikyuu/gui/data/UseQmtImportToH5Thread.py +2 -2
- hikyuu/gui/data/UseTdxImportToH5Thread.py +3 -3
- hikyuu/gui/data/tool.py +32 -25
- hikyuu/gui/dataserver.py +5 -3
- hikyuu/gui/images/liandongxiaopu.png +0 -0
- hikyuu/hub.pyi +6 -6
- hikyuu/include/hikyuu/DataType.h +4 -16
- hikyuu/include/hikyuu/KData.h +6 -3
- hikyuu/include/hikyuu/KDataPrivatedBufferImp.h +1 -1
- hikyuu/include/hikyuu/KDataSharedBufferImp.h +1 -1
- hikyuu/include/hikyuu/KQuery.h +2 -2
- hikyuu/include/hikyuu/Stock.h +4 -1
- hikyuu/include/hikyuu/StockManager.h +13 -3
- hikyuu/include/hikyuu/config.h +0 -3
- hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +8 -0
- hikyuu/include/hikyuu/data_driver/BlockInfoDriver.h +6 -0
- hikyuu/include/hikyuu/data_driver/KDataDriver.h +26 -1
- hikyuu/include/hikyuu/data_driver/base_info/mysql/MySQLBaseInfoDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/base_info/sqlite/SQLiteBaseInfoDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/block_info/mysql/MySQLBlockInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/block_info/qianlong/QLBlockInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/block_info/sqlite/SQLiteBlockInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/kdata/DoNothingKDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/cvs/KDataTempCsvDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/sqlite/SQLiteKDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/tdx/TdxKDataDriver.h +1 -1
- hikyuu/include/hikyuu/hikyuu.h +1 -1
- hikyuu/include/hikyuu/indicator/build_in.h +1 -0
- hikyuu/include/hikyuu/indicator/crt/CYCLE.h +4 -4
- hikyuu/include/hikyuu/indicator/crt/HSL.h +2 -2
- hikyuu/include/hikyuu/indicator/crt/QUANTILE_TRUNC.h +30 -0
- hikyuu/include/hikyuu/indicator/crt/TURNOVER.h +1 -0
- hikyuu/include/hikyuu/indicator/crt/ZSCORE.h +2 -2
- hikyuu/include/hikyuu/indicator/imp/IQuantileTrunc.h +25 -0
- hikyuu/include/hikyuu/misc.h +38 -0
- hikyuu/include/hikyuu/plugin/dataserver.h +2 -1
- hikyuu/include/hikyuu/plugin/device.h +10 -0
- hikyuu/include/hikyuu/plugin/extind.h +37 -0
- hikyuu/include/hikyuu/plugin/interface/DataServerPluginInterface.h +2 -2
- hikyuu/include/hikyuu/plugin/interface/DevicePluginInterface.h +2 -0
- hikyuu/include/hikyuu/plugin/interface/ExtendIndicatorsPluginInterface.h +12 -0
- hikyuu/include/hikyuu/plugin/interface/plugins.h +0 -5
- hikyuu/include/hikyuu/python/pybind_utils.h +0 -12
- hikyuu/include/hikyuu/strategy/RunSystemInStrategy.h +3 -0
- hikyuu/include/hikyuu/trade_manage/Performance.h +4 -4
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +10 -1
- hikyuu/include/hikyuu/trade_sys/moneymanager/imp/FixedCapitalFundsMM.h +0 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +36 -3
- hikyuu/include/hikyuu/trade_sys/multifactor/NormalizeBase.h +125 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/ScoresFilterBase.h +125 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/build_in.h +3 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/buildin_norm.h +36 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/buildin_scfilter.h +51 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/GroupSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/IgnoreLessOrEqualValueSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/IgnoreNanSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/MinAmountPercentSCFilter.h +25 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/PriceSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/TopNSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/EqualWeightMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICIRMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/WeightMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormMinMax.h +23 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormQuantile.h +28 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormQuantileUniform.h +28 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormZScore.h +25 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/__init__.py +1 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/quantile_trunc.h +16 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +7 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/imp/SimplePortfolio.h +7 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/imp/WithoutAFPortfolio.h +7 -0
- hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +49 -0
- hikyuu/include/hikyuu/trade_sys/selector/build_in.h +1 -0
- hikyuu/include/hikyuu/trade_sys/selector/crt/SE_MultiFactor2.h +40 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +0 -3
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector2.h +49 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/logic/OperatorSelector.h +1 -1
- hikyuu/include/hikyuu/trade_sys/selector/imp/logic/OperatorValueSelector.h +1 -1
- hikyuu/include/hikyuu/trade_sys/signal/imp/BandSignal2.h +0 -4
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/AddValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/DivValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/MulValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorSignal.h +1 -1
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorValueSignal.h +4 -4
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/SubValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/slippage/build_in.h +5 -1
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_LogNormal.h +22 -0
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_Normal.h +22 -0
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_TruncNormal.h +25 -0
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_Uniform.h +23 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/LogNormalSlippage.h +28 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/NormalSlippage.h +28 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/TruncNormalSlippage.h +28 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/UniformSlippage.h +24 -0
- hikyuu/include/hikyuu/trade_sys/system/System.h +14 -1
- hikyuu/include/hikyuu/utilities/SpendTimer.h +17 -7
- hikyuu/include/hikyuu/utilities/arithmetic.h +45 -0
- hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLConnect.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLStatement.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteConnect.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteStatement.h +1 -1
- hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +4 -1
- hikyuu/include/hikyuu/version.h +5 -5
- hikyuu/plugin/backtest.dll +0 -0
- hikyuu/plugin/clickhousedriver.dll +0 -0
- hikyuu/plugin/dataserver.dll +0 -0
- hikyuu/plugin/dataserver_parquet.dll +0 -0
- hikyuu/plugin/device.dll +0 -0
- hikyuu/plugin/extind.dll +0 -0
- hikyuu/plugin/hkuextra.dll +0 -0
- hikyuu/plugin/import2hdf5.dll +0 -0
- hikyuu/plugin/tmreport.dll +0 -0
- hikyuu/trade_manage/__init__.pyi +600 -580
- hikyuu/trade_manage/broker.pyi +3 -3
- hikyuu/trade_manage/broker_easytrader.pyi +1 -1
- hikyuu/trade_manage/trade.py +0 -2
- hikyuu/trade_manage/trade.pyi +600 -580
- hikyuu/util/__init__.pyi +2 -2
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.6.8.5.dist-info → hikyuu-2.7.0.dist-info}/METADATA +36 -33
- {hikyuu-2.6.8.5.dist-info → hikyuu-2.7.0.dist-info}/RECORD +185 -168
- {hikyuu-2.6.8.5.dist-info → hikyuu-2.7.0.dist-info}/top_level.txt +2 -2
- hikyuu/cpp/core39.pyd +0 -0
- hikyuu/cpp/core39.pyi +0 -14381
- hikyuu/data_driver/__init__.py +0 -49
- hikyuu/data_driver/jqdata_data_driver.py +0 -277
- hikyuu/data_driver/pytdx_data_driver.py +0 -292
- hikyuu/fetcher/stock/zh_stock_a_huatai.py +0 -51
- hikyuu/fetcher/stock/zh_stock_a_pytdx.py +0 -129
- hikyuu/gui/data/CollectToMemThread.py +0 -123
- hikyuu/gui/data/CollectToMySQLThread.py +0 -178
- hikyuu/gui/start_huatai_insight.py +0 -510
- hikyuu/include/hikyuu/plugin/hkuviews.h +0 -36
- hikyuu/include/hikyuu/plugin/interface/HkuViewsPluginInterface.h +0 -34
- hikyuu/include/hikyuu/views/arrow_common.h +0 -38
- hikyuu/include/hikyuu/views/arrow_views.h +0 -117
- hikyuu/plugin/hkuviews.dll +0 -0
- hikyuu/tools/update_block_info.py +0 -168
- /hikyuu/include/hikyuu/{views → trade_sys/multifactor/filter}/__init__.py +0 -0
- {hikyuu-2.6.8.5.dist-info → hikyuu-2.7.0.dist-info}/WHEEL +0 -0
- {hikyuu-2.6.8.5.dist-info → hikyuu-2.7.0.dist-info}/entry_points.txt +0 -0
|
@@ -4,97 +4,51 @@
|
|
|
4
4
|
# Create on: 20240102
|
|
5
5
|
# Author: fasiondog
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
from hikyuu.data.common import MARKET, get_stk_code_name_list
|
|
7
|
+
|
|
9
8
|
from hikyuu.util import *
|
|
10
9
|
from hikyuu.fetcher.stock.zh_block_em import *
|
|
10
|
+
from hikyuu.data.download_block import *
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
@spend_time
|
|
14
|
-
def em_import_block_to_sqlite(connect
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if '概念板块' in categorys:
|
|
22
|
-
t2 = executor.submit(get_all_gnbk_info, code_market_dict)
|
|
23
|
-
|
|
24
|
-
if '地域板块' in categorys:
|
|
25
|
-
t3 = executor.submit(get_all_dybk_info, code_market_dict)
|
|
26
|
-
|
|
27
|
-
if '指数板块' in categorys:
|
|
28
|
-
t4 = executor.submit(get_all_zsbk_info, code_market_dict)
|
|
29
|
-
|
|
30
|
-
success_fetch_hy = False
|
|
31
|
-
if '行业板块' in categorys:
|
|
32
|
-
x = t1.result()
|
|
33
|
-
hku_info("获取行业板块信息完毕")
|
|
34
|
-
if x:
|
|
35
|
-
all_block_info["行业板块"] = x
|
|
36
|
-
success_fetch_hy = True
|
|
37
|
-
|
|
38
|
-
success_fetch_gn = False
|
|
39
|
-
if '概念板块' in categorys:
|
|
40
|
-
x = t2.result()
|
|
41
|
-
hku_info("获取概念板块信息完毕")
|
|
42
|
-
if x:
|
|
43
|
-
all_block_info["概念板块"] = x
|
|
44
|
-
success_fetch_gn = True
|
|
45
|
-
|
|
46
|
-
success_fetch_dy = False
|
|
47
|
-
if '地域板块' in categorys:
|
|
48
|
-
x = t3.result()
|
|
49
|
-
hku_info("获取地域板块信息完毕")
|
|
50
|
-
if x:
|
|
51
|
-
all_block_info["地域板块"] = x
|
|
52
|
-
success_fetch_dy = True
|
|
53
|
-
|
|
54
|
-
success_fetch_zs = False
|
|
55
|
-
if '指数板块' in categorys:
|
|
56
|
-
x = t4.result()
|
|
57
|
-
hku_info("获取指数板块信息完毕")
|
|
58
|
-
if x:
|
|
59
|
-
all_block_info["指数板块"] = x
|
|
60
|
-
success_fetch_zs = True
|
|
61
|
-
|
|
62
|
-
blks = []
|
|
63
|
-
if success_fetch_hy:
|
|
64
|
-
blks.append('行业板块')
|
|
65
|
-
if success_fetch_gn:
|
|
66
|
-
blks.append('概念板块')
|
|
67
|
-
if success_fetch_dy:
|
|
68
|
-
blks.append('地域板块')
|
|
69
|
-
if success_fetch_zs:
|
|
70
|
-
blks.append('指数板块')
|
|
71
|
-
|
|
72
|
-
print(blks)
|
|
14
|
+
def em_import_block_to_sqlite(connect):
|
|
15
|
+
download_block_info()
|
|
16
|
+
|
|
17
|
+
blocks_info = read_block_from_path()
|
|
18
|
+
blks = blocks_info['block']
|
|
19
|
+
blks_info = blocks_info['block_info']
|
|
73
20
|
|
|
74
21
|
if not blks:
|
|
75
|
-
return
|
|
22
|
+
return 0
|
|
76
23
|
|
|
77
24
|
hku_info("更新数据库")
|
|
78
25
|
cur = connect.cursor()
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
sql = f"delete from block where category in {tuple(blks)}"
|
|
83
|
-
hku_info(sql)
|
|
26
|
+
sql = f"delete from block where category in {tuple(blks.keys())}"
|
|
27
|
+
cur.execute(sql)
|
|
28
|
+
sql = f"delete from BlockIndex where category in {tuple(blks.keys())}"
|
|
84
29
|
cur.execute(sql)
|
|
85
30
|
|
|
86
31
|
insert_records = []
|
|
87
32
|
|
|
88
|
-
for category in
|
|
89
|
-
for name in
|
|
90
|
-
for code in
|
|
33
|
+
for category, blocks in blks.items():
|
|
34
|
+
for name, codes in blocks.items():
|
|
35
|
+
for code in codes:
|
|
91
36
|
insert_records.append((category, name, code))
|
|
92
37
|
|
|
93
38
|
if insert_records:
|
|
94
39
|
sql = "insert into block (category, name, market_code) values (?,?,?)"
|
|
95
|
-
hku_info(f"insert block records: {len(insert_records)}")
|
|
96
40
|
cur.executemany(sql, insert_records)
|
|
97
41
|
|
|
42
|
+
index_records = []
|
|
43
|
+
for category, blocks in blks_info.items():
|
|
44
|
+
for name, index_code in blocks.items():
|
|
45
|
+
if len(index_code) == 8:
|
|
46
|
+
index_records.append((category, name, index_code))
|
|
47
|
+
if index_records:
|
|
48
|
+
sql = "insert into BlockIndex (category, name, market_code) values (?,?,?)"
|
|
49
|
+
cur.executemany(sql, index_records)
|
|
50
|
+
hku_info(f"insert block index records: {len(index_records)}")
|
|
51
|
+
|
|
98
52
|
connect.commit()
|
|
99
53
|
cur.close()
|
|
100
54
|
return len(insert_records)
|
|
@@ -111,12 +65,6 @@ if __name__ == "__main__":
|
|
|
111
65
|
connect = sqlite3.connect(dest_dir + "/stock.db")
|
|
112
66
|
create_database(connect)
|
|
113
67
|
|
|
114
|
-
|
|
115
|
-
code_market_dict = {}
|
|
116
|
-
for v in x:
|
|
117
|
-
code_market_dict[v["code"]] = MARKET.SH
|
|
118
|
-
# print(code_market_dict)
|
|
119
|
-
|
|
120
|
-
em_import_block_to_sqlite(connect, code_market_dict, categorys=('地域板块',))
|
|
68
|
+
em_import_block_to_sqlite(connect)
|
|
121
69
|
|
|
122
70
|
connect.close()
|
|
@@ -210,8 +210,8 @@ future = False
|
|
|
210
210
|
day = True
|
|
211
211
|
min = True
|
|
212
212
|
min5 = True
|
|
213
|
-
trans =
|
|
214
|
-
time =
|
|
213
|
+
trans = False
|
|
214
|
+
time = False
|
|
215
215
|
day_start_date = 1990-12-19
|
|
216
216
|
min_start_date = 2023-09-19
|
|
217
217
|
min5_start_date = 2023-09-19
|
|
@@ -251,7 +251,7 @@ enable = False
|
|
|
251
251
|
enable = False
|
|
252
252
|
;tmpdir = D:/stock
|
|
253
253
|
;host = 127.0.0.1
|
|
254
|
-
|
|
254
|
+
;http_port = 8123
|
|
255
255
|
;port = 9000
|
|
256
256
|
;usr = root
|
|
257
257
|
;pwd =
|
|
@@ -29,7 +29,7 @@ from pytdx.hq import TDXParams
|
|
|
29
29
|
|
|
30
30
|
from hikyuu.util import hku_error, hku_debug, hku_run_ignore_exception
|
|
31
31
|
|
|
32
|
-
from hikyuu import Datetime
|
|
32
|
+
from hikyuu import Datetime, roundEx
|
|
33
33
|
from hikyuu.data.common import *
|
|
34
34
|
from hikyuu.data.common_pytdx import to_pytdx_market, pytdx_get_day_trans
|
|
35
35
|
from hikyuu.data.common_clickhouse import (
|
|
@@ -304,6 +304,10 @@ def import_one_stock_data(
|
|
|
304
304
|
hku_error("Failed translate datetime: {}, from {}! {}".format(bar, api.ip, e))
|
|
305
305
|
continue
|
|
306
306
|
|
|
307
|
+
if 'open' not in bar or 'high' not in bar or 'low' not in bar or 'close' not in bar or 'vol' not in bar or 'amount' not in bar:
|
|
308
|
+
hku_warn(f"Ignore invalid bar: {bar_datetime}, missing fields!")
|
|
309
|
+
continue
|
|
310
|
+
|
|
307
311
|
if last_krecord is not None and bar_datetime == last_datetime:
|
|
308
312
|
if abs(last_krecord[1] - bar["open"]) / last_krecord[1] > 0.01:
|
|
309
313
|
hku_error(
|
|
@@ -325,7 +329,7 @@ def import_one_stock_data(
|
|
|
325
329
|
hku_error(
|
|
326
330
|
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord amount: {last_krecord[5]}, bar: {bar['amount']*0.001}")
|
|
327
331
|
return 0
|
|
328
|
-
if ktype == 'DAY' and last_krecord[5] != 0.0 and abs(last_krecord[6] - bar["vol"]) / last_krecord[6] > 0.1:
|
|
332
|
+
if ktype == 'DAY' and last_krecord[6] != 0.0 and last_krecord[5] != 0.0 and abs(last_krecord[6] - bar["vol"]) / last_krecord[6] > 0.1:
|
|
329
333
|
hku_error(
|
|
330
334
|
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord count: {last_krecord[6]}, bar: {bar['vol']}")
|
|
331
335
|
return 0
|
|
@@ -343,12 +347,12 @@ def import_one_stock_data(
|
|
|
343
347
|
(
|
|
344
348
|
table[1], table[2],
|
|
345
349
|
Datetime(bar_datetime).timestamp_utc()//1000000,
|
|
346
|
-
bar["open"],
|
|
347
|
-
bar["high"],
|
|
348
|
-
bar["low"],
|
|
349
|
-
bar["close"],
|
|
350
|
-
bar["amount"]
|
|
351
|
-
bar["vol"]
|
|
350
|
+
int(roundEx(bar["open"], 3)*1000),
|
|
351
|
+
int(roundEx(bar["high"], 3)*1000),
|
|
352
|
+
int(roundEx(bar["low"], 3)*1000),
|
|
353
|
+
int(roundEx(bar["close"], 3)*1000),
|
|
354
|
+
int(roundEx(bar["amount"], 0)),
|
|
355
|
+
int(roundEx(bar["vol"], 3)*1000)
|
|
352
356
|
# bar['vol'] if stktype == 2 else round(bar['vol'] * 0.01)
|
|
353
357
|
)
|
|
354
358
|
)
|
|
@@ -592,8 +596,8 @@ def import_on_stock_trans(connect, api, market, stock_record, max_days):
|
|
|
592
596
|
(
|
|
593
597
|
market, code,
|
|
594
598
|
Datetime(cur_date * 1000000 + minute * 100 + second).timestamp_utc()//1000000,
|
|
595
|
-
record["price"],
|
|
596
|
-
record["vol"],
|
|
599
|
+
int(roundEx(record["price"], 3) * 1000.0),
|
|
600
|
+
int(record["vol"]),
|
|
597
601
|
record["buyorsell"],
|
|
598
602
|
)
|
|
599
603
|
)
|
|
@@ -698,7 +702,7 @@ def import_on_stock_time(connect, api, market, stock_record, max_days):
|
|
|
698
702
|
time = 1400
|
|
699
703
|
try:
|
|
700
704
|
time_buf.append((market, code, Datetime(this_date + time).timestamp_utc() //
|
|
701
|
-
ticks, record['price'], record['vol']))
|
|
705
|
+
ticks, int(roundEx(record['price'], 3) * 1000.0), int(record['vol'])))
|
|
702
706
|
time += 1
|
|
703
707
|
except Exception as e:
|
|
704
708
|
hku_error("Failed trans record {}! {}".format(record, e))
|
hikyuu/data/pytdx_to_h5.py
CHANGED
|
@@ -286,7 +286,7 @@ def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, sta
|
|
|
286
286
|
bar_list = get_bars(pytdx_kline_type, pytdx_market, code, n * 800, step)
|
|
287
287
|
n -= 1
|
|
288
288
|
if bar_list is None:
|
|
289
|
-
print(code, "invalid!!")
|
|
289
|
+
# print(code, "invalid!!")
|
|
290
290
|
continue
|
|
291
291
|
|
|
292
292
|
for bar in bar_list:
|
|
@@ -302,6 +302,10 @@ def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, sta
|
|
|
302
302
|
hku_error("Failed translate datetime: {}, from {}! {}".format(bar, api.ip, e))
|
|
303
303
|
continue
|
|
304
304
|
|
|
305
|
+
if 'open' not in bar or 'high' not in bar or 'low' not in bar or 'close' not in bar or 'vol' not in bar or 'amount' not in bar:
|
|
306
|
+
hku_warn(f"Ignore invalid bar: {bar_datetime}, missing fields!")
|
|
307
|
+
continue
|
|
308
|
+
|
|
305
309
|
if need_check and bar_datetime == last_datetime:
|
|
306
310
|
# print(f'{bar_datetime} {ktype} {market}{code}')
|
|
307
311
|
if abs(last_krecord['openPrice']*0.001 - bar["open"]) / (last_krecord['openPrice']*0.001) > 0.02:
|
|
@@ -324,7 +328,7 @@ def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, sta
|
|
|
324
328
|
hku_error(
|
|
325
329
|
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord amount: {last_krecord['transAmount']}, bar: {bar['amount']*0.001}")
|
|
326
330
|
return 0
|
|
327
|
-
if ktype == 'DAY' and last_krecord['
|
|
331
|
+
if ktype == 'DAY' and last_krecord['transCount'] != 0.0 and abs(last_krecord['transCount'] - round(bar["vol"])) / last_krecord['transCount'] > 0.1:
|
|
328
332
|
hku_error(
|
|
329
333
|
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord count: {last_krecord['transCount']}, bar: {bar['vol']}")
|
|
330
334
|
return 0
|
hikyuu/data/pytdx_to_mysql.py
CHANGED
|
@@ -348,6 +348,10 @@ def import_one_stock_data(
|
|
|
348
348
|
hku_error("Failed translate datetime: {}, from {}! {}".format(bar, api.ip, e))
|
|
349
349
|
continue
|
|
350
350
|
|
|
351
|
+
if 'open' not in bar or 'high' not in bar or 'low' not in bar or 'close' not in bar or 'vol' not in bar or 'amount' not in bar:
|
|
352
|
+
hku_warn(f"Ignore invalid bar: {bar_datetime}, missing fields!")
|
|
353
|
+
continue
|
|
354
|
+
|
|
351
355
|
if last_krecord is not None and bar_datetime == last_datetime:
|
|
352
356
|
if abs(last_krecord[1] - bar["open"]) / last_krecord[1] > 0.01:
|
|
353
357
|
hku_error(
|
|
@@ -369,7 +373,7 @@ def import_one_stock_data(
|
|
|
369
373
|
hku_error(
|
|
370
374
|
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord amount: {last_krecord[5]}, bar: {bar['amount']*0.001}")
|
|
371
375
|
return 0
|
|
372
|
-
if ktype == 'DAY' and last_krecord[
|
|
376
|
+
if ktype == 'DAY' and last_krecord[6] != 0.0 and abs(last_krecord[6] - bar["vol"]) / last_krecord[6] > 0.1:
|
|
373
377
|
hku_error(
|
|
374
378
|
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord count: {last_krecord[6]}, bar: {bar['vol']}")
|
|
375
379
|
return 0
|
|
@@ -34,7 +34,7 @@ def pytdx_import_weight_to_clickhouse(pytdx_api, connect, market):
|
|
|
34
34
|
|
|
35
35
|
total_count = 0
|
|
36
36
|
update_count = 0
|
|
37
|
-
stock_list = connect.query(f"select code from `hku_base`.`stock` where market='{market}'
|
|
37
|
+
stock_list = connect.query(f"select code from `hku_base`.`stock` where market='{market}'")
|
|
38
38
|
stockid_list = stock_list.result_rows
|
|
39
39
|
|
|
40
40
|
for stockrecord in stockid_list:
|
|
@@ -38,7 +38,7 @@ def pytdx_import_weight_to_mysql(pytdx_api, connect, market):
|
|
|
38
38
|
pytdx_market = to_pytdx_market(market)
|
|
39
39
|
|
|
40
40
|
total_count = 0
|
|
41
|
-
cur.execute("select stockid, code from `hku_base`.`stock` where marketid=%s
|
|
41
|
+
cur.execute("select stockid, code from `hku_base`.`stock` where marketid=%s" % (marketid))
|
|
42
42
|
stockid_list = [x for x in cur.fetchall()]
|
|
43
43
|
cur.close()
|
|
44
44
|
|
|
@@ -35,7 +35,7 @@ def pytdx_import_weight_to_sqlite(pytdx_api, connect, market):
|
|
|
35
35
|
pytdx_market = to_pytdx_market(market)
|
|
36
36
|
|
|
37
37
|
total_count = 0
|
|
38
|
-
stockid_list = cur.execute("select stockid, code from Stock where marketid=%s
|
|
38
|
+
stockid_list = cur.execute("select stockid, code from Stock where marketid=%s" % (marketid))
|
|
39
39
|
stockid_list = [x for x in stockid_list]
|
|
40
40
|
cur.close()
|
|
41
41
|
|
|
@@ -13,7 +13,7 @@ from hikyuu.util import *
|
|
|
13
13
|
def import_zh_bond10_to_clickhouse(connect):
|
|
14
14
|
sql = "select max(date) from hku_base.zh_bond10"
|
|
15
15
|
start_date = connect.command(sql)
|
|
16
|
-
if
|
|
16
|
+
if start_date == 0:
|
|
17
17
|
start_date = "19901219"
|
|
18
18
|
else:
|
|
19
19
|
last_date = start_date
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
from hikyuu.cpp.
|
|
3
|
-
from hikyuu.cpp.
|
|
4
|
-
from hikyuu.cpp.
|
|
5
|
-
from hikyuu.cpp.
|
|
6
|
-
from hikyuu.cpp.
|
|
7
|
-
from hikyuu.cpp.
|
|
8
|
-
from hikyuu.cpp.
|
|
9
|
-
from hikyuu.cpp.
|
|
2
|
+
from hikyuu.cpp.core310 import ConditionBase
|
|
3
|
+
from hikyuu.cpp.core310 import EnvironmentBase
|
|
4
|
+
from hikyuu.cpp.core310 import Indicator
|
|
5
|
+
from hikyuu.cpp.core310 import KData
|
|
6
|
+
from hikyuu.cpp.core310 import Portfolio
|
|
7
|
+
from hikyuu.cpp.core310 import SignalBase
|
|
8
|
+
from hikyuu.cpp.core310 import System
|
|
9
|
+
from hikyuu.cpp.core310 import TradeManager
|
|
10
10
|
from hikyuu.draw.drawplot.bokeh_draw import ax_draw_macd as bk_ax_draw_macd
|
|
11
11
|
from hikyuu.draw.drawplot.bokeh_draw import ax_draw_macd2 as bk_ax_draw_macd2
|
|
12
12
|
from hikyuu.draw.drawplot.bokeh_draw import create_figure as bk_create_figure
|