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.
Files changed (295) hide show
  1. hikyuu/__init__.py +28 -8
  2. hikyuu/__init__.pyi +26 -14
  3. hikyuu/analysis/__init__.pyi +7 -1
  4. hikyuu/analysis/analysis.pyi +8 -2
  5. hikyuu/core.pyi +9 -3
  6. hikyuu/cpp/core310.pyi +172 -68
  7. hikyuu/cpp/core310.so +0 -0
  8. hikyuu/cpp/core311.pyi +172 -68
  9. hikyuu/cpp/core311.so +0 -0
  10. hikyuu/cpp/core312.pyi +172 -68
  11. hikyuu/cpp/core312.so +0 -0
  12. hikyuu/cpp/core313.pyi +172 -68
  13. hikyuu/cpp/core313.so +0 -0
  14. hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
  15. hikyuu/cpp/i18n/zh_CN/hikyuu_plugin.mo +0 -0
  16. hikyuu/cpp/libboost_atomic.so +0 -0
  17. hikyuu/cpp/libboost_atomic.so.1.90.0 +0 -0
  18. hikyuu/cpp/{libboost_charconv-mt.so → libboost_charconv.so} +0 -0
  19. hikyuu/cpp/{libboost_charconv-mt.so.1.88.0 → libboost_charconv.so.1.90.0} +0 -0
  20. hikyuu/cpp/libboost_chrono.so +0 -0
  21. hikyuu/cpp/libboost_chrono.so.1.90.0 +0 -0
  22. hikyuu/cpp/libboost_container.so +0 -0
  23. hikyuu/cpp/libboost_container.so.1.90.0 +0 -0
  24. hikyuu/cpp/libboost_date_time.so +0 -0
  25. hikyuu/cpp/libboost_date_time.so.1.90.0 +0 -0
  26. hikyuu/cpp/libboost_locale.so +0 -0
  27. hikyuu/cpp/libboost_locale.so.1.90.0 +0 -0
  28. hikyuu/cpp/libboost_random.so +0 -0
  29. hikyuu/cpp/libboost_random.so.1.90.0 +0 -0
  30. hikyuu/cpp/libboost_serialization.so +0 -0
  31. hikyuu/cpp/libboost_serialization.so.1.90.0 +0 -0
  32. hikyuu/cpp/libboost_thread.so +0 -0
  33. hikyuu/cpp/libboost_thread.so.1.90.0 +0 -0
  34. hikyuu/cpp/libboost_wserialization.so +0 -0
  35. hikyuu/cpp/libboost_wserialization.so.1.90.0 +0 -0
  36. hikyuu/cpp/libhikyuu.so +0 -0
  37. hikyuu/cpp/libmimalloc.so +0 -0
  38. hikyuu/cpp/libmimalloc.so.3 +0 -0
  39. hikyuu/cpp/libmimalloc.so.3.1 +0 -0
  40. hikyuu/cpp/libsqlite3.so +0 -0
  41. hikyuu/data/clickhouse_upgrade/0001.sql +2 -0
  42. hikyuu/data/clickhouse_upgrade/0002.sql +9 -0
  43. hikyuu/data/common_clickhouse.py +1 -3
  44. hikyuu/data/common_mysql.py +1 -1
  45. hikyuu/data/download_block.py +1 -1
  46. hikyuu/data/em_block_to_mysql.py +16 -4
  47. hikyuu/data/em_block_to_sqlite.py +16 -4
  48. hikyuu/data/hku_config_template.py +31 -4
  49. hikyuu/data/mysql_upgrade/0029.sql +2 -0
  50. hikyuu/data/mysql_upgrade/0030.sql +3 -0
  51. hikyuu/data/pytdx_to_clickhouse.py +86 -32
  52. hikyuu/data/pytdx_to_h5.py +73 -28
  53. hikyuu/data/pytdx_to_mysql.py +65 -21
  54. hikyuu/data/pytdx_weight_to_clickhouse.py +2 -0
  55. hikyuu/data/pytdx_weight_to_mysql.py +2 -0
  56. hikyuu/data/pytdx_weight_to_sqlite.py +2 -0
  57. hikyuu/data/sqlite_upgrade/0029.sql +4 -0
  58. hikyuu/data/sqlite_upgrade/0030.sql +5 -0
  59. hikyuu/data/tdx_to_clickhouse.py +2 -2
  60. hikyuu/data/tdx_to_h5.py +11 -11
  61. hikyuu/data/tdx_to_mysql.py +2 -2
  62. hikyuu/draw/__init__.pyi +1 -1
  63. hikyuu/draw/drawplot/__init__.pyi +1 -1
  64. hikyuu/draw/drawplot/bokeh_draw.pyi +17 -9
  65. hikyuu/draw/drawplot/echarts_draw.pyi +17 -9
  66. hikyuu/draw/drawplot/matplotlib_draw.py +23 -9
  67. hikyuu/draw/drawplot/matplotlib_draw.pyi +17 -9
  68. hikyuu/examples/notebook/001-overview.ipynb +112 -78
  69. hikyuu/examples/notebook/004-IndicatorOverview.ipynb +52 -65
  70. hikyuu/examples/notebook/006-TradeManager.ipynb +402 -291
  71. hikyuu/examples/notebook/008-Pickle.ipynb +25 -17
  72. hikyuu/examples/notebook/009-RealData.ipynb +36 -38
  73. hikyuu/examples/notebook/Demo/Demo2.ipynb +146 -116
  74. hikyuu/extend.pyi +10 -4
  75. hikyuu/gui/HikyuuTDX.py +42 -3
  76. hikyuu/gui/data/MainWindow.py +189 -129
  77. hikyuu/gui/data/UseTdxImportToH5Thread.py +4 -2
  78. hikyuu/gui/start_qmt.py +1 -1
  79. hikyuu/hub.pyi +6 -6
  80. hikyuu/include/hikyuu/Block.h +9 -9
  81. hikyuu/include/hikyuu/HistoryFinanceInfo.h +3 -3
  82. hikyuu/include/hikyuu/KData.h +51 -28
  83. hikyuu/include/hikyuu/KDataImp.h +12 -7
  84. hikyuu/include/hikyuu/KDataPrivatedBufferImp.h +13 -7
  85. hikyuu/include/hikyuu/KDataSharedBufferImp.h +8 -6
  86. hikyuu/include/hikyuu/KQuery.h +11 -11
  87. hikyuu/include/hikyuu/KRecord.h +1 -1
  88. hikyuu/include/hikyuu/MarketInfo.h +10 -10
  89. hikyuu/include/hikyuu/Stock.h +30 -30
  90. hikyuu/include/hikyuu/StockManager.h +28 -12
  91. hikyuu/include/hikyuu/StockTypeInfo.h +9 -9
  92. hikyuu/include/hikyuu/StockWeight.h +9 -9
  93. hikyuu/include/hikyuu/StrategyContext.h +4 -4
  94. hikyuu/include/hikyuu/TimeLineRecord.h +1 -1
  95. hikyuu/include/hikyuu/TransRecord.h +1 -1
  96. hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +2 -1
  97. hikyuu/include/hikyuu/data_driver/BlockInfoDriver.h +6 -0
  98. hikyuu/include/hikyuu/data_driver/KDataDriver.h +6 -7
  99. hikyuu/include/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.h +5 -1
  100. hikyuu/include/hikyuu/data_driver/kdata/sqlite/SQLiteKDataDriver.h +1 -1
  101. hikyuu/include/hikyuu/global/sysinfo.h +24 -5
  102. hikyuu/include/hikyuu/indicator/IndParam.h +1 -1
  103. hikyuu/include/hikyuu/indicator/Indicator.h +56 -27
  104. hikyuu/include/hikyuu/indicator/Indicator2InImp.h +0 -4
  105. hikyuu/include/hikyuu/indicator/IndicatorImp.h +147 -74
  106. hikyuu/include/hikyuu/indicator/crt/CONTEXT.h +11 -1
  107. hikyuu/include/hikyuu/indicator/crt/IC.h +19 -14
  108. hikyuu/include/hikyuu/indicator/crt/ICIR.h +4 -7
  109. hikyuu/include/hikyuu/indicator/imp/IAbs.h +1 -0
  110. hikyuu/include/hikyuu/indicator/imp/IAcos.h +1 -0
  111. hikyuu/include/hikyuu/indicator/imp/IAd.h +0 -2
  112. hikyuu/include/hikyuu/indicator/imp/IAdvance.h +3 -0
  113. hikyuu/include/hikyuu/indicator/imp/IAma.h +3 -0
  114. hikyuu/include/hikyuu/indicator/imp/IAsin.h +1 -0
  115. hikyuu/include/hikyuu/indicator/imp/IAtan.h +1 -0
  116. hikyuu/include/hikyuu/indicator/imp/IAtr.h +2 -3
  117. hikyuu/include/hikyuu/indicator/imp/IBackset.h +2 -4
  118. hikyuu/include/hikyuu/indicator/imp/IBlockSetNum.h +3 -0
  119. hikyuu/include/hikyuu/indicator/imp/ICeil.h +1 -0
  120. hikyuu/include/hikyuu/indicator/imp/IContext.h +0 -3
  121. hikyuu/include/hikyuu/indicator/imp/ICorr.h +3 -0
  122. hikyuu/include/hikyuu/indicator/imp/ICos.h +1 -0
  123. hikyuu/include/hikyuu/indicator/imp/ICost.h +0 -2
  124. hikyuu/include/hikyuu/indicator/imp/ICount.h +2 -1
  125. hikyuu/include/hikyuu/indicator/imp/ICval.h +1 -4
  126. hikyuu/include/hikyuu/indicator/imp/ICycle.h +0 -2
  127. hikyuu/include/hikyuu/indicator/imp/IDecline.h +3 -0
  128. hikyuu/include/hikyuu/indicator/imp/IDevsq.h +4 -1
  129. hikyuu/include/hikyuu/indicator/imp/IDiff.h +1 -0
  130. hikyuu/include/hikyuu/indicator/imp/IDma.h +2 -0
  131. hikyuu/include/hikyuu/indicator/imp/IDropna.h +0 -4
  132. hikyuu/include/hikyuu/indicator/imp/IEma.h +3 -1
  133. hikyuu/include/hikyuu/indicator/imp/IEvery.h +5 -1
  134. hikyuu/include/hikyuu/indicator/imp/IExist.h +5 -1
  135. hikyuu/include/hikyuu/indicator/imp/IExp.h +1 -0
  136. hikyuu/include/hikyuu/indicator/imp/IFilter.h +4 -5
  137. hikyuu/include/hikyuu/indicator/imp/IFinance.h +1 -2
  138. hikyuu/include/hikyuu/indicator/imp/IFloor.h +1 -0
  139. hikyuu/include/hikyuu/indicator/imp/IHhvbars.h +5 -1
  140. hikyuu/include/hikyuu/indicator/imp/IHighLine.h +5 -1
  141. hikyuu/include/hikyuu/indicator/imp/IHsl.h +0 -2
  142. hikyuu/include/hikyuu/indicator/imp/IIc.h +3 -6
  143. hikyuu/include/hikyuu/indicator/imp/IInBlock.h +1 -2
  144. hikyuu/include/hikyuu/indicator/imp/IIntpart.h +1 -0
  145. hikyuu/include/hikyuu/indicator/imp/IIsInf.h +1 -0
  146. hikyuu/include/hikyuu/indicator/imp/IIsInfa.h +1 -0
  147. hikyuu/include/hikyuu/indicator/imp/IIsLastBar.h +0 -1
  148. hikyuu/include/hikyuu/indicator/imp/IIsNa.h +1 -0
  149. hikyuu/include/hikyuu/indicator/imp/IJumpDown.h +1 -0
  150. hikyuu/include/hikyuu/indicator/imp/IJumpUp.h +1 -0
  151. hikyuu/include/hikyuu/indicator/imp/IKData.h +1 -2
  152. hikyuu/include/hikyuu/indicator/imp/ILiuTongPan.h +0 -2
  153. hikyuu/include/hikyuu/indicator/imp/ILn.h +1 -0
  154. hikyuu/include/hikyuu/indicator/imp/ILog.h +1 -0
  155. hikyuu/include/hikyuu/indicator/imp/ILowLine.h +5 -1
  156. hikyuu/include/hikyuu/indicator/imp/ILowLineBars.h +5 -1
  157. hikyuu/include/hikyuu/indicator/imp/IMa.h +6 -1
  158. hikyuu/include/hikyuu/indicator/imp/IMacd.h +2 -0
  159. hikyuu/include/hikyuu/indicator/imp/INot.h +1 -0
  160. hikyuu/include/hikyuu/indicator/imp/IPow.h +3 -1
  161. hikyuu/include/hikyuu/indicator/imp/IQuantileTrunc.h +1 -0
  162. hikyuu/include/hikyuu/indicator/imp/IRecover.h +3 -0
  163. hikyuu/include/hikyuu/indicator/imp/IRef.h +3 -1
  164. hikyuu/include/hikyuu/indicator/imp/IResult.h +1 -0
  165. hikyuu/include/hikyuu/indicator/imp/IReverse.h +1 -0
  166. hikyuu/include/hikyuu/indicator/imp/IRoc.h +6 -1
  167. hikyuu/include/hikyuu/indicator/imp/IRocp.h +5 -1
  168. hikyuu/include/hikyuu/indicator/imp/IRocr.h +5 -1
  169. hikyuu/include/hikyuu/indicator/imp/IRocr100.h +5 -1
  170. hikyuu/include/hikyuu/indicator/imp/IRound.h +1 -0
  171. hikyuu/include/hikyuu/indicator/imp/IRoundDown.h +1 -0
  172. hikyuu/include/hikyuu/indicator/imp/IRoundUp.h +1 -0
  173. hikyuu/include/hikyuu/indicator/imp/ISaftyLoss.h +1 -0
  174. hikyuu/include/hikyuu/indicator/imp/ISign.h +1 -0
  175. hikyuu/include/hikyuu/indicator/imp/ISin.h +1 -0
  176. hikyuu/include/hikyuu/indicator/imp/ISlope.h +5 -1
  177. hikyuu/include/hikyuu/indicator/imp/ISma.h +2 -0
  178. hikyuu/include/hikyuu/indicator/imp/ISpearman.h +3 -0
  179. hikyuu/include/hikyuu/indicator/imp/ISqrt.h +1 -0
  180. hikyuu/include/hikyuu/indicator/imp/IStdev.h +5 -1
  181. hikyuu/include/hikyuu/indicator/imp/IStdp.h +5 -1
  182. hikyuu/include/hikyuu/indicator/imp/ISum.h +6 -1
  183. hikyuu/include/hikyuu/indicator/imp/ITan.h +1 -0
  184. hikyuu/include/hikyuu/indicator/imp/ITime.h +1 -2
  185. hikyuu/include/hikyuu/indicator/imp/ITimeLine.h +0 -2
  186. hikyuu/include/hikyuu/indicator/imp/ITr.h +1 -2
  187. hikyuu/include/hikyuu/indicator/imp/IVar.h +5 -1
  188. hikyuu/include/hikyuu/indicator/imp/IVarp.h +5 -1
  189. hikyuu/include/hikyuu/indicator/imp/IVigor.h +0 -2
  190. hikyuu/include/hikyuu/indicator/imp/IWma.h +5 -1
  191. hikyuu/include/hikyuu/indicator/imp/IZongGuBen.h +1 -2
  192. hikyuu/include/hikyuu/indicator_talib/imp/TaAdosc.h +0 -2
  193. hikyuu/include/hikyuu/indicator_talib/imp/TaSar.h +0 -2
  194. hikyuu/include/hikyuu/indicator_talib/imp/TaSarext.h +0 -4
  195. hikyuu/include/hikyuu/indicator_talib/imp/TaStoch.h +0 -3
  196. hikyuu/include/hikyuu/indicator_talib/imp/TaStochf.h +0 -2
  197. hikyuu/include/hikyuu/indicator_talib/imp/TaUltosc.h +0 -2
  198. hikyuu/include/hikyuu/indicator_talib/imp/ta_defines.h +2 -4
  199. hikyuu/include/hikyuu/indicator_talib/imp/ta_imp.h +70 -90
  200. hikyuu/include/hikyuu/plugin/KDataToClickHouseImporter.h +40 -0
  201. hikyuu/include/hikyuu/plugin/KDataToMySQLImporter.h +40 -0
  202. hikyuu/include/hikyuu/plugin/checkdata.h +20 -0
  203. hikyuu/include/hikyuu/plugin/extind.h +3 -0
  204. hikyuu/include/hikyuu/plugin/hkuextra.h +4 -0
  205. hikyuu/include/hikyuu/plugin/interface/CheckDataPluginInterface.h +25 -0
  206. hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +4 -0
  207. hikyuu/include/hikyuu/plugin/interface/ImportKDataToClickHousePluginInterface.h +44 -0
  208. hikyuu/include/hikyuu/plugin/interface/ImportKDataToMySQLPluginInterface.h +42 -0
  209. hikyuu/include/hikyuu/plugin/interface/plugins.h +6 -0
  210. hikyuu/include/hikyuu/python/convert_any.h +9 -6
  211. hikyuu/include/hikyuu/python/pybind_utils.h +22 -5
  212. hikyuu/include/hikyuu/strategy/Strategy.h +1 -1
  213. hikyuu/include/hikyuu/trade_manage/TradeCostBase.h +5 -3
  214. hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +9 -3
  215. hikyuu/include/hikyuu/trade_manage/TradeRecord.h +2 -1
  216. hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +8 -4
  217. hikyuu/include/hikyuu/trade_sys/allocatefunds/build_in.h +1 -0
  218. hikyuu/include/hikyuu/trade_sys/allocatefunds/crt/AF_FixedAmount.h +26 -0
  219. hikyuu/include/hikyuu/trade_sys/allocatefunds/imp/FixAmountFunds.h +18 -0
  220. hikyuu/include/hikyuu/trade_sys/condition/ConditionBase.h +5 -3
  221. hikyuu/include/hikyuu/trade_sys/environment/EnvironmentBase.h +6 -3
  222. hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +5 -3
  223. hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +23 -20
  224. hikyuu/include/hikyuu/trade_sys/multifactor/NormalizeBase.h +6 -4
  225. hikyuu/include/hikyuu/trade_sys/multifactor/ScoresFilterBase.h +5 -3
  226. hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_EqualWeight.h +3 -3
  227. hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_ICIRWeight.h +4 -4
  228. hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_ICWeight.h +4 -4
  229. hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_Weight.h +4 -4
  230. hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +16 -13
  231. hikyuu/include/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h +13 -13
  232. hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +12 -3
  233. hikyuu/include/hikyuu/trade_sys/selector/crt/SE_MultiFactor.h +1 -1
  234. hikyuu/include/hikyuu/trade_sys/selector/crt/SE_MultiFactor2.h +1 -1
  235. hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +1 -0
  236. hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector2.h +1 -0
  237. hikyuu/include/hikyuu/trade_sys/selector/imp/optimal/OptimalSelectorBase.h +0 -2
  238. hikyuu/include/hikyuu/trade_sys/selector/imp/optimal/PerformanceOptimalSelector.h +0 -4
  239. hikyuu/include/hikyuu/trade_sys/signal/SignalBase.h +5 -3
  240. hikyuu/include/hikyuu/trade_sys/slippage/SlippageBase.h +5 -3
  241. hikyuu/include/hikyuu/trade_sys/stoploss/StoplossBase.h +5 -3
  242. hikyuu/include/hikyuu/trade_sys/system/System.h +6 -4
  243. hikyuu/include/hikyuu/utilities/Log.h +6 -7
  244. hikyuu/include/hikyuu/utilities/LruCache.h +299 -0
  245. hikyuu/include/hikyuu/utilities/Parameter.h +17 -0
  246. hikyuu/include/hikyuu/utilities/arithmetic.h +2 -2
  247. hikyuu/include/hikyuu/utilities/config.h +28 -0
  248. hikyuu/include/hikyuu/utilities/omp_macro.h +25 -0
  249. hikyuu/include/hikyuu/utilities/plugin/PluginBase.h +17 -2
  250. hikyuu/include/hikyuu/utilities/plugin/PluginManager.h +46 -22
  251. hikyuu/include/hikyuu/utilities/thread/GlobalStealThreadPool.h +71 -19
  252. hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +1 -5
  253. hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +286 -0
  254. hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +1 -0
  255. hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +297 -0
  256. hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +1 -4
  257. hikyuu/include/hikyuu/utilities/thread/WorkStealQueue.h +9 -8
  258. hikyuu/include/hikyuu/utilities/thread/algorithm.h +350 -14
  259. hikyuu/include/hikyuu/version.h +4 -4
  260. hikyuu/plugin/libbacktest.so +0 -0
  261. hikyuu/plugin/libcheckdata.so +0 -0
  262. hikyuu/plugin/libclickhousedriver.so +0 -0
  263. hikyuu/plugin/libdataserver.so +0 -0
  264. hikyuu/plugin/libdataserver_parquet.so +0 -0
  265. hikyuu/plugin/libdevice.so +0 -0
  266. hikyuu/plugin/libextind.so +0 -0
  267. hikyuu/plugin/libhkuextra.so +0 -0
  268. hikyuu/plugin/libimport2ch.so +0 -0
  269. hikyuu/plugin/libimport2hdf5.so +0 -0
  270. hikyuu/plugin/libimport2mysql.so +0 -0
  271. hikyuu/plugin/libtmreport.so +0 -0
  272. hikyuu/test/Indicator.py +1 -2
  273. hikyuu/trade_manage/__init__.pyi +14 -8
  274. hikyuu/trade_manage/trade.pyi +14 -8
  275. hikyuu/trade_sys/trade_sys.py +54 -5
  276. hikyuu/util/__init__.pyi +2 -2
  277. hikyuu/util/singleton.pyi +1 -1
  278. {hikyuu-2.7.0.dist-info → hikyuu-2.7.5.dist-info}/METADATA +10 -4
  279. {hikyuu-2.7.0.dist-info → hikyuu-2.7.5.dist-info}/RECORD +282 -252
  280. hikyuu/cpp/libboost_chrono-mt.so +0 -0
  281. hikyuu/cpp/libboost_chrono-mt.so.1.88.0 +0 -0
  282. hikyuu/cpp/libboost_date_time-mt.so +0 -0
  283. hikyuu/cpp/libboost_date_time-mt.so.1.88.0 +0 -0
  284. hikyuu/cpp/libboost_serialization-mt.so +0 -0
  285. hikyuu/cpp/libboost_serialization-mt.so.1.88.0 +0 -0
  286. hikyuu/cpp/libboost_system-mt.so +0 -0
  287. hikyuu/cpp/libboost_system-mt.so.1.88.0 +0 -0
  288. hikyuu/cpp/libboost_thread-mt.so +0 -0
  289. hikyuu/cpp/libboost_thread-mt.so.1.88.0 +0 -0
  290. hikyuu/cpp/libboost_wserialization-mt.so +0 -0
  291. hikyuu/cpp/libboost_wserialization-mt.so.1.88.0 +0 -0
  292. hikyuu/data/pytdx_to_taos.py +0 -736
  293. {hikyuu-2.7.0.dist-info → hikyuu-2.7.5.dist-info}/WHEEL +0 -0
  294. {hikyuu-2.7.0.dist-info → hikyuu-2.7.5.dist-info}/entry_points.txt +0 -0
  295. {hikyuu-2.7.0.dist-info → hikyuu-2.7.5.dist-info}/top_level.txt +0 -0
