hikyuu 2.7.2__py3-none-win_amd64.whl → 2.7.5__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 +21 -7
- hikyuu/__init__.pyi +16 -14
- hikyuu/analysis/__init__.pyi +2 -0
- hikyuu/analysis/analysis.pyi +3 -1
- hikyuu/core.pyi +4 -2
- hikyuu/cpp/boost_date_time-mt.dll +0 -0
- hikyuu/cpp/boost_serialization-mt.dll +0 -0
- hikyuu/cpp/boost_wserialization-mt.dll +0 -0
- hikyuu/cpp/core310.pyd +0 -0
- hikyuu/cpp/core310.pyi +123 -62
- hikyuu/cpp/core311.pyd +0 -0
- hikyuu/cpp/core311.pyi +123 -62
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core312.pyi +123 -62
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core313.pyi +123 -62
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
- hikyuu/cpp/mimalloc-redirect.dll +0 -0
- hikyuu/cpp/mimalloc.dll +0 -0
- hikyuu/data/clickhouse_upgrade/0002.sql +9 -0
- hikyuu/data/common_mysql.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 +21 -3
- hikyuu/data/mysql_upgrade/0030.sql +3 -0
- hikyuu/data/pytdx_to_h5.py +2 -2
- hikyuu/data/pytdx_to_mysql.py +5 -5
- 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/bokeh_draw.pyi +8 -6
- hikyuu/draw/drawplot/echarts_draw.pyi +8 -6
- hikyuu/draw/drawplot/matplotlib_draw.py +19 -11
- hikyuu/draw/drawplot/matplotlib_draw.pyi +8 -6
- 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 +5 -3
- hikyuu/gui/HikyuuTDX.py +20 -0
- hikyuu/gui/data/MainWindow.py +169 -133
- 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 +24 -12
- hikyuu/include/hikyuu/StockTypeInfo.h +9 -9
- hikyuu/include/hikyuu/StockWeight.h +9 -9
- 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 +1 -1
- 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 +146 -73
- 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/extind.h +3 -0
- hikyuu/include/hikyuu/plugin/hkuextra.h +2 -0
- hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +2 -0
- hikyuu/include/hikyuu/python/pybind_utils.h +22 -5
- hikyuu/include/hikyuu/trade_manage/TradeCostBase.h +5 -3
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +9 -3
- hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +8 -4
- 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 +4 -3
- 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/LruCache.h +299 -0
- hikyuu/include/hikyuu/utilities/arithmetic.h +2 -2
- hikyuu/include/hikyuu/utilities/omp_macro.h +25 -0
- hikyuu/include/hikyuu/utilities/plugin/PluginManager.h +5 -0
- hikyuu/include/hikyuu/utilities/thread/GlobalStealThreadPool.h +72 -19
- hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +0 -4
- hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +1 -0
- hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +1 -0
- hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +1 -0
- hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +1 -4
- hikyuu/include/hikyuu/utilities/thread/algorithm.h +286 -0
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/plugin/backtest.dll +0 -0
- hikyuu/plugin/checkdata.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/import2ch.dll +0 -0
- hikyuu/plugin/import2hdf5.dll +0 -0
- hikyuu/plugin/import2mysql.dll +0 -0
- hikyuu/plugin/tmreport.dll +0 -0
- hikyuu/test/Indicator.py +1 -2
- hikyuu/trade_manage/__init__.pyi +7 -5
- hikyuu/trade_manage/trade.pyi +7 -5
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.7.2.dist-info → hikyuu-2.7.5.dist-info}/METADATA +2 -13
- {hikyuu-2.7.2.dist-info → hikyuu-2.7.5.dist-info}/RECORD +232 -225
- {hikyuu-2.7.2.dist-info → hikyuu-2.7.5.dist-info}/WHEEL +1 -1
- {hikyuu-2.7.2.dist-info → hikyuu-2.7.5.dist-info}/entry_points.txt +0 -0
- {hikyuu-2.7.2.dist-info → hikyuu-2.7.5.dist-info}/top_level.txt +0 -0
hikyuu/include/hikyuu/Stock.h
CHANGED
|
@@ -58,8 +58,8 @@ private:
|
|
|
58
58
|
public:
|
|
59
59
|
Stock();
|
|
60
60
|
|
|
61
|
-
Stock(const Stock&);
|
|
62
|
-
Stock(Stock&&);
|
|
61
|
+
Stock(const Stock&) noexcept;
|
|
62
|
+
Stock(Stock&&) noexcept;
|
|
63
63
|
Stock(const string& market, const string& code, const string& name);
|
|
64
64
|
|
|
65
65
|
Stock(const string& market, const string& code, const string& name, uint32_t type, bool valid,
|
|
@@ -69,7 +69,7 @@ public:
|
|
|
69
69
|
int precision, size_t minTradeNumber, size_t maxTradeNumber);
|
|
70
70
|
virtual ~Stock();
|
|
71
71
|
Stock& operator=(const Stock&);
|
|
72
|
-
Stock& operator=(Stock&&);
|
|
72
|
+
Stock& operator=(Stock&&) noexcept;
|
|
73
73
|
bool operator==(const Stock&) const;
|
|
74
74
|
bool operator!=(const Stock&) const;
|
|
75
75
|
|
|
@@ -77,52 +77,52 @@ public:
|
|
|
77
77
|
* 获取内部id,一般用于作为map的键值使用,该id实际为m_data的内存地址
|
|
78
78
|
* @note 非数据库中的stockid
|
|
79
79
|
*/
|
|
80
|
-
uint64_t id() const;
|
|
80
|
+
uint64_t id() const noexcept;
|
|
81
81
|
|
|
82
82
|
/** 获取所属市场简称,市场简称是市场的唯一标识 */
|
|
83
|
-
const string& market() const;
|
|
83
|
+
const string& market() const noexcept;
|
|
84
84
|
|
|
85
85
|
/** 获取证券代码 */
|
|
86
|
-
const string& code() const;
|
|
86
|
+
const string& code() const noexcept;
|
|
87
87
|
|
|
88
88
|
/** 市场简称+证券代码,如: sh000001 */
|
|
89
|
-
const string& market_code() const;
|
|
89
|
+
const string& market_code() const noexcept;
|
|
90
90
|
|
|
91
91
|
/** 获取证券名称 */
|
|
92
|
-
const string& name() const;
|
|
92
|
+
const string& name() const noexcept;
|
|
93
93
|
|
|
94
94
|
/** 获取证券类型 */
|
|
95
|
-
uint32_t type() const;
|
|
95
|
+
uint32_t type() const noexcept;
|
|
96
96
|
|
|
97
97
|
/** 该证券当前是否有效 */
|
|
98
|
-
bool valid() const;
|
|
98
|
+
bool valid() const noexcept;
|
|
99
99
|
|
|
100
100
|
/** 获取证券起始日期 */
|
|
101
|
-
const Datetime& startDatetime() const;
|
|
101
|
+
const Datetime& startDatetime() const noexcept;
|
|
102
102
|
|
|
103
103
|
/** 获取证券最后日期 */
|
|
104
|
-
const Datetime& lastDatetime() const;
|
|
104
|
+
const Datetime& lastDatetime() const noexcept;
|
|
105
105
|
|
|
106
106
|
/** 获取最小跳动量 */
|
|
107
|
-
price_t tick() const;
|
|
107
|
+
price_t tick() const noexcept;
|
|
108
108
|
|
|
109
109
|
/** 最小跳动量价值 */
|
|
110
|
-
price_t tickValue() const;
|
|
110
|
+
price_t tickValue() const noexcept;
|
|
111
111
|
|
|
112
112
|
/** 每单位价值 = tickValue / tick */
|
|
113
|
-
price_t unit() const;
|
|
113
|
+
price_t unit() const noexcept;
|
|
114
114
|
|
|
115
115
|
/** 获取价格精度 */
|
|
116
|
-
int precision() const;
|
|
116
|
+
int precision() const noexcept;
|
|
117
117
|
|
|
118
118
|
/** 获取最小交易数量,同minTradeNumber */
|
|
119
|
-
double atom() const;
|
|
119
|
+
double atom() const noexcept;
|
|
120
120
|
|
|
121
121
|
/** 获取最小交易数量 */
|
|
122
|
-
double minTradeNumber() const;
|
|
122
|
+
double minTradeNumber() const noexcept;
|
|
123
123
|
|
|
124
124
|
/** 获取最大交易量 */
|
|
125
|
-
double maxTradeNumber() const;
|
|
125
|
+
double maxTradeNumber() const noexcept;
|
|
126
126
|
|
|
127
127
|
void market(const string& market_);
|
|
128
128
|
void code(const string& code_);
|
|
@@ -213,9 +213,6 @@ public:
|
|
|
213
213
|
*/
|
|
214
214
|
DatetimeList getTradingCalendar(const KQuery& query) const;
|
|
215
215
|
|
|
216
|
-
/** 设置权息信息, 仅供初始化时调用 */
|
|
217
|
-
void setWeightList(const StockWeightList&);
|
|
218
|
-
|
|
219
216
|
/**
|
|
220
217
|
* 判断是否在交易时间段内,忽略日期仅判断时分秒
|
|
221
218
|
* @param time 时间
|
|
@@ -238,12 +235,12 @@ public:
|
|
|
238
235
|
void releaseKDataBuffer(KQuery::KType) const;
|
|
239
236
|
|
|
240
237
|
/** 指定类型的K线数据是否被缓存 */
|
|
241
|
-
bool isBuffer(KQuery::KType) const;
|
|
238
|
+
bool isBuffer(KQuery::KType) const noexcept;
|
|
242
239
|
|
|
243
|
-
bool isPreload(KQuery::KType ktype) const;
|
|
240
|
+
bool isPreload(KQuery::KType ktype) const noexcept;
|
|
244
241
|
|
|
245
242
|
/** 是否为Null */
|
|
246
|
-
bool isNull() const;
|
|
243
|
+
bool isNull() const noexcept;
|
|
247
244
|
|
|
248
245
|
/** (临时函数)只用于更新缓存中的K线数据 **/
|
|
249
246
|
void realtimeUpdate(KRecord, const KQuery::KType& ktype = KQuery::DAY);
|
|
@@ -265,10 +262,13 @@ private:
|
|
|
265
262
|
bool _getIndexRangeByIndex(const KQuery&, size_t& out_start, size_t& out_end) const;
|
|
266
263
|
|
|
267
264
|
// 以下函数属于基础操作添加了读锁
|
|
268
|
-
size_t _getCountFromBuffer(const KQuery::KType& ktype) const;
|
|
269
265
|
const KRecord& _getKRecordFromBuffer(size_t pos, const KQuery::KType& ktype) const;
|
|
270
266
|
KRecordList _getKRecordListFromBuffer(size_t start_ix, size_t end_ix,
|
|
271
267
|
KQuery::KType ktype) const;
|
|
268
|
+
|
|
269
|
+
bool _getIndexRangeFromBuffer(const KQuery& query, size_t& out_start, size_t& out_end) const;
|
|
270
|
+
bool _getIndexRangeByIndexFromBuffer(const KQuery& query, size_t& out_start,
|
|
271
|
+
size_t& out_end) const;
|
|
272
272
|
bool _getIndexRangeByDateFromBuffer(const KQuery&, size_t&, size_t&) const;
|
|
273
273
|
|
|
274
274
|
KRecordList _getKRecordList(const KQuery& query) const;
|
|
@@ -296,12 +296,12 @@ struct HKU_API Stock::Data {
|
|
|
296
296
|
Datetime m_lastDate; // 证券最后日期
|
|
297
297
|
|
|
298
298
|
StockWeightList m_weightList; // 权息信息列表
|
|
299
|
-
std::
|
|
299
|
+
std::shared_mutex m_weight_mutex;
|
|
300
300
|
|
|
301
301
|
mutable vector<HistoryFinanceInfo>
|
|
302
302
|
m_history_finance; // 历史财务信息 [财务报告日期, 字段1, 字段2, ...]
|
|
303
303
|
mutable std::atomic_bool m_history_finance_ready{false};
|
|
304
|
-
mutable std::
|
|
304
|
+
mutable std::shared_mutex m_history_finance_mutex;
|
|
305
305
|
|
|
306
306
|
price_t m_tick;
|
|
307
307
|
price_t m_tickValue;
|
|
@@ -347,7 +347,7 @@ inline bool operator<(const Stock& s1, const Stock& s2) {
|
|
|
347
347
|
return s1.id() < s2.id();
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
inline uint64_t Stock::id() const {
|
|
350
|
+
inline uint64_t Stock::id() const noexcept {
|
|
351
351
|
return isNull() ? 0 : (int64_t)m_data.get();
|
|
352
352
|
}
|
|
353
353
|
|
|
@@ -355,7 +355,7 @@ inline bool Stock::operator!=(const Stock& stock) const {
|
|
|
355
355
|
return !(*this == stock);
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
inline bool Stock::isNull() const {
|
|
358
|
+
inline bool Stock::isNull() const noexcept {
|
|
359
359
|
return !m_data || !m_kdataDriver;
|
|
360
360
|
}
|
|
361
361
|
|
|
@@ -86,11 +86,11 @@ public:
|
|
|
86
86
|
string datadir() const;
|
|
87
87
|
|
|
88
88
|
/** 获取证券数量 */
|
|
89
|
-
size_t size() const;
|
|
89
|
+
size_t size() const noexcept;
|
|
90
90
|
|
|
91
91
|
/** 是否所有数据准备完毕 */
|
|
92
92
|
bool dataReady() const;
|
|
93
|
-
|
|
93
|
+
bool initializing() const;
|
|
94
94
|
/**
|
|
95
95
|
* 根据"市场简称证券代码"获取对应的证券实例
|
|
96
96
|
* @param querystr 格式:“市场简称证券代码”,如"sh000001"
|
|
@@ -164,6 +164,13 @@ public:
|
|
|
164
164
|
*/
|
|
165
165
|
BlockList getBlockList();
|
|
166
166
|
|
|
167
|
+
/**
|
|
168
|
+
* 获取指定指数的板块列表, 如果不存在返回空列表
|
|
169
|
+
* @param index_stk 指数
|
|
170
|
+
* @return 板块列表
|
|
171
|
+
*/
|
|
172
|
+
BlockList getBlockListByIndexStock(const Stock& stk);
|
|
173
|
+
|
|
167
174
|
/**
|
|
168
175
|
* 获取指定证券所属的板块列表
|
|
169
176
|
* @param stk 指定证券
|
|
@@ -245,7 +252,7 @@ public:
|
|
|
245
252
|
/**
|
|
246
253
|
* 获取当前执行线程id,主要用于判断 Strategy 是以独立进程还是线程方式运行
|
|
247
254
|
*/
|
|
248
|
-
std::thread::id thread_id() const {
|
|
255
|
+
std::thread::id thread_id() const noexcept {
|
|
249
256
|
return m_thread_id;
|
|
250
257
|
}
|
|
251
258
|
|
|
@@ -258,7 +265,7 @@ public:
|
|
|
258
265
|
void setPluginPath(const std::string& path);
|
|
259
266
|
|
|
260
267
|
/** 获取当前插件路径 */
|
|
261
|
-
const string& getPluginPath() const {
|
|
268
|
+
const string& getPluginPath() const noexcept {
|
|
262
269
|
return m_plugin_manager.pluginPath();
|
|
263
270
|
}
|
|
264
271
|
|
|
@@ -266,7 +273,7 @@ public:
|
|
|
266
273
|
PluginInterfaceT* getPlugin(const std::string& pluginname) noexcept;
|
|
267
274
|
|
|
268
275
|
/** 设置多语言支持路径(仅在初始化之前有效) */
|
|
269
|
-
void setLanguagePath(const std::string& path);
|
|
276
|
+
void setLanguagePath(const std::string& path) noexcept;
|
|
270
277
|
|
|
271
278
|
/** 取消加载,退出时使用 */
|
|
272
279
|
void cancelLoad() {
|
|
@@ -286,6 +293,10 @@ public:
|
|
|
286
293
|
return m_stockDict.end();
|
|
287
294
|
}
|
|
288
295
|
|
|
296
|
+
void clearPlugin() {
|
|
297
|
+
m_plugin_manager.clear();
|
|
298
|
+
}
|
|
299
|
+
|
|
289
300
|
private:
|
|
290
301
|
/* 加载全部数据 */
|
|
291
302
|
void loadData();
|
|
@@ -322,7 +333,7 @@ private:
|
|
|
322
333
|
static StockManager* m_sm;
|
|
323
334
|
std::atomic_bool m_initializing{false};
|
|
324
335
|
std::atomic_bool m_cancel_load{false}; // 取消加载, 用于退出指示
|
|
325
|
-
std::atomic_bool m_data_ready{
|
|
336
|
+
std::atomic_bool m_data_ready{true}; // 用于指示是否所有数据准备完毕, 如果未初始化则为 true
|
|
326
337
|
std::thread::id m_thread_id; // 记录线程id,用于判断Stratege是以独立进程方式还是线程方式运行
|
|
327
338
|
string m_tmpdir;
|
|
328
339
|
string m_datadir;
|
|
@@ -334,14 +345,11 @@ private:
|
|
|
334
345
|
|
|
335
346
|
typedef unordered_map<string, MarketInfo> MarketInfoMap;
|
|
336
347
|
mutable MarketInfoMap m_marketInfoDict;
|
|
337
|
-
std::shared_mutex* m_marketInfoDict_mutex;
|
|
338
348
|
|
|
339
349
|
typedef unordered_map<uint32_t, StockTypeInfo> StockTypeInfoMap;
|
|
340
350
|
mutable StockTypeInfoMap m_stockTypeInfo;
|
|
341
|
-
std::shared_mutex* m_stockTypeInfo_mutex;
|
|
342
351
|
|
|
343
352
|
std::unordered_set<Datetime> m_holidays; // 节假日
|
|
344
|
-
std::shared_mutex* m_holidays_mutex;
|
|
345
353
|
|
|
346
354
|
ZhBond10List m_zh_bond10; // 10年期中国国债收益率数据
|
|
347
355
|
|
|
@@ -361,12 +369,16 @@ private:
|
|
|
361
369
|
std::string m_i18n_path;
|
|
362
370
|
};
|
|
363
371
|
|
|
364
|
-
inline size_t StockManager::size() const {
|
|
372
|
+
inline size_t StockManager::size() const noexcept {
|
|
365
373
|
return m_stockDict.size();
|
|
366
374
|
}
|
|
367
375
|
|
|
368
376
|
inline bool StockManager::dataReady() const {
|
|
369
|
-
return m_data_ready;
|
|
377
|
+
return m_data_ready.load(std::memory_order_acquire);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
inline bool StockManager::initializing() const {
|
|
381
|
+
return m_initializing;
|
|
370
382
|
}
|
|
371
383
|
|
|
372
384
|
inline Stock StockManager::operator[](const string& query) const {
|
|
@@ -423,7 +435,7 @@ inline PluginInterfaceT* StockManager::getPlugin(const std::string& pluginname)
|
|
|
423
435
|
return m_plugin_manager.getPlugin<PluginInterfaceT>(pluginname);
|
|
424
436
|
}
|
|
425
437
|
|
|
426
|
-
inline void StockManager::setLanguagePath(const std::string& path) {
|
|
438
|
+
inline void StockManager::setLanguagePath(const std::string& path) noexcept {
|
|
427
439
|
m_i18n_path = path;
|
|
428
440
|
}
|
|
429
441
|
|
|
@@ -41,46 +41,46 @@ public:
|
|
|
41
41
|
StockTypeInfo(const StockTypeInfo&) = default;
|
|
42
42
|
StockTypeInfo& operator=(const StockTypeInfo&) = default;
|
|
43
43
|
|
|
44
|
-
StockTypeInfo(StockTypeInfo&&);
|
|
44
|
+
StockTypeInfo(StockTypeInfo&&) noexcept;
|
|
45
45
|
StockTypeInfo& operator=(StockTypeInfo&&) noexcept;
|
|
46
46
|
|
|
47
47
|
/** 获取证券类型 */
|
|
48
|
-
uint32_t type() const {
|
|
48
|
+
uint32_t type() const noexcept {
|
|
49
49
|
return m_type;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/** 获取证券类型描述信息 */
|
|
53
|
-
const string& description() const {
|
|
53
|
+
const string& description() const noexcept {
|
|
54
54
|
return m_description;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/** 获取最小跳动量 */
|
|
58
|
-
price_t tick() const {
|
|
58
|
+
price_t tick() const noexcept {
|
|
59
59
|
return m_tick;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/** 每tick价格 */
|
|
63
|
-
price_t tickValue() const {
|
|
63
|
+
price_t tickValue() const noexcept {
|
|
64
64
|
return m_tickValue;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/** 每单位价格 = tickValue / tick */
|
|
68
|
-
price_t unit() const {
|
|
68
|
+
price_t unit() const noexcept {
|
|
69
69
|
return m_unit;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/** 获取价格精度 */
|
|
73
|
-
int precision() const {
|
|
73
|
+
int precision() const noexcept {
|
|
74
74
|
return m_precision;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/** 获取每笔最小交易数量 */
|
|
78
|
-
double minTradeNumber() const {
|
|
78
|
+
double minTradeNumber() const noexcept {
|
|
79
79
|
return m_minTradeNumber;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/** 获取每笔最大交易数量 */
|
|
83
|
-
double maxTradeNumber() const {
|
|
83
|
+
double maxTradeNumber() const noexcept {
|
|
84
84
|
return m_maxTradeNumber;
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -29,47 +29,47 @@ public:
|
|
|
29
29
|
price_t freeCount, price_t suogu);
|
|
30
30
|
|
|
31
31
|
/** 权息日期 */
|
|
32
|
-
Datetime datetime() const {
|
|
32
|
+
Datetime datetime() const noexcept {
|
|
33
33
|
return m_datetime;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/** 每10股送X股 */
|
|
37
|
-
price_t countAsGift() const {
|
|
37
|
+
price_t countAsGift() const noexcept {
|
|
38
38
|
return m_countAsGift;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/** 每10股配X股 */
|
|
42
|
-
price_t countForSell() const {
|
|
42
|
+
price_t countForSell() const noexcept {
|
|
43
43
|
return m_countForSell;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/** 配股价 */
|
|
47
|
-
price_t priceForSell() const {
|
|
47
|
+
price_t priceForSell() const noexcept {
|
|
48
48
|
return m_priceForSell;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/** 每10股红利 */
|
|
52
|
-
price_t bonus() const {
|
|
52
|
+
price_t bonus() const noexcept {
|
|
53
53
|
return m_bonus;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/** 每10股转增X股 */
|
|
57
|
-
price_t increasement() const {
|
|
57
|
+
price_t increasement() const noexcept {
|
|
58
58
|
return m_increasement;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/** 总股本(万股) */
|
|
62
|
-
price_t totalCount() const {
|
|
62
|
+
price_t totalCount() const noexcept {
|
|
63
63
|
return m_totalCount;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/** 流通股(万股) */
|
|
67
|
-
price_t freeCount() const {
|
|
67
|
+
price_t freeCount() const noexcept {
|
|
68
68
|
return m_freeCount;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/** 扩缩股比例 */
|
|
72
|
-
price_t suogu() const {
|
|
72
|
+
price_t suogu() const noexcept {
|
|
73
73
|
return m_suogu;
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -219,7 +219,8 @@ public:
|
|
|
219
219
|
/**
|
|
220
220
|
* 获取所有历史财务信息, 用于列式存储时数据初始化使用
|
|
221
221
|
*/
|
|
222
|
-
virtual unordered_map<string, vector<HistoryFinanceInfo>> getAllHistoryFinance(
|
|
222
|
+
virtual unordered_map<string, vector<HistoryFinanceInfo>> getAllHistoryFinance(
|
|
223
|
+
const std::atomic_bool& cancel_flag) {
|
|
223
224
|
HKU_ERROR("Not support getAllHistoryFinance()!");
|
|
224
225
|
return unordered_map<string, vector<HistoryFinanceInfo>>();
|
|
225
226
|
}
|
|
@@ -94,11 +94,17 @@ public:
|
|
|
94
94
|
*/
|
|
95
95
|
virtual void remove(const string& category, const string& name) = 0;
|
|
96
96
|
|
|
97
|
+
protected:
|
|
98
|
+
bool isPythonObject() const noexcept {
|
|
99
|
+
return m_is_python_object;
|
|
100
|
+
}
|
|
101
|
+
|
|
97
102
|
private:
|
|
98
103
|
bool checkType();
|
|
99
104
|
|
|
100
105
|
protected:
|
|
101
106
|
string m_name;
|
|
107
|
+
bool m_is_python_object{false};
|
|
102
108
|
};
|
|
103
109
|
|
|
104
110
|
typedef shared_ptr<BlockInfoDriver> BlockInfoDriverPtr;
|
|
@@ -129,21 +129,21 @@ public:
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
virtual std::unordered_map<std::string, KRecordList> getAllKRecordList(
|
|
132
|
-
const KQuery::KType& ktype, const Datetime& start_date,
|
|
133
|
-
const std::atomic<bool>& cancel_flag) {
|
|
132
|
+
const KQuery::KType& ktype, const Datetime& start_date, const std::atomic_bool& cancel_flag) {
|
|
134
133
|
HKU_THROW("Not support getAllKRecordList");
|
|
135
134
|
}
|
|
136
135
|
|
|
137
136
|
protected:
|
|
138
|
-
|
|
139
|
-
return
|
|
137
|
+
bool isPythonObject() const noexcept {
|
|
138
|
+
return m_is_python_object;
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
private:
|
|
143
142
|
bool checkType();
|
|
144
143
|
|
|
145
|
-
|
|
144
|
+
protected:
|
|
146
145
|
string m_name;
|
|
146
|
+
bool m_is_python_object{false};
|
|
147
147
|
};
|
|
148
148
|
|
|
149
149
|
typedef shared_ptr<KDataDriver> KDataDriverPtr;
|
|
@@ -210,8 +210,7 @@ public:
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
std::unordered_map<std::string, KRecordList> getAllKRecordList(
|
|
213
|
-
const KQuery::KType& ktype, const Datetime& start_date,
|
|
214
|
-
const std::atomic<bool>& cancel_flag) {
|
|
213
|
+
const KQuery::KType& ktype, const Datetime& start_date, const std::atomic_bool& cancel_flag) {
|
|
215
214
|
return m_driver->getAllKRecordList(ktype, start_date, cancel_flag);
|
|
216
215
|
}
|
|
217
216
|
|
|
@@ -26,6 +26,9 @@ public:
|
|
|
26
26
|
MySQLKDataDriver();
|
|
27
27
|
virtual ~MySQLKDataDriver() override;
|
|
28
28
|
|
|
29
|
+
MySQLKDataDriver(const MySQLKDataDriver&) = delete;
|
|
30
|
+
MySQLKDataDriver& operator=(const MySQLKDataDriver&) = delete;
|
|
31
|
+
|
|
29
32
|
virtual KDataDriverPtr _clone() override {
|
|
30
33
|
return std::make_shared<MySQLKDataDriver>();
|
|
31
34
|
}
|
|
@@ -56,7 +59,8 @@ public:
|
|
|
56
59
|
const KQuery& query) override;
|
|
57
60
|
|
|
58
61
|
private:
|
|
59
|
-
string _getTableName(const string& market, const string& code,
|
|
62
|
+
static string _getTableName(const string& market, const string& code,
|
|
63
|
+
const KQuery::KType& ktype);
|
|
60
64
|
KRecordList _getKRecordList(const string& market, const string& code,
|
|
61
65
|
const KQuery::KType& kType, size_t start_ix, size_t end_ix);
|
|
62
66
|
KRecordList _getKRecordList(const string& market, const string& code,
|
|
@@ -43,7 +43,7 @@ public:
|
|
|
43
43
|
const KQuery& query) override;
|
|
44
44
|
|
|
45
45
|
private:
|
|
46
|
-
string _getTableName(const string& market, const string& code, KQuery::KType ktype);
|
|
46
|
+
static string _getTableName(const string& market, const string& code, KQuery::KType ktype);
|
|
47
47
|
KRecordList _getKRecordList(const string& market, const string& code,
|
|
48
48
|
const KQuery::KType& kType, size_t start_ix, size_t end_ix);
|
|
49
49
|
KRecordList _getKRecordList(const string& market, const string& code,
|