hikyuu 2.7.0__py3-none-manylinux2014_aarch64.whl → 2.7.5__py3-none-manylinux2014_aarch64.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 +28 -8
- hikyuu/__init__.pyi +26 -14
- hikyuu/analysis/__init__.pyi +7 -1
- hikyuu/analysis/analysis.pyi +8 -2
- hikyuu/core.pyi +9 -3
- hikyuu/cpp/core310.pyi +172 -68
- hikyuu/cpp/core310.so +0 -0
- hikyuu/cpp/core311.pyi +172 -68
- hikyuu/cpp/core311.so +0 -0
- hikyuu/cpp/core312.pyi +172 -68
- hikyuu/cpp/core312.so +0 -0
- hikyuu/cpp/core313.pyi +172 -68
- hikyuu/cpp/core313.so +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu_plugin.mo +0 -0
- hikyuu/cpp/libboost_atomic.so +0 -0
- hikyuu/cpp/libboost_atomic.so.1.90.0 +0 -0
- hikyuu/cpp/{libboost_charconv-mt.so → libboost_charconv.so} +0 -0
- hikyuu/cpp/{libboost_charconv-mt.so.1.88.0 → libboost_charconv.so.1.90.0} +0 -0
- hikyuu/cpp/libboost_chrono.so +0 -0
- hikyuu/cpp/libboost_chrono.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_container.so +0 -0
- hikyuu/cpp/libboost_container.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_date_time.so +0 -0
- hikyuu/cpp/libboost_date_time.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_locale.so +0 -0
- hikyuu/cpp/libboost_locale.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_random.so +0 -0
- hikyuu/cpp/libboost_random.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_serialization.so +0 -0
- hikyuu/cpp/libboost_serialization.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_thread.so +0 -0
- hikyuu/cpp/libboost_thread.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_wserialization.so +0 -0
- hikyuu/cpp/libboost_wserialization.so.1.90.0 +0 -0
- hikyuu/cpp/libhikyuu.so +0 -0
- hikyuu/cpp/libmimalloc.so +0 -0
- hikyuu/cpp/libmimalloc.so.3 +0 -0
- hikyuu/cpp/libmimalloc.so.3.1 +0 -0
- hikyuu/cpp/libsqlite3.so +0 -0
- hikyuu/data/clickhouse_upgrade/0001.sql +2 -0
- hikyuu/data/clickhouse_upgrade/0002.sql +9 -0
- hikyuu/data/common_clickhouse.py +1 -3
- hikyuu/data/common_mysql.py +1 -1
- hikyuu/data/download_block.py +1 -1
- hikyuu/data/em_block_to_mysql.py +16 -4
- hikyuu/data/em_block_to_sqlite.py +16 -4
- hikyuu/data/hku_config_template.py +31 -4
- hikyuu/data/mysql_upgrade/0029.sql +2 -0
- hikyuu/data/mysql_upgrade/0030.sql +3 -0
- hikyuu/data/pytdx_to_clickhouse.py +86 -32
- hikyuu/data/pytdx_to_h5.py +73 -28
- hikyuu/data/pytdx_to_mysql.py +65 -21
- hikyuu/data/pytdx_weight_to_clickhouse.py +2 -0
- hikyuu/data/pytdx_weight_to_mysql.py +2 -0
- hikyuu/data/pytdx_weight_to_sqlite.py +2 -0
- hikyuu/data/sqlite_upgrade/0029.sql +4 -0
- hikyuu/data/sqlite_upgrade/0030.sql +5 -0
- hikyuu/data/tdx_to_clickhouse.py +2 -2
- hikyuu/data/tdx_to_h5.py +11 -11
- hikyuu/data/tdx_to_mysql.py +2 -2
- hikyuu/draw/__init__.pyi +1 -1
- hikyuu/draw/drawplot/__init__.pyi +1 -1
- hikyuu/draw/drawplot/bokeh_draw.pyi +17 -9
- hikyuu/draw/drawplot/echarts_draw.pyi +17 -9
- hikyuu/draw/drawplot/matplotlib_draw.py +23 -9
- hikyuu/draw/drawplot/matplotlib_draw.pyi +17 -9
- hikyuu/examples/notebook/001-overview.ipynb +112 -78
- hikyuu/examples/notebook/004-IndicatorOverview.ipynb +52 -65
- hikyuu/examples/notebook/006-TradeManager.ipynb +402 -291
- hikyuu/examples/notebook/008-Pickle.ipynb +25 -17
- hikyuu/examples/notebook/009-RealData.ipynb +36 -38
- hikyuu/examples/notebook/Demo/Demo2.ipynb +146 -116
- hikyuu/extend.pyi +10 -4
- hikyuu/gui/HikyuuTDX.py +42 -3
- hikyuu/gui/data/MainWindow.py +189 -129
- hikyuu/gui/data/UseTdxImportToH5Thread.py +4 -2
- hikyuu/gui/start_qmt.py +1 -1
- hikyuu/hub.pyi +6 -6
- hikyuu/include/hikyuu/Block.h +9 -9
- hikyuu/include/hikyuu/HistoryFinanceInfo.h +3 -3
- hikyuu/include/hikyuu/KData.h +51 -28
- hikyuu/include/hikyuu/KDataImp.h +12 -7
- hikyuu/include/hikyuu/KDataPrivatedBufferImp.h +13 -7
- hikyuu/include/hikyuu/KDataSharedBufferImp.h +8 -6
- hikyuu/include/hikyuu/KQuery.h +11 -11
- hikyuu/include/hikyuu/KRecord.h +1 -1
- hikyuu/include/hikyuu/MarketInfo.h +10 -10
- hikyuu/include/hikyuu/Stock.h +30 -30
- hikyuu/include/hikyuu/StockManager.h +28 -12
- hikyuu/include/hikyuu/StockTypeInfo.h +9 -9
- hikyuu/include/hikyuu/StockWeight.h +9 -9
- hikyuu/include/hikyuu/StrategyContext.h +4 -4
- hikyuu/include/hikyuu/TimeLineRecord.h +1 -1
- hikyuu/include/hikyuu/TransRecord.h +1 -1
- hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/BlockInfoDriver.h +6 -0
- hikyuu/include/hikyuu/data_driver/KDataDriver.h +6 -7
- hikyuu/include/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.h +5 -1
- hikyuu/include/hikyuu/data_driver/kdata/sqlite/SQLiteKDataDriver.h +1 -1
- hikyuu/include/hikyuu/global/sysinfo.h +24 -5
- hikyuu/include/hikyuu/indicator/IndParam.h +1 -1
- hikyuu/include/hikyuu/indicator/Indicator.h +56 -27
- hikyuu/include/hikyuu/indicator/Indicator2InImp.h +0 -4
- hikyuu/include/hikyuu/indicator/IndicatorImp.h +147 -74
- hikyuu/include/hikyuu/indicator/crt/CONTEXT.h +11 -1
- hikyuu/include/hikyuu/indicator/crt/IC.h +19 -14
- hikyuu/include/hikyuu/indicator/crt/ICIR.h +4 -7
- hikyuu/include/hikyuu/indicator/imp/IAbs.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IAcos.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IAd.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/IAdvance.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/IAma.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/IAsin.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IAtan.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IAtr.h +2 -3
- hikyuu/include/hikyuu/indicator/imp/IBackset.h +2 -4
- hikyuu/include/hikyuu/indicator/imp/IBlockSetNum.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/ICeil.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IContext.h +0 -3
- hikyuu/include/hikyuu/indicator/imp/ICorr.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/ICos.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ICost.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/ICount.h +2 -1
- hikyuu/include/hikyuu/indicator/imp/ICval.h +1 -4
- hikyuu/include/hikyuu/indicator/imp/ICycle.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/IDecline.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/IDevsq.h +4 -1
- hikyuu/include/hikyuu/indicator/imp/IDiff.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IDma.h +2 -0
- hikyuu/include/hikyuu/indicator/imp/IDropna.h +0 -4
- hikyuu/include/hikyuu/indicator/imp/IEma.h +3 -1
- hikyuu/include/hikyuu/indicator/imp/IEvery.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IExist.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IExp.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IFilter.h +4 -5
- hikyuu/include/hikyuu/indicator/imp/IFinance.h +1 -2
- hikyuu/include/hikyuu/indicator/imp/IFloor.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IHhvbars.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IHighLine.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IHsl.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/IIc.h +3 -6
- hikyuu/include/hikyuu/indicator/imp/IInBlock.h +1 -2
- hikyuu/include/hikyuu/indicator/imp/IIntpart.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IIsInf.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IIsInfa.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IIsLastBar.h +0 -1
- hikyuu/include/hikyuu/indicator/imp/IIsNa.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IJumpDown.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IJumpUp.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IKData.h +1 -2
- hikyuu/include/hikyuu/indicator/imp/ILiuTongPan.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/ILn.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ILog.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ILowLine.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/ILowLineBars.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IMa.h +6 -1
- hikyuu/include/hikyuu/indicator/imp/IMacd.h +2 -0
- hikyuu/include/hikyuu/indicator/imp/INot.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IPow.h +3 -1
- hikyuu/include/hikyuu/indicator/imp/IQuantileTrunc.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IRecover.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/IRef.h +3 -1
- hikyuu/include/hikyuu/indicator/imp/IResult.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IReverse.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IRoc.h +6 -1
- hikyuu/include/hikyuu/indicator/imp/IRocp.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IRocr.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IRocr100.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IRound.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IRoundDown.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IRoundUp.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ISaftyLoss.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ISign.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ISin.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ISlope.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/ISma.h +2 -0
- hikyuu/include/hikyuu/indicator/imp/ISpearman.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/ISqrt.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IStdev.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IStdp.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/ISum.h +6 -1
- hikyuu/include/hikyuu/indicator/imp/ITan.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ITime.h +1 -2
- hikyuu/include/hikyuu/indicator/imp/ITimeLine.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/ITr.h +1 -2
- hikyuu/include/hikyuu/indicator/imp/IVar.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IVarp.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IVigor.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/IWma.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IZongGuBen.h +1 -2
- hikyuu/include/hikyuu/indicator_talib/imp/TaAdosc.h +0 -2
- hikyuu/include/hikyuu/indicator_talib/imp/TaSar.h +0 -2
- hikyuu/include/hikyuu/indicator_talib/imp/TaSarext.h +0 -4
- hikyuu/include/hikyuu/indicator_talib/imp/TaStoch.h +0 -3
- hikyuu/include/hikyuu/indicator_talib/imp/TaStochf.h +0 -2
- hikyuu/include/hikyuu/indicator_talib/imp/TaUltosc.h +0 -2
- hikyuu/include/hikyuu/indicator_talib/imp/ta_defines.h +2 -4
- hikyuu/include/hikyuu/indicator_talib/imp/ta_imp.h +70 -90
- hikyuu/include/hikyuu/plugin/KDataToClickHouseImporter.h +40 -0
- hikyuu/include/hikyuu/plugin/KDataToMySQLImporter.h +40 -0
- hikyuu/include/hikyuu/plugin/checkdata.h +20 -0
- hikyuu/include/hikyuu/plugin/extind.h +3 -0
- hikyuu/include/hikyuu/plugin/hkuextra.h +4 -0
- hikyuu/include/hikyuu/plugin/interface/CheckDataPluginInterface.h +25 -0
- hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +4 -0
- hikyuu/include/hikyuu/plugin/interface/ImportKDataToClickHousePluginInterface.h +44 -0
- hikyuu/include/hikyuu/plugin/interface/ImportKDataToMySQLPluginInterface.h +42 -0
- hikyuu/include/hikyuu/plugin/interface/plugins.h +6 -0
- hikyuu/include/hikyuu/python/convert_any.h +9 -6
- hikyuu/include/hikyuu/python/pybind_utils.h +22 -5
- hikyuu/include/hikyuu/strategy/Strategy.h +1 -1
- hikyuu/include/hikyuu/trade_manage/TradeCostBase.h +5 -3
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +9 -3
- hikyuu/include/hikyuu/trade_manage/TradeRecord.h +2 -1
- hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +8 -4
- hikyuu/include/hikyuu/trade_sys/allocatefunds/build_in.h +1 -0
- hikyuu/include/hikyuu/trade_sys/allocatefunds/crt/AF_FixedAmount.h +26 -0
- hikyuu/include/hikyuu/trade_sys/allocatefunds/imp/FixAmountFunds.h +18 -0
- hikyuu/include/hikyuu/trade_sys/condition/ConditionBase.h +5 -3
- hikyuu/include/hikyuu/trade_sys/environment/EnvironmentBase.h +6 -3
- hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +5 -3
- hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +23 -20
- hikyuu/include/hikyuu/trade_sys/multifactor/NormalizeBase.h +6 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/ScoresFilterBase.h +5 -3
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_EqualWeight.h +3 -3
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_ICIRWeight.h +4 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_ICWeight.h +4 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_Weight.h +4 -4
- hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +16 -13
- hikyuu/include/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h +13 -13
- hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +12 -3
- hikyuu/include/hikyuu/trade_sys/selector/crt/SE_MultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/selector/crt/SE_MultiFactor2.h +1 -1
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +1 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector2.h +1 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/optimal/OptimalSelectorBase.h +0 -2
- hikyuu/include/hikyuu/trade_sys/selector/imp/optimal/PerformanceOptimalSelector.h +0 -4
- hikyuu/include/hikyuu/trade_sys/signal/SignalBase.h +5 -3
- hikyuu/include/hikyuu/trade_sys/slippage/SlippageBase.h +5 -3
- hikyuu/include/hikyuu/trade_sys/stoploss/StoplossBase.h +5 -3
- hikyuu/include/hikyuu/trade_sys/system/System.h +6 -4
- hikyuu/include/hikyuu/utilities/Log.h +6 -7
- hikyuu/include/hikyuu/utilities/LruCache.h +299 -0
- hikyuu/include/hikyuu/utilities/Parameter.h +17 -0
- hikyuu/include/hikyuu/utilities/arithmetic.h +2 -2
- hikyuu/include/hikyuu/utilities/config.h +28 -0
- hikyuu/include/hikyuu/utilities/omp_macro.h +25 -0
- hikyuu/include/hikyuu/utilities/plugin/PluginBase.h +17 -2
- hikyuu/include/hikyuu/utilities/plugin/PluginManager.h +46 -22
- hikyuu/include/hikyuu/utilities/thread/GlobalStealThreadPool.h +71 -19
- hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +1 -5
- hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +286 -0
- hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +1 -0
- hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +297 -0
- hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +1 -4
- hikyuu/include/hikyuu/utilities/thread/WorkStealQueue.h +9 -8
- hikyuu/include/hikyuu/utilities/thread/algorithm.h +350 -14
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/plugin/libbacktest.so +0 -0
- hikyuu/plugin/libcheckdata.so +0 -0
- hikyuu/plugin/libclickhousedriver.so +0 -0
- hikyuu/plugin/libdataserver.so +0 -0
- hikyuu/plugin/libdataserver_parquet.so +0 -0
- hikyuu/plugin/libdevice.so +0 -0
- hikyuu/plugin/libextind.so +0 -0
- hikyuu/plugin/libhkuextra.so +0 -0
- hikyuu/plugin/libimport2ch.so +0 -0
- hikyuu/plugin/libimport2hdf5.so +0 -0
- hikyuu/plugin/libimport2mysql.so +0 -0
- hikyuu/plugin/libtmreport.so +0 -0
- hikyuu/test/Indicator.py +1 -2
- hikyuu/trade_manage/__init__.pyi +14 -8
- hikyuu/trade_manage/trade.pyi +14 -8
- hikyuu/trade_sys/trade_sys.py +54 -5
- hikyuu/util/__init__.pyi +2 -2
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.7.0.dist-info → hikyuu-2.7.5.dist-info}/METADATA +10 -4
- {hikyuu-2.7.0.dist-info → hikyuu-2.7.5.dist-info}/RECORD +282 -252
- hikyuu/cpp/libboost_chrono-mt.so +0 -0
- hikyuu/cpp/libboost_chrono-mt.so.1.88.0 +0 -0
- hikyuu/cpp/libboost_date_time-mt.so +0 -0
- hikyuu/cpp/libboost_date_time-mt.so.1.88.0 +0 -0
- hikyuu/cpp/libboost_serialization-mt.so +0 -0
- hikyuu/cpp/libboost_serialization-mt.so.1.88.0 +0 -0
- hikyuu/cpp/libboost_system-mt.so +0 -0
- hikyuu/cpp/libboost_system-mt.so.1.88.0 +0 -0
- hikyuu/cpp/libboost_thread-mt.so +0 -0
- hikyuu/cpp/libboost_thread-mt.so.1.88.0 +0 -0
- hikyuu/cpp/libboost_wserialization-mt.so +0 -0
- hikyuu/cpp/libboost_wserialization-mt.so.1.88.0 +0 -0
- hikyuu/data/pytdx_to_taos.py +0 -736
- {hikyuu-2.7.0.dist-info → hikyuu-2.7.5.dist-info}/WHEEL +0 -0
- {hikyuu-2.7.0.dist-info → hikyuu-2.7.5.dist-info}/entry_points.txt +0 -0
- {hikyuu-2.7.0.dist-info → hikyuu-2.7.5.dist-info}/top_level.txt +0 -0
hikyuu/cpp/core313.so
CHANGED
|
Binary file
|
hikyuu/cpp/i18n/zh_CN/hikyuu.mo
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
hikyuu/cpp/libhikyuu.so
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
hikyuu/cpp/libsqlite3.so
CHANGED
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
ALTER TABLE `hku_base`.`stocktypeinfo`
|
|
2
|
+
UPDATE `minTradeNumber` = CASE
|
|
3
|
+
WHEN `type` = 9 AND `description` = '科创板' THEN 200
|
|
4
|
+
WHEN `type` = 11 AND `description` = '北交所' THEN 100
|
|
5
|
+
ELSE `minTradeNumber`
|
|
6
|
+
END
|
|
7
|
+
WHERE (`type` = 9 AND `description` = '科创板')
|
|
8
|
+
OR (`type` = 11 AND `description` = '北交所');
|
|
9
|
+
ALTER TABLE `hku_base`.`version` UPDATE `version`=2 WHERE `id`=0;
|
hikyuu/data/common_clickhouse.py
CHANGED
|
@@ -69,11 +69,9 @@ def create_database(connect):
|
|
|
69
69
|
and int(x.stem) > db_version and not x.is_dir()]
|
|
70
70
|
files.sort()
|
|
71
71
|
for file in files:
|
|
72
|
-
print(file)
|
|
73
72
|
sql = file.read_text(encoding='utf8')
|
|
74
73
|
statements = sql.split(';')
|
|
75
74
|
for stmt in statements:
|
|
76
|
-
print(stmt)
|
|
77
75
|
stmt = stmt.strip()
|
|
78
76
|
if stmt: # 跳过空语句
|
|
79
77
|
try:
|
|
@@ -163,7 +161,7 @@ def get_last_krecord(connect, tablename):
|
|
|
163
161
|
# hku_info(f"{tablename} {a}")
|
|
164
162
|
if not a:
|
|
165
163
|
return None
|
|
166
|
-
return (Datetime.from_timestamp_utc(a[0][0]*1000000).ymdhm, a[0][1]*0.001, a[0][2]*0.001, a[0][3]*0.001, a[0][4]*0.001, a[0][5]
|
|
164
|
+
return (Datetime.from_timestamp_utc(a[0][0]*1000000).ymdhm, a[0][1]*0.001, a[0][2]*0.001, a[0][3]*0.001, a[0][4]*0.001, float(a[0][5]), a[0][6]*0.001)
|
|
167
165
|
except:
|
|
168
166
|
return None
|
|
169
167
|
|
hikyuu/data/common_mysql.py
CHANGED
|
@@ -502,7 +502,7 @@ def update_extern_data(connect, market, code, data_type):
|
|
|
502
502
|
if insert_buffer:
|
|
503
503
|
cur = connect.cursor()
|
|
504
504
|
cur.executemany(
|
|
505
|
-
"
|
|
505
|
+
"replace into {} (date, open, high, low, close, amount, count) \
|
|
506
506
|
values (%s, %s, %s, %s, %s, %s, %s)".format(index_table), insert_buffer
|
|
507
507
|
)
|
|
508
508
|
connect.commit()
|
hikyuu/data/download_block.py
CHANGED
hikyuu/data/em_block_to_mysql.py
CHANGED
|
@@ -22,10 +22,22 @@ def em_import_block_to_mysql(connect):
|
|
|
22
22
|
|
|
23
23
|
hku_info("更新数据库")
|
|
24
24
|
cur = connect.cursor()
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
|
|
26
|
+
# 构建参数化的DELETE语句以防止SQL注入
|
|
27
|
+
categories = tuple(blks.keys())
|
|
28
|
+
if len(categories) == 1:
|
|
29
|
+
# 处理只有一个类别的特殊情况
|
|
30
|
+
placeholders = '%s'
|
|
31
|
+
params = categories
|
|
32
|
+
else:
|
|
33
|
+
placeholders = ','.join(['%s'] * len(categories)) # 创建相应数量的占位符
|
|
34
|
+
params = categories
|
|
35
|
+
|
|
36
|
+
sql = f"delete from hku_base.block where category in ({placeholders})"
|
|
37
|
+
cur.execute(sql, params)
|
|
38
|
+
|
|
39
|
+
sql = f"delete from hku_base.BlockIndex where category in ({placeholders})"
|
|
40
|
+
cur.execute(sql, params)
|
|
29
41
|
|
|
30
42
|
insert_records = []
|
|
31
43
|
|
|
@@ -23,10 +23,22 @@ def em_import_block_to_sqlite(connect):
|
|
|
23
23
|
|
|
24
24
|
hku_info("更新数据库")
|
|
25
25
|
cur = connect.cursor()
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
|
|
27
|
+
# 构建参数化的DELETE语句以防止SQL注入
|
|
28
|
+
categories = tuple(blks.keys())
|
|
29
|
+
if len(categories) == 1:
|
|
30
|
+
# 处理只有一个类别的特殊情况
|
|
31
|
+
placeholders = '?'
|
|
32
|
+
params = categories
|
|
33
|
+
else:
|
|
34
|
+
placeholders = ','.join(['?'] * len(categories)) # 创建相应数量的占位符
|
|
35
|
+
params = categories
|
|
36
|
+
|
|
37
|
+
sql = f"delete from block where category in ({placeholders})"
|
|
38
|
+
cur.execute(sql, params)
|
|
39
|
+
|
|
40
|
+
sql = f"delete from BlockIndex where category in ({placeholders})"
|
|
41
|
+
cur.execute(sql, params)
|
|
30
42
|
|
|
31
43
|
insert_records = []
|
|
32
44
|
|
|
@@ -26,7 +26,9 @@ hdf5_template = """
|
|
|
26
26
|
[hikyuu]
|
|
27
27
|
tmpdir = {dir}/tmp
|
|
28
28
|
datadir = {dir}
|
|
29
|
+
reload_time = {reload_time}
|
|
29
30
|
quotation_server = {quotation_server}
|
|
31
|
+
lazy_preload = {lazy_preload}
|
|
30
32
|
|
|
31
33
|
[block]
|
|
32
34
|
type = sqlite3
|
|
@@ -52,6 +54,8 @@ min15 = {min15}
|
|
|
52
54
|
min30 = {min30}
|
|
53
55
|
min60 = {min60}
|
|
54
56
|
hour2= {hour2}
|
|
57
|
+
timeline = {timeline}
|
|
58
|
+
trans = {trans}
|
|
55
59
|
day_max = {day_max}
|
|
56
60
|
week_max = {week_max}
|
|
57
61
|
month_max = {month_max}
|
|
@@ -64,6 +68,8 @@ min15_max = {min15_max}
|
|
|
64
68
|
min30_max = {min30_max}
|
|
65
69
|
min60_max = {min60_max}
|
|
66
70
|
hour2_max = {hour2_max}
|
|
71
|
+
timeline_max = {timeline_max}
|
|
72
|
+
trans_max = {trans_max}
|
|
67
73
|
|
|
68
74
|
[baseinfo]
|
|
69
75
|
type = sqlite3
|
|
@@ -94,7 +100,9 @@ mysql_template = """
|
|
|
94
100
|
[hikyuu]
|
|
95
101
|
tmpdir = {dir}
|
|
96
102
|
datadir = {dir}
|
|
103
|
+
reload_time = {reload_time}
|
|
97
104
|
quotation_server = {quotation_server}
|
|
105
|
+
lazy_preload = {lazy_preload}
|
|
98
106
|
|
|
99
107
|
[block]
|
|
100
108
|
type = mysql
|
|
@@ -116,6 +124,8 @@ min15 = {min15}
|
|
|
116
124
|
min30 = {min30}
|
|
117
125
|
min60 = {min60}
|
|
118
126
|
hour2 = {hour2}
|
|
127
|
+
timeline = {timeline}
|
|
128
|
+
trans = {trans}
|
|
119
129
|
day_max = {day_max}
|
|
120
130
|
week_max = {week_max}
|
|
121
131
|
month_max = {month_max}
|
|
@@ -128,6 +138,8 @@ min15_max = {min15_max}
|
|
|
128
138
|
min30_max = {min30_max}
|
|
129
139
|
min60_max = {min60_max}
|
|
130
140
|
hour2_max = {hour2_max}
|
|
141
|
+
timeline_max = {timeline_max}
|
|
142
|
+
trans_max = {trans_max}
|
|
131
143
|
|
|
132
144
|
[baseinfo]
|
|
133
145
|
type = mysql
|
|
@@ -149,7 +161,9 @@ clickhouse_template = """
|
|
|
149
161
|
[hikyuu]
|
|
150
162
|
tmpdir = {dir}
|
|
151
163
|
datadir = {dir}
|
|
164
|
+
reload_time = {reload_time}
|
|
152
165
|
quotation_server = {quotation_server}
|
|
166
|
+
lazy_preload = {lazy_preload}
|
|
153
167
|
|
|
154
168
|
[block]
|
|
155
169
|
type = clickhouse
|
|
@@ -171,6 +185,8 @@ min15 = {min15}
|
|
|
171
185
|
min30 = {min30}
|
|
172
186
|
min60 = {min60}
|
|
173
187
|
hour2 = {hour2}
|
|
188
|
+
timeline = {timeline}
|
|
189
|
+
trans = {trans}
|
|
174
190
|
day_max = {day_max}
|
|
175
191
|
week_max = {week_max}
|
|
176
192
|
month_max = {month_max}
|
|
@@ -183,6 +199,8 @@ min15_max = {min15_max}
|
|
|
183
199
|
min30_max = {min30_max}
|
|
184
200
|
min60_max = {min60_max}
|
|
185
201
|
hour2_max = {hour2_max}
|
|
202
|
+
timeline_max = {timeline_max}
|
|
203
|
+
trans_max = {trans_max}
|
|
186
204
|
|
|
187
205
|
[baseinfo]
|
|
188
206
|
type = clickhouse
|
|
@@ -269,6 +287,9 @@ phase1_end = 11:35:00
|
|
|
269
287
|
phase2_start = 12:00:00
|
|
270
288
|
phase2_end = 15:05:00
|
|
271
289
|
|
|
290
|
+
[lazy_preload]
|
|
291
|
+
enable = False
|
|
292
|
+
|
|
272
293
|
[preload]
|
|
273
294
|
day = True
|
|
274
295
|
week = True
|
|
@@ -282,6 +303,8 @@ min15 = False
|
|
|
282
303
|
min30 = False
|
|
283
304
|
min60 = False
|
|
284
305
|
hour2 = False
|
|
306
|
+
timeline = False
|
|
307
|
+
trans = False
|
|
285
308
|
day_max = 100000
|
|
286
309
|
week_max = 100000
|
|
287
310
|
month_max = 100000
|
|
@@ -294,6 +317,8 @@ min15_max = 5120
|
|
|
294
317
|
min30_max = 5120
|
|
295
318
|
min60_max = 5120
|
|
296
319
|
hour2_max = 5120
|
|
320
|
+
timeline_max = 5120
|
|
321
|
+
trans_max = 5120
|
|
297
322
|
"""
|
|
298
323
|
|
|
299
324
|
|
|
@@ -304,14 +329,16 @@ def generate_default_config():
|
|
|
304
329
|
from hikyuu.data.hku_config_template import hdf5_template
|
|
305
330
|
user_dir = os.path.expanduser('~')
|
|
306
331
|
data_dir = "c:\\stock" if sys.platform == 'win32' else f"{user_dir}/stock"
|
|
307
|
-
hdf5_config = hdf5_template.format(dir=data_dir, quotation_server='ipc:///tmp/hikyuu_real.ipc',
|
|
308
|
-
day=True, week=False,
|
|
332
|
+
hdf5_config = hdf5_template.format(dir=data_dir, reload_time="00:00", quotation_server='ipc:///tmp/hikyuu_real.ipc',
|
|
333
|
+
lazy_preload=False, day=True, week=False,
|
|
309
334
|
month=False, quarter=False, halfyear=False, year=False,
|
|
310
335
|
min1=False, min5=False, min15=False, min30=False,
|
|
311
|
-
min60=False, hour2=False,
|
|
336
|
+
min60=False, hour2=False, timeline=False, trans=False,
|
|
337
|
+
day_max=100000, week_max=100000,
|
|
312
338
|
month_max=100000, quarter_max=100000, halfyear_max=100000,
|
|
313
339
|
year_max=100000, min1_max=5120, min5_max=5120, min15_max=5120,
|
|
314
|
-
min30_max=5120, min60_max=5120, hour2_max=5120
|
|
340
|
+
min30_max=5120, min60_max=5120, hour2_max=5120,
|
|
341
|
+
timeline_max=5120, trans_max=5120)
|
|
315
342
|
config_dir = f"{user_dir}/.hikyuu"
|
|
316
343
|
if not os.path.lexists(config_dir):
|
|
317
344
|
os.makedirs(config_dir)
|
|
@@ -23,13 +23,15 @@
|
|
|
23
23
|
# SOFTWARE.
|
|
24
24
|
|
|
25
25
|
import sys
|
|
26
|
+
import os
|
|
26
27
|
import math
|
|
27
28
|
import datetime
|
|
28
29
|
from pytdx.hq import TDXParams
|
|
30
|
+
from configparser import ConfigParser
|
|
29
31
|
|
|
30
32
|
from hikyuu.util import hku_error, hku_debug, hku_run_ignore_exception
|
|
31
33
|
|
|
32
|
-
from hikyuu import Datetime, roundEx
|
|
34
|
+
from hikyuu import Datetime, roundEx, is_valid_license, KDataToClickHouseImporter
|
|
33
35
|
from hikyuu.data.common import *
|
|
34
36
|
from hikyuu.data.common_pytdx import to_pytdx_market, pytdx_get_day_trans
|
|
35
37
|
from hikyuu.data.common_clickhouse import (
|
|
@@ -134,6 +136,9 @@ def import_stock_name(connect, api, market, quotations=None):
|
|
|
134
136
|
if code not in deSet:
|
|
135
137
|
newStockDict[code] = stock["name"]
|
|
136
138
|
|
|
139
|
+
# 号码前缀
|
|
140
|
+
codepre_list = get_codepre_list(connect, market, quotations)
|
|
141
|
+
|
|
137
142
|
stktype_list = get_stktype_list(quotations)
|
|
138
143
|
stktype_list = list(stktype_list)
|
|
139
144
|
stktype_list.remove(STOCKTYPE.INDEX) # 移除指数类型
|
|
@@ -149,23 +154,29 @@ def import_stock_name(connect, api, market, quotations=None):
|
|
|
149
154
|
|
|
150
155
|
oldname, oldtype, oldvalid, oldstartDate, oldendDate = oldstock[2], oldstock[3], oldstock[4], oldstock[5], oldstock[6]
|
|
151
156
|
|
|
157
|
+
# 检测是否类型发生变化
|
|
158
|
+
newtype = oldtype
|
|
159
|
+
for codepre in codepre_list:
|
|
160
|
+
length = len(codepre[0])
|
|
161
|
+
if oldcode[:length] == codepre[0]:
|
|
162
|
+
if oldtype != codepre[1]:
|
|
163
|
+
newtype = codepre[1]
|
|
164
|
+
break
|
|
165
|
+
|
|
152
166
|
# 新的代码表中无此股票,则置为无效
|
|
153
|
-
# if (oldvalid == 1) and (oldcode not in newStockDict):
|
|
154
167
|
if (oldvalid == 1) and ((oldcode not in newStockDict) or oldcode in deSet):
|
|
155
168
|
sql = f"delete from hku_base.stock where market='{market}' and code='{oldcode}'"
|
|
156
169
|
connect.command(sql)
|
|
157
|
-
insert_records.append((market, oldcode, oldname,
|
|
170
|
+
insert_records.append((market, oldcode, oldname, newtype, 0, oldstartDate, oldendDate))
|
|
158
171
|
|
|
159
172
|
# 股票名称发生变化,更新股票名称;如果原无效,则置为有效
|
|
160
173
|
if oldcode in newStockDict:
|
|
161
|
-
if oldname != newStockDict[oldcode] or oldvalid == 0:
|
|
174
|
+
if oldname != newStockDict[oldcode] or oldvalid == 0 or oldtype != newtype:
|
|
162
175
|
sql = f"delete from hku_base.stock where market='{market}' and code='{oldcode}'"
|
|
163
176
|
connect.command(sql)
|
|
164
|
-
insert_records.append((market, oldcode, newStockDict[oldcode],
|
|
177
|
+
insert_records.append((market, oldcode, newStockDict[oldcode], newtype, 1, oldstartDate, 99999999))
|
|
165
178
|
|
|
166
179
|
# 处理新出现的股票
|
|
167
|
-
codepre_list = get_codepre_list(connect, market, quotations)
|
|
168
|
-
|
|
169
180
|
today = datetime.date.today()
|
|
170
181
|
today = today.year * 10000 + today.month * 100 + today.day
|
|
171
182
|
count = 0
|
|
@@ -274,10 +285,10 @@ def import_one_stock_data(
|
|
|
274
285
|
today.year * 10000 + today.month * 100 + today.day
|
|
275
286
|
) * 10000 + 1500
|
|
276
287
|
else:
|
|
277
|
-
return 0
|
|
288
|
+
return (0, True, Datetime(last_datetime))
|
|
278
289
|
|
|
279
290
|
if today_datetime <= last_datetime:
|
|
280
|
-
return 0
|
|
291
|
+
return (0, True, Datetime(last_datetime))
|
|
281
292
|
|
|
282
293
|
get_bars = (
|
|
283
294
|
api.get_index_bars if stktype == STOCKTYPE.INDEX else api.get_security_bars
|
|
@@ -312,27 +323,27 @@ def import_one_stock_data(
|
|
|
312
323
|
if abs(last_krecord[1] - bar["open"]) / last_krecord[1] > 0.01:
|
|
313
324
|
hku_error(
|
|
314
325
|
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord open: {last_krecord[1]}, bar: {bar['open']}")
|
|
315
|
-
return 0
|
|
326
|
+
return (0, False, Datetime(last_datetime))
|
|
316
327
|
if abs(last_krecord[2] - bar["high"]) / last_krecord[2] > 0.01:
|
|
317
328
|
hku_error(
|
|
318
329
|
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord high: {last_krecord[2]}, bar: {bar['high']}")
|
|
319
|
-
return 0
|
|
320
|
-
if abs(last_krecord[3] - bar["low"]) / last_krecord[3] > 0.01:
|
|
330
|
+
return (0, False, Datetime(last_datetime))
|
|
331
|
+
if abs(last_krecord[3] - bar["low"]) / last_krecord[3] > 0.01 and abs(last_krecord[3] - bar["low"]) > 0.01:
|
|
321
332
|
hku_error(
|
|
322
333
|
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord low: {last_krecord[3]}, bar: {bar['low']}")
|
|
323
|
-
return 0
|
|
334
|
+
return (0, False, Datetime(last_datetime))
|
|
324
335
|
if abs(last_krecord[4] - bar["close"]) / last_krecord[4] > 0.01:
|
|
325
336
|
hku_error(
|
|
326
337
|
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord close: {last_krecord[4]}, bar: {bar['close']}")
|
|
327
|
-
return 0
|
|
328
|
-
if ktype == 'DAY' and last_krecord[5] != 0.0 and abs(last_krecord[5] - bar["amount"]
|
|
338
|
+
return (0, False, Datetime(last_datetime))
|
|
339
|
+
if ktype == 'DAY' and last_krecord[5] != 0.0 and abs(last_krecord[5] - bar["amount"]) > 10000:
|
|
329
340
|
hku_error(
|
|
330
|
-
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord amount: {last_krecord[5]}, bar: {bar['amount']
|
|
331
|
-
return 0
|
|
332
|
-
if ktype == 'DAY' and last_krecord[6] != 0.0 and last_krecord[
|
|
341
|
+
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord amount: {last_krecord[5]}, bar: {bar['amount']}")
|
|
342
|
+
return (0, False, Datetime(last_datetime))
|
|
343
|
+
if ktype == 'DAY' and last_krecord[6] != 0.0 and last_krecord[6] != 0.0 and abs(last_krecord[6] - bar["vol"]) > 10000:
|
|
333
344
|
hku_error(
|
|
334
345
|
f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord count: {last_krecord[6]}, bar: {bar['vol']}")
|
|
335
|
-
return 0
|
|
346
|
+
return (0, False, Datetime(last_datetime))
|
|
336
347
|
continue
|
|
337
348
|
|
|
338
349
|
if (
|
|
@@ -365,7 +376,7 @@ def import_one_stock_data(
|
|
|
365
376
|
data=buf)
|
|
366
377
|
connect.insert(context=ic, settings={"prefer_warmed_unmerged_parts_seconds": 86400})
|
|
367
378
|
|
|
368
|
-
return len(buf)
|
|
379
|
+
return (len(buf), True, Datetime(last_datetime))
|
|
369
380
|
|
|
370
381
|
|
|
371
382
|
def update_stock_info(connect, market):
|
|
@@ -409,7 +420,7 @@ def clear_extern_data(connect, market, data_type):
|
|
|
409
420
|
index_list = ('min15', 'min30', 'min60', 'hour2')
|
|
410
421
|
lastdate = connect.command(
|
|
411
422
|
f"select toInt32(max(date)) from hku_data.min5_k where market='SH' and code='000001'")
|
|
412
|
-
lastdate = Datetime.from_timestamp_utc(lastdate*1000000).start_of_day()
|
|
423
|
+
lastdate = Datetime.from_timestamp_utc(int(lastdate*1000000)).start_of_day()
|
|
413
424
|
last_timestamp = Datetime(lastdate).timestamp_utc()//1000000
|
|
414
425
|
for index_type in index_list:
|
|
415
426
|
sql = f"delete from hku_data.{index_type}_k where market='{market}' and date>={last_timestamp}"
|
|
@@ -420,6 +431,16 @@ def clear_extern_data(connect, market, data_type):
|
|
|
420
431
|
hku_info(f"清理 {market} {data_type} 线扩展数据完毕")
|
|
421
432
|
|
|
422
433
|
|
|
434
|
+
@hku_catch(ret=None)
|
|
435
|
+
def get_clickhouse_importer():
|
|
436
|
+
filename = os.path.expanduser('~') + '/.hikyuu/hikyuu.ini'
|
|
437
|
+
config = ConfigParser()
|
|
438
|
+
config.read(filename, encoding='utf-8')
|
|
439
|
+
importer = KDataToClickHouseImporter()
|
|
440
|
+
return importer if importer.set_config(config.get("kdata", "host"), config.getint("kdata", "port", fallback=9000),
|
|
441
|
+
config.get("kdata", "usr"), config.get("kdata", "pwd")) else None
|
|
442
|
+
|
|
443
|
+
|
|
423
444
|
@hku_catch(trace=True, re_raise=True)
|
|
424
445
|
def import_data(
|
|
425
446
|
connect,
|
|
@@ -460,6 +481,9 @@ def import_data(
|
|
|
460
481
|
for index_type in index_list:
|
|
461
482
|
update_data[index_type] = []
|
|
462
483
|
|
|
484
|
+
failed_limit = 20
|
|
485
|
+
failed_count = 0
|
|
486
|
+
failed_list = []
|
|
463
487
|
total = len(stock_list)
|
|
464
488
|
# market, code, valid, type
|
|
465
489
|
for i, stock in enumerate(stock_list):
|
|
@@ -468,9 +492,15 @@ def import_data(
|
|
|
468
492
|
progress(i, total)
|
|
469
493
|
continue
|
|
470
494
|
|
|
471
|
-
this_count = import_one_stock_data(
|
|
495
|
+
this_count, success, lastdate = import_one_stock_data(
|
|
472
496
|
connect, api, market, ktype, stock, startDate
|
|
473
497
|
)
|
|
498
|
+
if not success:
|
|
499
|
+
failed_count += 1
|
|
500
|
+
failed_list.append((market, stock[1], lastdate))
|
|
501
|
+
if failed_count >= failed_limit:
|
|
502
|
+
# hku_error(f"{market} {ktype} 连续失败20个股票,已停止导入, 建议重新导入")
|
|
503
|
+
break
|
|
474
504
|
add_record_count += this_count
|
|
475
505
|
if ktype in ("DAY", "5MIN"):
|
|
476
506
|
if ktype == "DAY":
|
|
@@ -490,6 +520,9 @@ def import_data(
|
|
|
490
520
|
if progress:
|
|
491
521
|
progress(i, total)
|
|
492
522
|
|
|
523
|
+
if total > 0 and progress:
|
|
524
|
+
progress(total, total)
|
|
525
|
+
|
|
493
526
|
if ktype in ("DAY", "5MIN"):
|
|
494
527
|
for index_type in index_list:
|
|
495
528
|
if len(update_data[index_type]) > 0:
|
|
@@ -501,6 +534,25 @@ def import_data(
|
|
|
501
534
|
update_data[index_type].clear()
|
|
502
535
|
update_data.clear()
|
|
503
536
|
|
|
537
|
+
if 0 < failed_count < failed_limit and is_valid_license():
|
|
538
|
+
# 删除最后记录
|
|
539
|
+
ktype_dict = {
|
|
540
|
+
'DAY': 'DAY',
|
|
541
|
+
'1MIN': 'MIN',
|
|
542
|
+
'5MIN': 'MIN5'
|
|
543
|
+
}
|
|
544
|
+
nktype = ktype_dict[ktype]
|
|
545
|
+
ch_importer = get_clickhouse_importer()
|
|
546
|
+
if ch_importer is not None:
|
|
547
|
+
for r in failed_list:
|
|
548
|
+
hku_warn(f"清理 {r[0]} {r[1]} {nktype} {r[2].start_of_day()}")
|
|
549
|
+
ch_importer.remove(r[0], r[1], nktype, r[2].start_of_day())
|
|
550
|
+
hku_warn(f"已清理 {market} {failed_count} 个失败股票的最后记录,建议重新导入")
|
|
551
|
+
|
|
552
|
+
if failed_count >= failed_limit:
|
|
553
|
+
hku_error(f"{market} {ktype} 连续失败20个股票,已停止导入, 建议重新导入")
|
|
554
|
+
return add_record_count
|
|
555
|
+
|
|
504
556
|
cur_year = Datetime.today().year
|
|
505
557
|
if ktype == "DAY":
|
|
506
558
|
update_stock_info(connect, market)
|
|
@@ -592,15 +644,16 @@ def import_on_stock_trans(connect, api, market, stock_record, max_days):
|
|
|
592
644
|
if second > 59:
|
|
593
645
|
continue
|
|
594
646
|
|
|
595
|
-
|
|
596
|
-
(
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
647
|
+
if record['price'] > 0.0 and record['vol'] >= 0.0:
|
|
648
|
+
trans_buf.append(
|
|
649
|
+
(
|
|
650
|
+
market, code,
|
|
651
|
+
Datetime(cur_date * 1000000 + minute * 100 + second).timestamp_utc()//1000000,
|
|
652
|
+
int(roundEx(record["price"], 3) * 1000.0),
|
|
653
|
+
int(record["vol"]),
|
|
654
|
+
record["buyorsell"],
|
|
655
|
+
)
|
|
602
656
|
)
|
|
603
|
-
)
|
|
604
657
|
except Exception as e:
|
|
605
658
|
hku_error("Failed trans to record! {}", e)
|
|
606
659
|
|
|
@@ -701,8 +754,9 @@ def import_on_stock_time(connect, api, market, stock_record, max_days):
|
|
|
701
754
|
elif time == 1360:
|
|
702
755
|
time = 1400
|
|
703
756
|
try:
|
|
704
|
-
|
|
705
|
-
|
|
757
|
+
if record['price'] > 0.0 and record['vol'] >= 0.0:
|
|
758
|
+
time_buf.append((market, code, Datetime(this_date + time).timestamp_utc() //
|
|
759
|
+
ticks, int(roundEx(record['price'], 3) * 1000.0), int(record['vol'])))
|
|
706
760
|
time += 1
|
|
707
761
|
except Exception as e:
|
|
708
762
|
hku_error("Failed trans record {}! {}".format(record, e))
|