@@ -104,12 +104,12 @@ public:
104
104
  }
105
105
 
106
106
  if (PyLong_Check(src)) {
107
- int overflow;
108
- long tmp = PyLong_AsLongAndOverflow(src, &overflow);
109
- if (overflow == 0) {
110
- value = static_cast<int>(tmp);
107
+ long long ll_val = PyLong_AsLongLong(src);
108
+ if (ll_val < std::numeric_limits<int>::min() ||
109
+ ll_val > std::numeric_limits<int>::max()) {
110
+ value = static_cast<int64_t>(ll_val);
111
111
  } else {
112
- value = PyLong_AsLongLong(src);
112
+ value = static_cast<int>(ll_val);
113
113
  }
114
114
  return true;
115
115
  }
@@ -192,8 +192,11 @@ public:
192
192
  } else {
193
193
  Py_RETURN_FALSE;
194
194
  }
195
+ } else if (x.type() == typeid(int64_t)) {
196
+ long long ll_val = (long long)boost::any_cast<int64_t>(x);
197
+ return PyLong_FromLongLong(ll_val);
195
198
  } else if (x.type() == typeid(int)) {
196
- return Py_BuildValue("n", boost::any_cast<int>(x));
199
+ return Py_BuildValue("i", boost::any_cast<int>(x));
197
200
  } else if (x.type() == typeid(double)) {
198
201
  return Py_BuildValue("d", boost::any_cast<double>(x));
199
202
  } else if (x.type() == typeid(std::string)) {
@@ -10,6 +10,7 @@
10
10
  #define HIKYUU_PYTHON_BIND_UTILS_H
11
11
 
12
12
  #include <hikyuu/config.h>
13
+ #include <hikyuu/Stock.h>
13
14
  #include <pybind11/pybind11.h>
14
15
 
15
16
  #include <pybind11/operators.h>
@@ -100,11 +101,6 @@ public:
100
101
  return std::shared_ptr<classname>(keep_python_state_alive, ptr); \
101
102
  } \
