hikyuu 2.6.8.3__py3-none-manylinux2014_aarch64.whl → 2.7.3__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 +55 -23
- hikyuu/__init__.pyi +626 -595
- hikyuu/analysis/__init__.pyi +589 -563
- hikyuu/analysis/analysis.pyi +590 -564
- hikyuu/core.py +2 -0
- hikyuu/core.pyi +591 -565
- hikyuu/cpp/__init__.pyi +2 -2
- hikyuu/cpp/core310.pyi +587 -130
- hikyuu/cpp/core310.so +0 -0
- hikyuu/cpp/core311.pyi +587 -130
- hikyuu/cpp/core311.so +0 -0
- hikyuu/cpp/core312.pyi +587 -130
- hikyuu/cpp/core312.so +0 -0
- hikyuu/cpp/core313.pyi +587 -130
- 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.so +0 -0
- hikyuu/cpp/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/libhku_hdf5.so +0 -0
- hikyuu/cpp/libhku_hdf5.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5.so.200.2.0 +0 -0
- hikyuu/cpp/libhku_hdf5_cpp.so +0 -0
- hikyuu/cpp/libhku_hdf5_cpp.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5_cpp.so.200.2.0 +0 -0
- hikyuu/cpp/libhku_hdf5_hl.so +0 -0
- hikyuu/cpp/libhku_hdf5_hl.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5_hl.so.200.1.0 +0 -0
- hikyuu/cpp/libhku_hdf5_hl_cpp.so +0 -0
- hikyuu/cpp/libhku_hdf5_hl_cpp.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5_hl_cpp.so.200.1.0 +0 -0
- hikyuu/cpp/libhku_hdf5_tools.so +0 -0
- hikyuu/cpp/libhku_hdf5_tools.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5_tools.so.200.1.1 +0 -0
- hikyuu/cpp/libsqlite3.so +0 -0
- hikyuu/data/clickhouse_upgrade/0001.sql +2 -0
- hikyuu/data/clickhouse_upgrade/createdb.sql +105 -105
- hikyuu/data/common.py +3 -3
- hikyuu/data/common_clickhouse.py +1 -3
- 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 +33 -6
- hikyuu/data/mysql_upgrade/0029.sql +2 -0
- hikyuu/data/pytdx_to_clickhouse.py +96 -38
- hikyuu/data/pytdx_to_h5.py +78 -29
- hikyuu/data/pytdx_to_mysql.py +69 -21
- hikyuu/data/pytdx_weight_to_clickhouse.py +3 -1
- hikyuu/data/pytdx_weight_to_mysql.py +3 -1
- hikyuu/data/pytdx_weight_to_sqlite.py +3 -1
- hikyuu/data/sqlite_upgrade/0029.sql +4 -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/data/zh_bond10_to_clickhouse.py +1 -1
- hikyuu/draw/__init__.pyi +1 -1
- hikyuu/draw/drawplot/__init__.pyi +8 -8
- hikyuu/draw/drawplot/bokeh_draw.pyi +610 -583
- hikyuu/draw/drawplot/common.pyi +1 -1
- hikyuu/draw/drawplot/echarts_draw.pyi +612 -585
- hikyuu/draw/drawplot/matplotlib_draw.py +12 -76
- hikyuu/draw/drawplot/matplotlib_draw.pyi +623 -596
- 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 -7
- hikyuu/extend.pyi +599 -573
- hikyuu/fetcher/stock/zh_block_em.py +12 -40
- hikyuu/gui/HikyuuTDX.py +140 -33
- 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 +1300 -761
- 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/gui/importdata.py +4 -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 +29 -4
- hikyuu/include/hikyuu/StrategyContext.h +4 -4
- hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +9 -0
- hikyuu/include/hikyuu/data_driver/BlockInfoDriver.h +6 -0
- hikyuu/include/hikyuu/data_driver/KDataDriver.h +24 -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 +6 -2
- hikyuu/include/hikyuu/data_driver/kdata/sqlite/SQLiteKDataDriver.h +2 -2
- hikyuu/include/hikyuu/data_driver/kdata/tdx/TdxKDataDriver.h +1 -1
- hikyuu/include/hikyuu/global/sysinfo.h +24 -5
- hikyuu/include/hikyuu/hikyuu.h +1 -1
- hikyuu/include/hikyuu/indicator/IndicatorImp.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/lang.h +15 -2
- hikyuu/include/hikyuu/misc.h +38 -0
- 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/dataserver.h +2 -1
- hikyuu/include/hikyuu/plugin/device.h +10 -0
- hikyuu/include/hikyuu/plugin/extind.h +40 -0
- hikyuu/include/hikyuu/plugin/hkuextra.h +1 -17
- hikyuu/include/hikyuu/plugin/interface/CheckDataPluginInterface.h +25 -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/HkuExtraPluginInterface.h +1 -13
- 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 +9 -1
- hikyuu/include/hikyuu/python/convert_any.h +9 -6
- hikyuu/include/hikyuu/python/pybind_utils.h +4 -11
- hikyuu/include/hikyuu/strategy/RunSystemInStrategy.h +3 -0
- hikyuu/include/hikyuu/strategy/Strategy.h +1 -1
- hikyuu/include/hikyuu/trade_manage/Performance.h +4 -4
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +10 -2
- hikyuu/include/hikyuu/trade_manage/TradeRecord.h +2 -1
- hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +0 -1
- 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 +0 -1
- hikyuu/include/hikyuu/trade_sys/environment/EnvironmentBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/moneymanager/imp/FixedCapitalFundsMM.h +0 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +36 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/NormalizeBase.h +124 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/ScoresFilterBase.h +124 -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 +20 -13
- 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/profitgoal/ProfitGoalBase.h +9 -11
- hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +49 -1
- 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/SignalBase.h +0 -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/SlippageBase.h +0 -1
- 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/stoploss/StoplossBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/system/System.h +15 -3
- hikyuu/include/hikyuu/utilities/Log.h +6 -7
- hikyuu/include/hikyuu/utilities/Parameter.h +17 -0
- hikyuu/include/hikyuu/utilities/SpendTimer.h +17 -7
- hikyuu/include/hikyuu/utilities/arithmetic.h +55 -0
- hikyuu/include/hikyuu/utilities/config.h +28 -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/PluginBase.h +17 -2
- hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +4 -1
- hikyuu/include/hikyuu/utilities/plugin/PluginManager.h +41 -22
- hikyuu/include/hikyuu/utilities/thread/GlobalStealThreadPool.h +1 -2
- hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +1 -1
- 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 -0
- hikyuu/include/hikyuu/utilities/thread/WorkStealQueue.h +9 -8
- hikyuu/include/hikyuu/utilities/thread/algorithm.h +64 -14
- hikyuu/include/hikyuu/version.h +5 -5
- 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/{cpp/core39.so → 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/trade_manage/__init__.pyi +607 -582
- 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 +607 -582
- hikyuu/trade_sys/trade_sys.py +54 -5
- hikyuu/util/__init__.pyi +2 -2
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/METADATA +42 -32
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/RECORD +267 -212
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/top_level.txt +2 -2
- hikyuu/cpp/core39.pyi +0 -14190
- hikyuu/data/pytdx_to_taos.py +0 -736
- 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/views/arrow_common.h +0 -38
- hikyuu/include/hikyuu/views/arrow_views.h +0 -117
- hikyuu/tools/update_block_info.py +0 -168
- /hikyuu/include/hikyuu/{views → trade_sys/multifactor/filter}/__init__.py +0 -0
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/WHEEL +0 -0
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/entry_points.txt +0 -0
|
@@ -6,14 +6,14 @@ import logging
|
|
|
6
6
|
import time
|
|
7
7
|
import datetime
|
|
8
8
|
from math import ceil
|
|
9
|
-
from
|
|
9
|
+
from PySide6.QtCore import QThread, QWaitCondition, QMutex, Signal
|
|
10
10
|
|
|
11
11
|
from hikyuu.util import *
|
|
12
12
|
from hikyuu import Datetime, TimeDelta
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class SchedImportThread(QThread):
|
|
16
|
-
message =
|
|
16
|
+
message = Signal()
|
|
17
17
|
|
|
18
18
|
def __init__(self, config):
|
|
19
19
|
super(self.__class__, self).__init__()
|
|
@@ -28,7 +28,7 @@ import datetime
|
|
|
28
28
|
import mysql.connector
|
|
29
29
|
import queue
|
|
30
30
|
from multiprocessing import Queue, Process
|
|
31
|
-
from
|
|
31
|
+
from PySide6.QtCore import QThread, Signal
|
|
32
32
|
from hikyuu.gui.data.ImportWeightToSqliteTask import ImportWeightToSqliteTask
|
|
33
33
|
from hikyuu.gui.data.ImportPytdxToH5Task import ImportPytdxToH5
|
|
34
34
|
from hikyuu.gui.data.ImportPytdxTransToH5Task import ImportPytdxTransToH5
|
|
@@ -58,7 +58,7 @@ from hikyuu.util.mylog import class_logger
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
class UsePytdxImportToH5Thread(QThread):
|
|
61
|
-
message =
|
|
61
|
+
message = Signal(list)
|
|
62
62
|
|
|
63
63
|
def __init__(self, parent, config):
|
|
64
64
|
super(UsePytdxImportToH5Thread, self).__init__()
|
|
@@ -98,7 +98,7 @@ class UsePytdxImportToH5Thread(QThread):
|
|
|
98
98
|
|
|
99
99
|
if self.config.getboolean('block', 'enable', fallback=True):
|
|
100
100
|
self.tasks.append(ImportBlockInfoTask(self.log_queue, self.queue,
|
|
101
|
-
self.config
|
|
101
|
+
self.config)) # '概念板块', '地域板块',
|
|
102
102
|
|
|
103
103
|
self.tasks.append(ImportZhBond10Task(self.log_queue, self.queue, self.config))
|
|
104
104
|
|
|
@@ -28,7 +28,7 @@ import datetime
|
|
|
28
28
|
import mysql.connector
|
|
29
29
|
import queue
|
|
30
30
|
from multiprocessing import Queue, Process
|
|
31
|
-
from
|
|
31
|
+
from PySide6.QtCore import QThread, Signal
|
|
32
32
|
from hikyuu.gui.data.ImportQmtToH5Task import ImportQmtToH5Task
|
|
33
33
|
from hikyuu.gui.data.ImportWeightToSqliteTask import ImportWeightToSqliteTask
|
|
34
34
|
from hikyuu.gui.data.ImportQmtToH5Task import ImportQmtToH5Task
|
|
@@ -51,7 +51,7 @@ from hikyuu.util.mylog import class_logger
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
class UseQmtImportToH5Thread(QThread):
|
|
54
|
-
message =
|
|
54
|
+
message = Signal(list)
|
|
55
55
|
|
|
56
56
|
def __init__(self, parent, config):
|
|
57
57
|
super(UseQmtImportToH5Thread, self).__init__()
|
|
@@ -28,7 +28,7 @@ import datetime
|
|
|
28
28
|
import mysql.connector
|
|
29
29
|
import queue
|
|
30
30
|
from multiprocessing import Queue, Process
|
|
31
|
-
from
|
|
31
|
+
from PySide6.QtCore import QThread, Signal
|
|
32
32
|
from hikyuu.gui.data.ImportTdxToH5Task import ImportTdxToH5Task
|
|
33
33
|
from hikyuu.gui.data.ImportWeightToSqliteTask import ImportWeightToSqliteTask
|
|
34
34
|
from hikyuu.gui.data.ImportTdxToH5Task import ImportTdxToH5Task
|
|
@@ -55,7 +55,7 @@ from hikyuu.util.mylog import class_logger
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
class UseTdxImportToH5Thread(QThread):
|
|
58
|
-
message =
|
|
58
|
+
message = Signal(list)
|
|
59
59
|
|
|
60
60
|
def __init__(self, parent, config):
|
|
61
61
|
super(UseTdxImportToH5Thread, self).__init__()
|
|
@@ -95,7 +95,7 @@ class UseTdxImportToH5Thread(QThread):
|
|
|
95
95
|
ImportHistoryFinanceTask(self.log_queue, self.queue, self.config, dest_dir))
|
|
96
96
|
|
|
97
97
|
self.tasks.append(ImportBlockInfoTask(self.log_queue, self.queue,
|
|
98
|
-
self.config
|
|
98
|
+
self.config)) # '概念板块', '地域板块'
|
|
99
99
|
self.tasks.append(ImportZhBond10Task(self.log_queue, self.queue, self.config))
|
|
100
100
|
|
|
101
101
|
task_count = 0
|
hikyuu/gui/data/tool.py
CHANGED
|
@@ -6,38 +6,45 @@
|
|
|
6
6
|
|
|
7
7
|
'''
|
|
8
8
|
|
|
9
|
-
import os
|
|
10
|
-
import os.path
|
|
9
|
+
import os
|
|
10
|
+
import os.path
|
|
11
11
|
|
|
12
|
-
# UI文件所在的路径
|
|
13
|
-
dir = './'
|
|
12
|
+
# UI文件所在的路径
|
|
13
|
+
dir = './'
|
|
14
14
|
|
|
15
15
|
# 列出目录下的所有ui文件
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def listUiFile():
|
|
19
|
+
list = []
|
|
20
|
+
files = os.listdir(dir)
|
|
21
|
+
for filename in files:
|
|
22
|
+
# print( dir + os.sep + f )
|
|
23
|
+
# print(filename)
|
|
24
|
+
if os.path.splitext(filename)[1] == '.ui':
|
|
25
|
+
list.append(filename)
|
|
26
|
+
|
|
27
|
+
return list
|
|
28
|
+
|
|
29
|
+
# 把后缀为ui的文件改成后缀为py的文件名
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def transPyFile(filename):
|
|
33
|
+
return os.path.splitext(filename)[0] + '.py'
|
|
30
34
|
|
|
31
35
|
# 调用系统命令把ui转换成py
|
|
36
|
+
|
|
37
|
+
|
|
32
38
|
def runMain():
|
|
33
39
|
list = listUiFile()
|
|
34
|
-
for uifile in list
|
|
40
|
+
for uifile in list:
|
|
35
41
|
pyfile = transPyFile(uifile)
|
|
36
|
-
cmd = '
|
|
37
|
-
#cmd = 'pyside2-uic -o {pyfile} {uifile}'.format(pyfile=pyfile, uifile=uifile)
|
|
38
|
-
|
|
42
|
+
cmd = 'pyside6-uic -o {pyfile} {uifile}'.format(pyfile=pyfile, uifile=uifile)
|
|
43
|
+
# cmd = 'pyside2-uic -o {pyfile} {uifile}'.format(pyfile=pyfile, uifile=uifile)
|
|
44
|
+
# print(cmd)
|
|
39
45
|
os.system(cmd)
|
|
40
46
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
|
|
48
|
+
# 程序的主入口
|
|
49
|
+
if __name__ == "__main__":
|
|
50
|
+
runMain()
|
hikyuu/gui/dataserver.py
CHANGED
|
@@ -11,13 +11,15 @@ import click
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
@click.command()
|
|
14
|
-
@click.option('--addr', '-addr', default="tcp://
|
|
14
|
+
@click.option('--addr', '-addr', default="tcp://0.0.0.0:9201", help='自身对外提供的服务地址, 如需外部机器访问,请使用 tcp://0.0.0.0:port')
|
|
15
15
|
@click.option('--work_num', '-n', default=2, type=int, help='行情接收处理线程数')
|
|
16
16
|
@click.option('--save', '-save', default=False, type=bool, help='保存行情数据(仅支持clickhouse)')
|
|
17
17
|
@click.option('--buf', '-buf', default=False, type=bool, help='缓存行情数据')
|
|
18
|
-
|
|
18
|
+
@click.option('--parquet_path', '-parquet_path', default="", help='Parquet 文件存储路径, 空字符串表示不保存')
|
|
19
|
+
def main(addr, work_num, save, buf, parquet_path):
|
|
20
|
+
# 如需其他机器访问,addr 参数需为 tcp://0.0.0.0:port
|
|
19
21
|
try:
|
|
20
|
-
start_data_server(addr, work_num, save_tick=save, buf_tick=buf)
|
|
22
|
+
start_data_server(addr, work_num, save_tick=save, buf_tick=buf, parquet_path=parquet_path)
|
|
21
23
|
|
|
22
24
|
while True:
|
|
23
25
|
try:
|
|
Binary file
|
hikyuu/gui/importdata.py
CHANGED
|
@@ -9,6 +9,7 @@ from configparser import ConfigParser
|
|
|
9
9
|
|
|
10
10
|
from hikyuu.data.weight_to_sqlite import qianlong_import_weight
|
|
11
11
|
from hikyuu.data.common_pytdx import search_best_tdx
|
|
12
|
+
from hikyuu.data.hku_config_template import generate_default_config
|
|
12
13
|
|
|
13
14
|
from hikyuu.gui.data.UseTdxImportToH5Thread import UseTdxImportToH5Thread
|
|
14
15
|
from hikyuu.gui.data.UsePytdxImportToH5Thread import UsePytdxImportToH5Thread
|
|
@@ -26,7 +27,10 @@ class HKUImportDataCMD:
|
|
|
26
27
|
# 读取保存的配置文件信息,如果不存在,则使用默认配置
|
|
27
28
|
this_dir = self.getUserConfigDir()
|
|
28
29
|
import_config = ConfigParser()
|
|
30
|
+
if not os.path.exists(this_dir + '/importdata-gui.ini'):
|
|
31
|
+
generate_default_config()
|
|
29
32
|
import_config.read(this_dir + '/importdata-gui.ini', encoding='utf-8')
|
|
33
|
+
|
|
30
34
|
if self.ignore_kdata:
|
|
31
35
|
import_config.set('ktype', 'day', 'False')
|
|
32
36
|
import_config.set('ktype', 'min', 'False')
|
hikyuu/hub.pyi
CHANGED
|
@@ -28,11 +28,11 @@ import sys as sys
|
|
|
28
28
|
import typing
|
|
29
29
|
__all__: list = ['add_remote_hub', 'add_local_hub', 'update_hub', 'remove_hub', 'build_hub', 'help_part', 'get_part', 'get_part_list', 'get_hub_path', 'get_part_info', 'get_part_module', 'print_part_info', 'get_hub_name_list', 'get_part_name_list', 'get_current_hub', 'search_part']
|
|
30
30
|
class ConfigModel(sqlalchemy.orm.decl_api.Base):
|
|
31
|
-
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at
|
|
31
|
+
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0xffff36f05b70; ConfigModel>
|
|
32
32
|
__table__: typing.ClassVar[sqlalchemy.sql.schema.Table] # value = Table('hub_config', MetaData(), Column('id', Integer(), table=<hub_config>, primary_key=True, nullable=False, default=Sequence('config_id_seq', metadata=MetaData())), Column('key', String(), table=<hub_config>), Column('value', String(), table=<hub_config>), schema=None)
|
|
33
33
|
__table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('key', String(), table=<hub_config>)))
|
|
34
34
|
__tablename__: typing.ClassVar[str] = 'hub_config'
|
|
35
|
-
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.ConfigModel'> at
|
|
35
|
+
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.ConfigModel'> at ffff36eff6f0>
|
|
36
36
|
def __init__(self, **kwargs):
|
|
37
37
|
"""
|
|
38
38
|
A simple constructor that allows initialization from kwargs.
|
|
@@ -109,11 +109,11 @@ class HubManager:
|
|
|
109
109
|
def print_part_info(self, name):
|
|
110
110
|
...
|
|
111
111
|
class HubModel(sqlalchemy.orm.decl_api.Base):
|
|
112
|
-
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at
|
|
112
|
+
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0xffff36f06a10; HubModel>
|
|
113
113
|
__table__: typing.ClassVar[sqlalchemy.sql.schema.Table] # value = Table('hub_repo', MetaData(), Column('id', Integer(), table=<hub_repo>, primary_key=True, nullable=False, default=Sequence('remote_id_seq', metadata=MetaData())), Column('name', String(), table=<hub_repo>), Column('hub_type', String(), table=<hub_repo>), Column('local_base', String(), table=<hub_repo>), Column('local', String(), table=<hub_repo>), Column('url', String(), table=<hub_repo>), Column('branch', String(), table=<hub_repo>), schema=None)
|
|
114
114
|
__table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('name', String(), table=<hub_repo>)))
|
|
115
115
|
__tablename__: typing.ClassVar[str] = 'hub_repo'
|
|
116
|
-
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.HubModel'> at
|
|
116
|
+
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.HubModel'> at ffff36f40540>
|
|
117
117
|
def __init__(self, **kwargs):
|
|
118
118
|
"""
|
|
119
119
|
A simple constructor that allows initialization from kwargs.
|
|
@@ -146,11 +146,11 @@ class ModuleConflictError(Exception):
|
|
|
146
146
|
def __str__(self):
|
|
147
147
|
...
|
|
148
148
|
class PartModel(sqlalchemy.orm.decl_api.Base):
|
|
149
|
-
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at
|
|
149
|
+
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0xffff36f06f50; PartModel>
|
|
150
150
|
__table__: typing.ClassVar[sqlalchemy.sql.schema.Table] # value = Table('hub_part', MetaData(), Column('id', Integer(), table=<hub_part>, primary_key=True, nullable=False, default=Sequence('part_id_seq', metadata=MetaData())), Column('hub_name', String(), table=<hub_part>), Column('part', String(), table=<hub_part>), Column('name', String(), table=<hub_part>), Column('author', String(), table=<hub_part>), Column('version', String(), table=<hub_part>), Column('doc', String(), table=<hub_part>), Column('module_name', String(), table=<hub_part>), Column('label', String(), table=<hub_part>), schema=None)
|
|
151
151
|
__table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('name', String(), table=<hub_part>)))
|
|
152
152
|
__tablename__: typing.ClassVar[str] = 'hub_part'
|
|
153
|
-
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.PartModel'> at
|
|
153
|
+
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.PartModel'> at ffff36f41490>
|
|
154
154
|
def __init__(self, **kwargs):
|
|
155
155
|
"""
|
|
156
156
|
A simple constructor that allows initialization from kwargs.
|
hikyuu/include/hikyuu/DataType.h
CHANGED
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
#include "utilities/config.h"
|
|
43
43
|
#include "lang.h"
|
|
44
44
|
|
|
45
|
+
#if HKU_OS_OSX
|
|
46
|
+
#include <MacTypes.h>
|
|
47
|
+
#endif
|
|
48
|
+
|
|
45
49
|
#if HKU_SUPPORT_SERIALIZATION
|
|
46
50
|
#include <boost/serialization/nvp.hpp>
|
|
47
51
|
#include <boost/serialization/split_free.hpp>
|
|
@@ -156,22 +160,6 @@ inline bool iszero(price_t num) {
|
|
|
156
160
|
|
|
157
161
|
using fmt::format;
|
|
158
162
|
|
|
159
|
-
inline std::ostream &operator<<(std::ostream &os, const PriceList &p) {
|
|
160
|
-
size_t len = p.size();
|
|
161
|
-
const size_t print = 3;
|
|
162
|
-
os << "[";
|
|
163
|
-
for (size_t i = 0; i < len; i++) {
|
|
164
|
-
if ((i < print) || (i >= len - print)) {
|
|
165
|
-
os << p[i];
|
|
166
|
-
if (i != len - 1)
|
|
167
|
-
os << ", ";
|
|
168
|
-
} else if (i == 3)
|
|
169
|
-
os << "..., ";
|
|
170
|
-
}
|
|
171
|
-
os << "]";
|
|
172
|
-
return os;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
163
|
/** @} */
|
|
176
164
|
|
|
177
165
|
} // namespace hku
|
hikyuu/include/hikyuu/KData.h
CHANGED
|
@@ -191,7 +191,10 @@ public:
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
private:
|
|
194
|
-
|
|
194
|
+
std::shared_ptr<KDataImp>& get_null_kdata_imp() {
|
|
195
|
+
static std::shared_ptr<KDataImp> instance = std::make_shared<KDataImp>(); // 第一次调用时初始化
|
|
196
|
+
return instance;
|
|
197
|
+
}
|
|
195
198
|
|
|
196
199
|
private:
|
|
197
200
|
KDataImpPtr m_imp;
|
|
@@ -249,7 +252,7 @@ KData HKU_API getKData(const string& market_code, int64_t start = 0, int64_t end
|
|
|
249
252
|
inline KData::KData(const KData& x) : m_imp(x.m_imp) {}
|
|
250
253
|
|
|
251
254
|
inline KData::KData(KData&& x) : m_imp(std::move(x.m_imp)) {
|
|
252
|
-
x.m_imp =
|
|
255
|
+
x.m_imp = get_null_kdata_imp();
|
|
253
256
|
}
|
|
254
257
|
|
|
255
258
|
inline KData& KData::operator=(const KData& x) {
|
|
@@ -263,7 +266,7 @@ inline KData& KData::operator=(KData&& x) {
|
|
|
263
266
|
if (this == &x)
|
|
264
267
|
return *this;
|
|
265
268
|
m_imp = std::move(x.m_imp);
|
|
266
|
-
x.m_imp =
|
|
269
|
+
x.m_imp = get_null_kdata_imp();
|
|
267
270
|
return *this;
|
|
268
271
|
}
|
|
269
272
|
|
|
@@ -15,7 +15,7 @@ class HKU_API KDataPrivatedBufferImp : public KDataImp {
|
|
|
15
15
|
public:
|
|
16
16
|
KDataPrivatedBufferImp();
|
|
17
17
|
KDataPrivatedBufferImp(const Stock& stock, const KQuery& query);
|
|
18
|
-
virtual ~KDataPrivatedBufferImp();
|
|
18
|
+
virtual ~KDataPrivatedBufferImp() override;
|
|
19
19
|
|
|
20
20
|
virtual bool empty() const override {
|
|
21
21
|
return m_buffer.empty();
|
|
@@ -15,7 +15,7 @@ class HKU_API KDataSharedBufferImp : public KDataImp {
|
|
|
15
15
|
public:
|
|
16
16
|
KDataSharedBufferImp() = default;
|
|
17
17
|
KDataSharedBufferImp(const Stock& stock, const KQuery& query);
|
|
18
|
-
virtual ~KDataSharedBufferImp();
|
|
18
|
+
virtual ~KDataSharedBufferImp() override;
|
|
19
19
|
|
|
20
20
|
virtual bool empty() const override {
|
|
21
21
|
return m_size == 0;
|
hikyuu/include/hikyuu/KQuery.h
CHANGED
|
@@ -157,7 +157,7 @@ public:
|
|
|
157
157
|
|
|
158
158
|
/** 获取K线数据类型 */
|
|
159
159
|
// KType kType() const { return m_dataType; }
|
|
160
|
-
string kType() const {
|
|
160
|
+
const string& kType() const {
|
|
161
161
|
return m_dataType;
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -191,7 +191,7 @@ public:
|
|
|
191
191
|
static string getQueryTypeName(QueryType);
|
|
192
192
|
|
|
193
193
|
/** 获取KType名称,用于显示输出 */
|
|
194
|
-
static string getKTypeName(KType);
|
|
194
|
+
static string getKTypeName(const KType&);
|
|
195
195
|
|
|
196
196
|
/** 获取recoverType名称,用于显示输出 */
|
|
197
197
|
static string getRecoverTypeName(RecoverType);
|
hikyuu/include/hikyuu/Stock.h
CHANGED
|
@@ -240,6 +240,8 @@ public:
|
|
|
240
240
|
/** 指定类型的K线数据是否被缓存 */
|
|
241
241
|
bool isBuffer(KQuery::KType) const;
|
|
242
242
|
|
|
243
|
+
bool isPreload(KQuery::KType ktype) const;
|
|
244
|
+
|
|
243
245
|
/** 是否为Null */
|
|
244
246
|
bool isNull() const;
|
|
245
247
|
|
|
@@ -274,7 +276,8 @@ private:
|
|
|
274
276
|
// 仅供 StockManager 初始化时调用
|
|
275
277
|
void setPreload(const vector<KQuery::KType>& preload_ktypes);
|
|
276
278
|
|
|
277
|
-
|
|
279
|
+
void loadKDataToBufferFromKRecordList(const KQuery::KType& ktype, KRecordList&& ks) const;
|
|
280
|
+
void setHistoryFinance(vector<HistoryFinanceInfo>&&);
|
|
278
281
|
|
|
279
282
|
private:
|
|
280
283
|
struct HKU_API Data;
|
|
@@ -90,7 +90,7 @@ public:
|
|
|
90
90
|
|
|
91
91
|
/** 是否所有数据准备完毕 */
|
|
92
92
|
bool dataReady() const;
|
|
93
|
-
|
|
93
|
+
bool initializing() const;
|
|
94
94
|
/**
|
|
95
95
|
* 根据"市场简称证券代码"获取对应的证券实例
|
|
96
96
|
* @param querystr 格式:“市场简称证券代码”,如"sh000001"
|
|
@@ -130,6 +130,9 @@ public:
|
|
|
130
130
|
/** 获取市场简称列表 */
|
|
131
131
|
StringList getAllMarket() const;
|
|
132
132
|
|
|
133
|
+
/** 获取所有板块分类 */
|
|
134
|
+
StringList getAllCategory();
|
|
135
|
+
|
|
133
136
|
/**
|
|
134
137
|
* 获取预定义的板块
|
|
135
138
|
* @param category 板块分类
|
|
@@ -161,6 +164,13 @@ public:
|
|
|
161
164
|
*/
|
|
162
165
|
BlockList getBlockList();
|
|
163
166
|
|
|
167
|
+
/**
|
|
168
|
+
* 获取指定指数的板块列表, 如果不存在返回空列表
|
|
169
|
+
* @param index_stk 指数
|
|
170
|
+
* @return 板块列表
|
|
171
|
+
*/
|
|
172
|
+
BlockList getBlockListByIndexStock(const Stock& stk);
|
|
173
|
+
|
|
164
174
|
/**
|
|
165
175
|
* 获取指定证券所属的板块列表
|
|
166
176
|
* @param stk 指定证券
|
|
@@ -265,6 +275,15 @@ public:
|
|
|
265
275
|
/** 设置多语言支持路径(仅在初始化之前有效) */
|
|
266
276
|
void setLanguagePath(const std::string& path);
|
|
267
277
|
|
|
278
|
+
/** 取消加载,退出时使用 */
|
|
279
|
+
void cancelLoad() {
|
|
280
|
+
m_cancel_load = true;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
bool hasCancelLoad() const {
|
|
284
|
+
return m_cancel_load;
|
|
285
|
+
}
|
|
286
|
+
|
|
268
287
|
public:
|
|
269
288
|
typedef StockMapIterator const_iterator;
|
|
270
289
|
const_iterator begin() const {
|
|
@@ -280,6 +299,7 @@ private:
|
|
|
280
299
|
|
|
281
300
|
/* 加载 K线数据至缓存 */
|
|
282
301
|
void loadAllKData();
|
|
302
|
+
std::unordered_set<string> tryLoadAllKDataFromColumnFirst(const vector<KQuery::KType>& ktypes);
|
|
283
303
|
|
|
284
304
|
/* 加载节假日信息 */
|
|
285
305
|
void loadAllHolidays();
|
|
@@ -307,9 +327,10 @@ private:
|
|
|
307
327
|
|
|
308
328
|
private:
|
|
309
329
|
static StockManager* m_sm;
|
|
310
|
-
std::atomic_bool m_initializing;
|
|
311
|
-
std::atomic_bool
|
|
312
|
-
std::
|
|
330
|
+
std::atomic_bool m_initializing{false};
|
|
331
|
+
std::atomic_bool m_cancel_load{false}; // 取消加载, 用于退出指示
|
|
332
|
+
std::atomic_bool m_data_ready{true}; // 用于指示是否所有数据准备完毕, 如果未初始化则为 true
|
|
333
|
+
std::thread::id m_thread_id; // 记录线程id,用于判断Stratege是以独立进程方式还是线程方式运行
|
|
313
334
|
string m_tmpdir;
|
|
314
335
|
string m_datadir;
|
|
315
336
|
BaseInfoDriverPtr m_baseInfoDriver;
|
|
@@ -355,6 +376,10 @@ inline bool StockManager::dataReady() const {
|
|
|
355
376
|
return m_data_ready;
|
|
356
377
|
}
|
|
357
378
|
|
|
379
|
+
inline bool StockManager::initializing() const {
|
|
380
|
+
return m_initializing;
|
|
381
|
+
}
|
|
382
|
+
|
|
358
383
|
inline Stock StockManager::operator[](const string& query) const {
|
|
359
384
|
return getStock(query);
|
|
360
385
|
}
|
|
@@ -38,7 +38,7 @@ public:
|
|
|
38
38
|
* @param preloadNum 指定的预加载数量,如:{{"min_max", 100}, {"day_max", 200}}
|
|
39
39
|
*/
|
|
40
40
|
StrategyContext(const vector<string>& stockCodeList, const vector<KQuery::KType>& ktypeList,
|
|
41
|
-
const unordered_map<string,
|
|
41
|
+
const unordered_map<string, int64_t>& preloadNum = {});
|
|
42
42
|
|
|
43
43
|
// 自定义移动构造与赋值会引起 python 中无法正常退出
|
|
44
44
|
// StrategyContext(const StrategyContext&) = default;
|
|
@@ -77,9 +77,9 @@ public:
|
|
|
77
77
|
return m_ktypeList;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
void setPreloadNum(const unordered_map<string,
|
|
80
|
+
void setPreloadNum(const unordered_map<string, int64_t>& preloadNum);
|
|
81
81
|
|
|
82
|
-
const unordered_map<string,
|
|
82
|
+
const unordered_map<string, int64_t>& getPreloadNum() const noexcept {
|
|
83
83
|
return m_preloadNum;
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -108,7 +108,7 @@ private:
|
|
|
108
108
|
vector<string> m_mustLoad{"sh000001", "sh000300"}; // 默认必须加载的 stock
|
|
109
109
|
vector<string> m_stockCodeList;
|
|
110
110
|
vector<KQuery::KType> m_ktypeList;
|
|
111
|
-
unordered_map<string,
|
|
111
|
+
unordered_map<string, int64_t> m_preloadNum;
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
HKU_API std::ostream& operator<<(std::ostream& os, const StrategyContext& context);
|
|
@@ -216,6 +216,15 @@ public:
|
|
|
216
216
|
*/
|
|
217
217
|
virtual ZhBond10List getAllZhBond10() = 0;
|
|
218
218
|
|
|
219
|
+
/**
|
|
220
|
+
* 获取所有历史财务信息, 用于列式存储时数据初始化使用
|
|
221
|
+
*/
|
|
222
|
+
virtual unordered_map<string, vector<HistoryFinanceInfo>> getAllHistoryFinance(
|
|
223
|
+
const std::atomic_bool& cancel_flag) {
|
|
224
|
+
HKU_ERROR("Not support getAllHistoryFinance()!");
|
|
225
|
+
return unordered_map<string, vector<HistoryFinanceInfo>>();
|
|
226
|
+
}
|
|
227
|
+
|
|
219
228
|
private:
|
|
220
229
|
bool checkType();
|
|
221
230
|
|
|
@@ -119,6 +119,20 @@ public:
|
|
|
119
119
|
*/
|
|
120
120
|
virtual TransList getTransList(const string& market, const string& code, const KQuery& query);
|
|
121
121
|
|
|
122
|
+
//---------------------------------------------------
|
|
123
|
+
// 以下为列式数据库接口
|
|
124
|
+
//---------------------------------------------------
|
|
125
|
+
|
|
126
|
+
/** 是否列优先(列数据库存储K线数据) */
|
|
127
|
+
virtual bool isColumnFirst() const {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
virtual std::unordered_map<std::string, KRecordList> getAllKRecordList(
|
|
132
|
+
const KQuery::KType& ktype, const Datetime& start_date, const std::atomic_bool& cancel_flag) {
|
|
133
|
+
HKU_THROW("Not support getAllKRecordList");
|
|
134
|
+
}
|
|
135
|
+
|
|
122
136
|
protected:
|
|
123
137
|
virtual bool isPythonObject() const {
|
|
124
138
|
return false;
|
|
@@ -169,7 +183,7 @@ public:
|
|
|
169
183
|
return m_driver->canParallelLoad();
|
|
170
184
|
}
|
|
171
185
|
|
|
172
|
-
size_t getCount(const string& market, const string& code, KQuery::KType kType) {
|
|
186
|
+
size_t getCount(const string& market, const string& code, const KQuery::KType& kType) {
|
|
173
187
|
return m_driver->getCount(market, code, kType);
|
|
174
188
|
}
|
|
175
189
|
|
|
@@ -190,6 +204,15 @@ public:
|
|
|
190
204
|
return m_driver->getTransList(market, code, query);
|
|
191
205
|
}
|
|
192
206
|
|
|
207
|
+
bool isColumnFirst() const {
|
|
208
|
+
return m_driver->isColumnFirst();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
std::unordered_map<std::string, KRecordList> getAllKRecordList(
|
|
212
|
+
const KQuery::KType& ktype, const Datetime& start_date, const std::atomic_bool& cancel_flag) {
|
|
213
|
+
return m_driver->getAllKRecordList(ktype, start_date, cancel_flag);
|
|
214
|
+
}
|
|
215
|
+
|
|
193
216
|
private:
|
|
194
217
|
KDataDriverPtr m_driver;
|
|
195
218
|
};
|
|
@@ -24,7 +24,7 @@ namespace hku {
|
|
|
24
24
|
class MySQLBaseInfoDriver : public BaseInfoDriver {
|
|
25
25
|
public:
|
|
26
26
|
MySQLBaseInfoDriver();
|
|
27
|
-
virtual ~MySQLBaseInfoDriver();
|
|
27
|
+
virtual ~MySQLBaseInfoDriver() override;
|
|
28
28
|
|
|
29
29
|
virtual bool _init() override;
|
|
30
30
|
virtual vector<StockInfo> getAllStockInfo() override;
|
|
@@ -20,7 +20,7 @@ namespace hku {
|
|
|
20
20
|
class SQLiteBaseInfoDriver : public BaseInfoDriver {
|
|
21
21
|
public:
|
|
22
22
|
SQLiteBaseInfoDriver();
|
|
23
|
-
virtual ~SQLiteBaseInfoDriver();
|
|
23
|
+
virtual ~SQLiteBaseInfoDriver() override;
|
|
24
24
|
|
|
25
25
|
virtual bool _init() override;
|
|
26
26
|
virtual vector<MarketInfo> getAllMarketInfo() override;
|
|
@@ -15,10 +15,11 @@ namespace hku {
|
|
|
15
15
|
class MySQLBlockInfoDriver : public BlockInfoDriver {
|
|
16
16
|
public:
|
|
17
17
|
MySQLBlockInfoDriver() : BlockInfoDriver("mysql") {};
|
|
18
|
-
virtual ~MySQLBlockInfoDriver();
|
|
18
|
+
virtual ~MySQLBlockInfoDriver() override;
|
|
19
19
|
|
|
20
20
|
virtual void load() override;
|
|
21
21
|
virtual bool _init() override;
|
|
22
|
+
virtual StringList getAllCategory() override;
|
|
22
23
|
virtual Block getBlock(const string&, const string&) override;
|
|
23
24
|
virtual BlockList getBlockList(const string& category) override;
|
|
24
25
|
virtual BlockList getBlockList() override;
|
|
@@ -16,9 +16,10 @@ namespace hku {
|
|
|
16
16
|
class QLBlockInfoDriver : public BlockInfoDriver {
|
|
17
17
|
public:
|
|
18
18
|
QLBlockInfoDriver() : BlockInfoDriver("qianlong") {};
|
|
19
|
-
virtual ~QLBlockInfoDriver();
|
|
19
|
+
virtual ~QLBlockInfoDriver() override;
|
|
20
20
|
|
|
21
21
|
virtual bool _init() override;
|
|
22
|
+
virtual StringList getAllCategory() override;
|
|
22
23
|
virtual Block getBlock(const string&, const string&) override;
|
|
23
24
|
virtual BlockList getBlockList(const string& category) override;
|
|
24
25
|
virtual BlockList getBlockList() override;
|
|
@@ -15,10 +15,11 @@ namespace hku {
|
|
|
15
15
|
class SQLiteBlockInfoDriver : public BlockInfoDriver {
|
|
16
16
|
public:
|
|
17
17
|
SQLiteBlockInfoDriver() : BlockInfoDriver("sqlite3") {};
|
|
18
|
-
virtual ~SQLiteBlockInfoDriver();
|
|
18
|
+
virtual ~SQLiteBlockInfoDriver() override;
|
|
19
19
|
|
|
20
20
|
virtual void load() override;
|
|
21
21
|
virtual bool _init() override;
|
|
22
|
+
virtual StringList getAllCategory() override;
|
|
22
23
|
virtual Block getBlock(const string&, const string&) override;
|
|
23
24
|
virtual BlockList getBlockList(const string& category) override;
|
|
24
25
|
virtual BlockList getBlockList() override;
|
|
@@ -15,7 +15,7 @@ namespace hku {
|
|
|
15
15
|
class DoNothingKDataDriver : public KDataDriver {
|
|
16
16
|
public:
|
|
17
17
|
DoNothingKDataDriver() : KDataDriver("DoNothing") {}
|
|
18
|
-
virtual ~DoNothingKDataDriver() = default;
|
|
18
|
+
virtual ~DoNothingKDataDriver() override = default;
|
|
19
19
|
|
|
20
20
|
virtual KDataDriverPtr _clone() override {
|
|
21
21
|
return std::make_shared<DoNothingKDataDriver>();
|
|
@@ -21,7 +21,7 @@ class KDataTempCsvDriver : public KDataDriver {
|
|
|
21
21
|
public:
|
|
22
22
|
KDataTempCsvDriver();
|
|
23
23
|
KDataTempCsvDriver(const string& day_filename, const string& min_filename);
|
|
24
|
-
virtual ~KDataTempCsvDriver();
|
|
24
|
+
virtual ~KDataTempCsvDriver() override;
|
|
25
25
|
|
|
26
26
|
void setDayFileName(const string& day_filename) {
|
|
27
27
|
m_day_filename = day_filename;
|
|
@@ -17,7 +17,7 @@ namespace hku {
|
|
|
17
17
|
class HKU_API H5KDataDriver : public KDataDriver {
|
|
18
18
|
public:
|
|
19
19
|
H5KDataDriver();
|
|
20
|
-
virtual ~H5KDataDriver();
|
|
20
|
+
virtual ~H5KDataDriver() override;
|
|
21
21
|
|
|
22
22
|
virtual KDataDriverPtr _clone() override {
|
|
23
23
|
return std::make_shared<H5KDataDriver>();
|