102
103
  return this->_clone(); \
103
- } \
104
- \
105
- protected: \
106
- inline bool isPythonObject() const override { \
107
- return true; \
108
104
  }
109
105
 
110
106
  // 用于检查以 py::object 方式传递的函数参数个数是否符合预期
@@ -124,6 +120,27 @@ inline bool check_pyfunction_arg_num(const py::object& func, size_t arg_num) {
124
120
  */
125
121
  size_t utf8_to_utf32(const std::string& utf8_str, int32_t* out, size_t out_len) noexcept;
126
122
 
123
+ // 从 python 对象获取 StockList 列表
124
+ inline StockList get_stock_list_from_python(const py::object& stks) {
125
+ StockList ret;
126
+ HKU_IF_RETURN(stks.is_none(), ret);
127
+
128
+ if (py::isinstance<StockList>(stks)) {
129
+ ret = stks.cast<StockList>();
130
+ } else if (py::isinstance<Block>(stks)) {
131
+ const auto& blk = stks.cast<Block&>();
132
+ ret = blk.getStockList();
133
+ } else if (py::isinstance<StockManager>(stks)) {
134
+ const auto& sm = stks.cast<StockManager&>();
135
+ ret = sm.getStockList();
136
+ } else if (py::isinstance<py::sequence>(stks)) {
137
+ ret = python_list_to_vector<Stock>(stks);
138
+ } else {
139
+ HKU_THROW("Failed get StockList! Input stks must be Block, sm or sequenc(Stock)!");
140
+ }
141
+ return ret;
142
+ }
143
+
127
144
  } // namespace hku
128
145
 
129
146
  #endif // HIKYUU_PYTHON_BIND_UTILS_H
@@ -35,7 +35,7 @@ public:
35
35
  Strategy();
36
36
  explicit Strategy(const string& name, const string& config_file = "");
37
37
  Strategy(const vector<string>& codeList, const vector<KQuery::KType>& ktypeList,
38
- const unordered_map<string, int>& preloadNum = {}, const string& name = "Strategy",
38
+ const unordered_map<string, int64_t>& preloadNum = {}, const string& name = "Strategy",
39
39
  const string& config_file = "");
40
40
  explicit Strategy(const StrategyContext& context, const string& name = "Strategy",
41
41
  const string& config_file = "");
@@ -107,12 +107,13 @@ public:
107
107
  virtual TradeCostPtr _clone() = 0;
108
108
 
109
109
  protected:
110
- virtual bool isPythonObject() const {
111
- return false;
110
+ bool isPythonObject() const noexcept {
111
+ return m_is_python_object;
112
112
  }
113
113
 
114
- private:
114
+ protected:
115
115
  string m_name;
116
+ bool m_is_python_object{false};
116
117
 
117
118
  //============================================
118
119
  // 序列化支持
@@ -123,6 +124,7 @@ private:
123
124
  template <class Archive>
124
125
  void serialize(Archive& ar, const unsigned int version) {
125
126
  ar& BOOST_SERIALIZATION_NVP(m_name);
127
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
126
128
  ar& BOOST_SERIALIZATION_NVP(m_params);
127
129
  }
128
130
  #endif /* HKU_SUPPORT_SERIALIZATION */
@@ -37,6 +37,8 @@ class HKU_API TradeManagerBase : public enable_shared_from_this<TradeManagerBase
37
37
  public:
38
38
  TradeManagerBase() : TradeManagerBase("", TC_Zero()) {}
39
39
 
40
+ explicit TradeManagerBase(const string& name) : TradeManagerBase(name, TC_Zero()) {}
41
+
40
42
  TradeManagerBase(const string& name, const TradeCostPtr& costFunc)
41
43
  : m_name(name), m_costfunc(costFunc), m_broker_last_datetime(Datetime::now()) {
42
44
  setParam<int>("precision", 2); // 计算精度
@@ -169,6 +171,7 @@ public:
169
171
  HKU_CHECK(p, "Invalid ptr from _clone!");
170
172
  p->m_params = m_params;
171
173
  p->m_name = m_name;
174
+ p->m_is_python_object = m_is_python_object;
172
175
  p->m_broker_last_datetime = m_broker_last_datetime;
173
176
  p->m_costfunc = m_costfunc;
174
177
  p->m_broker_list = m_broker_list;
@@ -769,9 +772,8 @@ public:
769
772
  std::vector<std::pair<Datetime, double>> getProfitPercentYearly(
770
773
  const Datetime& datetime = Datetime::now());
771
774
 
772
- protected:
773
- virtual bool isPythonObject() const {
774
- return false;
775
+ bool isPythonObject() const noexcept {
776
+ return m_is_python_object;
775
777
  }
776
778
 
777
779
  protected:
@@ -781,6 +783,8 @@ protected:
781
783
  Datetime m_broker_last_datetime; // 订单代理最近一次执行操作的时刻,当前启动运行时间
782
784
  list<OrderBrokerPtr> m_broker_list; // 订单代理列表
783
785
 
786
+ bool m_is_python_object{false};
787
+
784
788
  //============================================
785
789
  // 序列化支持
786
790
  //============================================
@@ -794,6 +798,7 @@ private:
794
798
  ar& BOOST_SERIALIZATION_NVP(m_costfunc);
795
799
  ar& BOOST_SERIALIZATION_NVP(m_broker_last_datetime);
796
800
  ar& BOOST_SERIALIZATION_NVP(m_broker_list);
801
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
797
802
  }
798
803
 
799
804
  template <class Archive>
@@ -803,6 +808,7 @@ private:
803
808
  ar& BOOST_SERIALIZATION_NVP(m_costfunc);
804
809
  ar& BOOST_SERIALIZATION_NVP(m_broker_last_datetime);
805
810
  ar& BOOST_SERIALIZATION_NVP(m_broker_list);
811
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
806
812
  }
807
813
 
808
814
  BOOST_SERIALIZATION_SPLIT_MEMBER()
@@ -38,7 +38,8 @@ enum BUSINESS {
38
38
  BUSINESS_RETURN_STOCK = 12, /**< 归还股票资产 */
39
39
  BUSINESS_SELL_SHORT = 13, /**< 卖空 */
40
40
  BUSINESS_BUY_SHORT = 14, /**< 卖空后回补 */
41
- BUSINESS_INVALID = 15 /**< 无效类型 */
41
+ BUSINESS_SUOGU = 15, /**< 缩扩股 */
42
+ BUSINESS_INVALID = 16 /**< 无效类型 */
42
43
  };
43
44
 
44
45
  /**
@@ -101,9 +101,8 @@ public:
101
101
  static void adjustWeight(SystemWeightList& sw_list, double can_allocate_weight,
102
102
  bool auto_adjust, bool ignore_zero);
103
103
 
104
- protected:
105
- virtual bool isPythonObject() const {
106
- return false;
104
+ bool isPythonObject() const noexcept {
105
+ return m_is_python_object;
107
106
  }
108
107
 
109
108
  private:
@@ -117,6 +116,9 @@ private:
117
116
  void _adjust_without_running(const Datetime& date, const SystemWeightList& se_list,
118
117
  const std::unordered_set<SYSPtr>& running_list);
119
118
 
119
+ protected:
120
+ bool m_is_python_object{false};
121
+
120
122
  private:
121
123
  string m_name; // 组件名称
122
124
  KQuery m_query; // 查询条件
@@ -131,6 +133,7 @@ private:
131
133
  friend class boost::serialization::access;
132
134
  template <class Archive>
133
135
  void save(Archive& ar, const unsigned int version) const {
136
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
134
137
  ar& BOOST_SERIALIZATION_NVP(m_name);
135
138
  ar& BOOST_SERIALIZATION_NVP(m_params);
136
139
  ar& BOOST_SERIALIZATION_NVP(m_query);
@@ -138,6 +141,7 @@ private:
138
141
 
139
142
  template <class Archive>
140
143
  void load(Archive& ar, const unsigned int version) {
144
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
141
145
  ar& BOOST_SERIALIZATION_NVP(m_name);
142
146
  ar& BOOST_SERIALIZATION_NVP(m_params);
143
147
  ar& BOOST_SERIALIZATION_NVP(m_query);
@@ -148,7 +152,7 @@ private:
148
152
  };
149
153
 
150
154
  #if HKU_SUPPORT_SERIALIZATION
151
- BOOST_SERIALIZATION_ASSUME_ABSTRACT(SelectorBase)
155
+ BOOST_SERIALIZATION_ASSUME_ABSTRACT(AllocateFundsBase)
152
156
  #endif
153
157
 
154
158
  #if HKU_SUPPORT_SERIALIZATION
@@ -13,5 +13,6 @@
13
13
  #include "crt/AF_FixedWeight.h"
14
14
  #include "crt/AF_FixedWeightList.h"
15
15
  #include "crt/AF_MultiFactor.h"
16
+ #include "crt/AF_FixedAmount.h"
16
17
 
17
18
  #endif /* TRADE_SYS_ALLOCATEFUNDS_BUILD_IN_H_ */
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright (c) 2019 hikyuu.org
3
+ *
4
+ * Created on: 2025年12月9日
5
+ * Author: stone
6
+ */
7
+
8
+ #pragma once
9
+ #ifndef TRADE_SYS_ALLOCATEFUNDS_CRT_AF_FIXEDAMOUNT_H_
10
+ #define TRADE_SYS_ALLOCATEFUNDS_CRT_AF_FIXEDAMOUNT_H_
11
+
12
+ #include "../AllocateFundsBase.h"
13
+
14
+ namespace hku {
15
+
16
+ /**
17
+ * @brief 固定金额分配,每个选中的资产都不能超过此金额交易
18
+ * @param amount 指定的固定交易金额
19
+ * @return AFPtr
20
+ * @ingroup AllocateFunds
21
+ */
22
+ AFPtr HKU_API AF_FixedAmount(double amount = 20000.0);
23
+
24
+ } /* namespace hku */
25
+
26
+ #endif /* TRADE_SYS_ALLOCATEFUNDS_CRT_AF_FIXEDAMOUNT_H_ */
@@ -0,0 +1,18 @@
1
+ #pragma once
2
+ #include "../AllocateFundsBase.h"
3
+
4
+ namespace hku {
5
+
6
+ class FixedAmountFunds : public AllocateFundsBase {
7
+ ALLOCATEFUNDS_IMP(FixedAmountFunds)
8
+ ALLOCATEFUNDS_NO_PRIVATE_MEMBER_SERIALIZATION
9
+
10
+ public:
11
+ FixedAmountFunds();
12
+ virtual ~FixedAmountFunds();
13
+ virtual void _checkParam(const string& name) const override;
14
+ };
15
+
16
+ } /* namespace hku */
17
+
18
+
@@ -109,9 +109,8 @@ public:
109
109
  return m_values.cend();
110
110
  }
111
111
 
112
- protected:
113
- virtual bool isPythonObject() const {
114
- return false;
112
+ bool isPythonObject() const noexcept {
113
+ return m_is_python_object;
115
114
  }
116
115
 
117
116
  protected:
@@ -121,6 +120,7 @@ protected:
121
120
  SGPtr m_sg;
122
121
  map<Datetime, size_t> m_date_index;
123
122
  vector<price_t> m_values;
123
+ bool m_is_python_object{false};
124
124
 
125
125
  //============================================
126
126
  // 序列化支持
@@ -134,6 +134,7 @@ private:
134
134
  ar& BOOST_SERIALIZATION_NVP(m_params);
135
135
  ar& BOOST_SERIALIZATION_NVP(m_date_index);
136
136
  ar& BOOST_SERIALIZATION_NVP(m_values);
137
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
137
138
  // m_kdata/m_tm/m_sg是系统运行时临时设置,不需要序列化
138
139
  }
139
140
 
@@ -143,6 +144,7 @@ private:
143
144
  ar& BOOST_SERIALIZATION_NVP(m_params);
144
145
  ar& BOOST_SERIALIZATION_NVP(m_date_index);
145
146
  ar& BOOST_SERIALIZATION_NVP(m_values);
147
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
146
148
  // m_kdata/m_tm/m_sg是系统运行时临时设置,不需要序列化
147
149
  }
148
150
 
@@ -93,9 +93,8 @@ public:
93
93
  /** 子类克隆接口 */
94
94
  virtual EnvironmentPtr _clone() = 0;
95
95
 
96
- protected:
97
- virtual bool isPythonObject() const {
98
- return false;
96
+ bool isPythonObject() const noexcept {
97
+ return m_is_python_object;
99
98
  }
100
99
 
101
100
  protected:
@@ -105,6 +104,8 @@ protected:
105
104
  vector<price_t> m_values;
106
105
  mutable std::shared_mutex m_mutex;
107
106
 
107
+ bool m_is_python_object{false};
108
+
108
109
  //============================================
109
110
  // 序列化支持
110
111
  //============================================
@@ -119,6 +120,7 @@ private:
119
120
  ar& BOOST_SERIALIZATION_NVP(m_query);
120
121
  ar& BOOST_SERIALIZATION_NVP(m_date_index);
121
122
  ar& BOOST_SERIALIZATION_NVP(m_values);
123
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
122
124
  }
123
125
 
124
126
  template <class Archive>
@@ -128,6 +130,7 @@ private:
128
130
  ar& BOOST_SERIALIZATION_NVP(m_query);
129
131
  ar& BOOST_SERIALIZATION_NVP(m_date_index);
130
132
  ar& BOOST_SERIALIZATION_NVP(m_values);
133
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
131
134
  }
132
135
 
133
136
  BOOST_SERIALIZATION_SPLIT_MEMBER()
@@ -152,9 +152,8 @@ public:
152
152
  /** 子类克隆私有变量接口 */
153
153
  virtual MoneyManagerPtr _clone() = 0;
154
154
 
155
- protected:
156
- virtual bool isPythonObject() const {
157
- return false;
155
+ bool isPythonObject() const noexcept {
156
+ return m_is_python_object;
158
157
  }
159
158
 
160
159
  protected:
@@ -162,6 +161,7 @@ protected:
162
161
  KQuery m_query;
163
162
  TradeManagerPtr m_tm;
164
163
  unordered_map<Stock, std::pair<size_t, size_t>> m_buy_sell_counts;
164
+ bool m_is_python_object{false};
165
165
 
166
166
  //============================================
167
167
  // 序列化支持
@@ -173,6 +173,7 @@ private:
173
173
  void save(Archive& ar, const unsigned int version) const {
174
174
  ar& BOOST_SERIALIZATION_NVP(m_name);
175
175
  ar& BOOST_SERIALIZATION_NVP(m_params);
176
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
176
177
  // m_query、m_tm都是系统运行时临时设置,不需要序列化
177
178
  // ar & BOOST_SERIALIZATION_NVP(m_query);
178
179
  // ar & BOOST_SERIALIZATION_NVP(m_tm);
@@ -182,6 +183,7 @@ private:
182
183
  void load(Archive& ar, const unsigned int version) {
183
184
  ar& BOOST_SERIALIZATION_NVP(m_name);
184
185
  ar& BOOST_SERIALIZATION_NVP(m_params);
186
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
185
187
  }
186
188
 
187
189
  BOOST_SERIALIZATION_SPLIT_MEMBER()
@@ -164,35 +164,44 @@ public:
164
164
  virtual MultiFactorPtr _clone() = 0;
165
165
  virtual IndicatorList _calculate(const vector<IndicatorList>&) = 0;
166
166
 
167
- protected:
168
- virtual bool isPythonObject() const {
169
- return false;
167
+ bool isPythonObject() const noexcept {
168
+ return m_is_python_object;
170
169
  }
171
170
 
172
- private:
173
- /** 执行计算 */
171
+ /**
172
+ * 执行计算。默认取结果时,会自动计算。但并行使用mf时,应主动调用该接口
173
+ * @note 因获取scores非常频繁,所以为使用锁。
174
+ * 这样的话,在并行时并不完备。在需要并行计算时可主动调用该接口。
175
+ */
174
176
  void calculate();
175
177
 
178
+ private:
176
179
  void initParam();
177
180
 
178
181
  // 构造每个指标构造行业哑变量,以便进行行业中性化处理
179
182
  unordered_map<string, PriceList> _buildDummyIndex();
180
183
 
181
- void _buildIndex(); // 计算完成后创建截面索引
182
- void _buildIndexDesc(); // 创建降序排列的索引
183
- void _buildIndexAsc(); // 创建升序排列的索引
184
- void _buildIndexNone(); // build index when no index
184
+ void _buildIndex(); // 计算完成后创建截面索引
185
185
 
186
- IndicatorList _getAllReturns(int ndays) const;
187
186
  void _checkData();
188
187
 
189
188
  protected:
189
+ IndicatorList _getAllReturns(int ndays) const;
190
+
191
+ protected:
192
+ bool m_is_python_object{false};
190
193
  string m_name;
191
- IndicatorList m_inds; // 输入的原始因子列表
194
+ IndicatorList m_inds; // 输入的原始因子公式列表
192
195
  StockList m_stks; // 证券组合
193
- Stock m_ref_stk; // 指定的参考证券
196
+ Stock m_ref_stk; // 指定的参考证券, 仅为对齐日期
194
197
  KQuery m_query; // 计算的日期范围条件
195
198
 
199
+ NormPtr m_norm; // 全局标准化/归一化操作
200
+ unordered_map<string, NormPtr> m_special_norms; // 对特定指标执行特定的标准化操作
201
+ unordered_map<string, string> m_special_category; // 对特定指标执行行业中性化时指定的板块分类
202
+ unordered_map<string, IndicatorList>
203
+ m_special_style_inds; // 对特定指标执行风格因子中性化时指定的风格因子
204
+
196
205
  // 以下变量为计算后生成
197
206
  DatetimeList m_ref_dates; // 依据参考证券和query计算的参考日期,合成因子和该日期对齐
198
207
  unordered_map<Stock, size_t> m_stk_map; // 证券->合成后因子位置索引
@@ -201,12 +210,6 @@ protected:
201
210
  vector<ScoreRecordList> m_stk_factor_by_date;
202
211
  Indicator m_ic;
203
212
 
204
- NormPtr m_norm; // 全局标准化/归一化操作
205
- unordered_map<string, NormPtr> m_special_norms; // 对特定指标执行特定的标准化操作
206
- unordered_map<string, string> m_special_category; // 对特定指标执行行业中性化时指定的板块分类
207
- unordered_map<string, IndicatorList>
208
- m_special_style_inds; // 对特定指标执行风格因子中性化时指定的风格因子
209
-
210
213
  private:
211
214
  std::mutex m_mutex;
212
215
  bool m_calculated{false};
@@ -219,13 +222,13 @@ private:
219
222
  friend class boost::serialization::access;
220
223
  template <class Archive>
221
224
  void save(Archive& ar, const unsigned int version) const {
225
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
222
226
  ar& BOOST_SERIALIZATION_NVP(m_name);
223
227
  ar& BOOST_SERIALIZATION_NVP(m_params);
224
228
  ar& BOOST_SERIALIZATION_NVP(m_inds);
225
229
  ar& BOOST_SERIALIZATION_NVP(m_stks);
226
230
  ar& BOOST_SERIALIZATION_NVP(m_ref_stk);
227
231
  ar& BOOST_SERIALIZATION_NVP(m_query);
228
- ar& BOOST_SERIALIZATION_NVP(m_ref_dates);
229
232
  ar& BOOST_SERIALIZATION_NVP(m_special_norms);
230
233
  ar& BOOST_SERIALIZATION_NVP(m_special_category);
231
234
  // 以下不需要保存,加载后重新计算
@@ -239,13 +242,13 @@ private:
239
242
 
240
243
  template <class Archive>
241
244
  void load(Archive& ar, const unsigned int version) {
245
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
242
246
  ar& BOOST_SERIALIZATION_NVP(m_name);
243
247
  ar& BOOST_SERIALIZATION_NVP(m_params);
244
248
  ar& BOOST_SERIALIZATION_NVP(m_inds);
245
249
  ar& BOOST_SERIALIZATION_NVP(m_stks);
246
250
  ar& BOOST_SERIALIZATION_NVP(m_ref_stk);
247
251
  ar& BOOST_SERIALIZATION_NVP(m_query);
248
- ar& BOOST_SERIALIZATION_NVP(m_ref_dates);
249
252
  ar& BOOST_SERIALIZATION_NVP(m_special_norms);
250
253
  ar& BOOST_SERIALIZATION_NVP(m_special_category);
251
254
  // ar& BOOST_SERIALIZATION_NVP(m_stk_map);
@@ -42,13 +42,13 @@ public:
42
42
 
43
43
  virtual PriceList normalize(const PriceList& data) = 0;
44
44
 
45
- protected:
46
- virtual bool isPythonObject() const {
47
- return false;
45
+ bool isPythonObject() const noexcept {
46
+ return m_is_python_object;
48
47
  }
49
48
 
50
49
  protected:
51
50
  string m_name;
51
+ bool m_is_python_object{false};
52
52
 
53
53
  //============================================
54
54
  // 序列化支持
@@ -59,12 +59,14 @@ private:
59
59
  template <class Archive>
60
60
  void save(Archive& ar, const unsigned int version) const {
61
61
  ar& BOOST_SERIALIZATION_NVP(m_name);
62
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
62
63
  ar& BOOST_SERIALIZATION_NVP(m_params);
63
64
  }
64
65
 
65
66
  template <class Archive>
66
67
  void load(Archive& ar, const unsigned int version) {
67
68
  ar& BOOST_SERIALIZATION_NVP(m_name);
69
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
68
70
  ar& BOOST_SERIALIZATION_NVP(m_params);
69
71
  }
70
72
 
@@ -73,7 +75,7 @@ private:
73
75
  };
74
76
 
75
77
  #if HKU_SUPPORT_SERIALIZATION
76
- BOOST_SERIALIZATION_ASSUME_ABSTRACT(MultiFactorBase)
78
+ BOOST_SERIALIZATION_ASSUME_ABSTRACT(NormalizeBase)
77
79
  #endif
78
80
 
79
81
  #if HKU_SUPPORT_SERIALIZATION
@@ -49,14 +49,14 @@ public:
49
49
  public:
50
50
  friend HKU_API ScoresFilterPtr operator|(const ScoresFilterPtr& a, const ScoresFilterPtr& b);
51
51
 
52
- protected:
53
- virtual bool isPythonObject() const {
54
- return false;
52
+ bool isPythonObject() const noexcept {
53
+ return m_is_python_object;
55
54
  }
56
55
 
57
56
  protected:
58
57
  string m_name;
59
58
  ScoresFilterPtr m_child;
59
+ bool m_is_python_object{false};
60
60
 
61
61
  //============================================
62
62
  // 序列化支持
@@ -69,6 +69,7 @@ private:
69
69
  ar& BOOST_SERIALIZATION_NVP(m_name);
70
70
  ar& BOOST_SERIALIZATION_NVP(m_params);
71
71
  ar& BOOST_SERIALIZATION_NVP(m_child);
72
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
72
73
  }
73
74
 
74
75
  template <class Archive>
@@ -76,6 +77,7 @@ private:
76
77
  ar& BOOST_SERIALIZATION_NVP(m_name);
77
78
  ar& BOOST_SERIALIZATION_NVP(m_params);
78
79
  ar& BOOST_SERIALIZATION_NVP(m_child);
80
+ ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
79
81
  }
80
82
 
81
83
  BOOST_SERIALIZATION_SPLIT_MEMBER()
@@ -15,7 +15,7 @@ namespace hku {
15
15
  * @param inds 原始因子列表
16
16
  * @param stks 计算证券列表
17
17
  * @param query 日期范围
18
- * @param ref_stk 参考证券
18
+ * @param ref_stk 参考证券, 用于日期对齐, 未指定时为 SH000001
19
19
  * @param ic_n 默认 IC 对应的 N 日收益率
20
20
  * @param spearman 默认使用 spearman 计算相关系数,否则为 pearson
21
21
  * @param mode 获取截面数据时排序模式: 0-降序, 1-升序, 2-不排序
@@ -23,8 +23,8 @@ namespace hku {
23
23
  * @return MultiFactorPtr
24
24
  */
25
25
  MultiFactorPtr HKU_API MF_EqualWeight(const IndicatorList& inds, const StockList& stks,
26
- const KQuery& query, const Stock& ref_stk, int ic_n = 5,
27
- bool spearman = true, int mode = 0,
26
+ const KQuery& query, const Stock& ref_stk = Stock(),
27
+ int ic_n = 5, bool spearman = true, int mode = 0,
28
28
  bool save_all_factors = false);
29
29
 
30
30
  MultiFactorPtr HKU_API MF_EqualWeight();
@@ -16,7 +16,7 @@ namespace hku {
16
16
  * @param inds 原始因子列表
17
17
  * @param stks 计算证券列表
18
18
  * @param query 日期范围
19
- * @param ref_stk 参考证券
19
+ * @param ref_stk 参考证券,用于日期对齐,未指定时为 sh000001
20
20
  * @param ic_n 默认 IC 对应的 N 日收益率
21
21
  * @param ic_rolling_n IC 滚动窗口
22
22
  * @param spearman 默认使用 spearman 计算相关系数,否则为 pearson
@@ -25,9 +25,9 @@ namespace hku {
25
25
  * @return MultiFactorPtr
26
26
  */
27
27
  MultiFactorPtr HKU_API MF_ICIRWeight(const IndicatorList& inds, const StockList& stks,
28
- const KQuery& query, const Stock& ref_stk, int ic_n = 5,
29
- int ic_rolling_n = 120, bool spearman = true, int mode = 0,
30
- bool save_all_factors = false);
28
+ const KQuery& query, const Stock& ref_stk = Stock(),
29
+ int ic_n = 5, int ic_rolling_n = 120, bool spearman = true,
30
+ int mode = 0, bool save_all_factors = false);
31
31
 
32
32
  MultiFactorPtr HKU_API MF_ICIRWeight();
33
33
  } // namespace hku
@@ -16,7 +16,7 @@ namespace hku {
16
16
  * @param inds 原始因子列表
17
17
  * @param stks 计算证券列表
18
18
  * @param query 日期范围
19
- * @param ref_stk 参考证券
19
+ * @param ref_stk 参考证券,用于日期对齐,未指定时为 sh000001
20
20
  * @param ic_n 默认 IC 对应的 N 日收益率
21
21
  * @param ic_rolling_n IC 滚动窗口
22
22
  * @param spearman 默认使用 spearman 计算相关系数,否则为 pearson
@@ -25,9 +25,9 @@ namespace hku {
25
25
  * @return MultiFactorPtr
26
26
  */
27
27
  MultiFactorPtr HKU_API MF_ICWeight(const IndicatorList& inds, const StockList& stks,
28
- const KQuery& query, const Stock& ref_stk, int ic_n = 5,
29
- int ic_rolling_n = 120, bool spearman = true, int mode = 0,
30
- bool save_all_factors = false);
28
+ const KQuery& query, const Stock& ref_stk = Stock(),
29
+ int ic_n = 5, int ic_rolling_n = 120, bool spearman = true,
30
+ int mode = 0, bool save_all_factors = false);
31
31
  MultiFactorPtr HKU_API MF_ICWeight();
32
32
 
33
33
  } // namespace hku
@@ -16,7 +16,7 @@ namespace hku {
16
16
  * @param weights 权重列表
17
17
  * @param stks 计算证券列表
18
18
  * @param query 日期范围
19
- * @param ref_stk 参考证券
19
+ * @param ref_stk 参考证券,用于日期对齐,未指定时为 sh000001
20
20
  * @param ic_n 默认 IC 对应的 N 日收益率
21
21
  * @param spearman 默认使用 spearman 计算相关系数,否则为 pearson
22
22
  * @param mode 获取截面数据时排序模式: 0-降序, 1-升序, 2-不排序
@@ -24,9 +24,9 @@ namespace hku {
24
24
  * @return MultiFactorPtr
25
25
  */
26
26
  MultiFactorPtr HKU_API MF_Weight(const IndicatorList& inds, const PriceList& weights,
27
- const StockList& stks, const KQuery& query, const Stock& ref_stk,
28
- int ic_n = 5, bool spearman = true, int mode = 0,
29
- bool save_all_factors = false);
27
+ const StockList& stks, const KQuery& query,
28
+ const Stock& ref_stk = Stock(), int ic_n = 5, bool spearman = true,
29
+ int mode = 0, bool save_all_factors = false);
30
30
 
31
31
  MultiFactorPtr HKU_API MF_Weight();
32
32