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
@@ -23,13 +23,15 @@
23
23
  # SOFTWARE.
24
24
 
25
25
  import sys
26
+ import os
26
27
  import math
27
28
  import datetime
28
29
  import sqlite3
29
30
  from pytdx.hq import TDXParams
31
+ from configparser import ConfigParser
30
32
 
31
33
  from hikyuu.util.mylog import get_default_logger, hku_error, hku_debug
32
- from hikyuu import Datetime
34
+ from hikyuu import Datetime, is_valid_license, KDataToHdf5Importer
33
35
  from hikyuu.data.common import *
34
36
  from hikyuu.data.common_pytdx import to_pytdx_market, pytdx_get_day_trans
35
37
  from hikyuu.data.common_sqlite3 import (
@@ -235,6 +237,7 @@ def guess_5min_n_step(last_datetime):
235
237
  return (n, step)
236
238
 
237
239
 
240
+ @hku_catch(trace=True)
238
241
  def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, startDate=199012191500):
239
242
  market = market.upper()
240
243
  pytdx_market = to_pytdx_market(market)
@@ -246,9 +249,9 @@ def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, sta
246
249
  table = get_h5table(h5file, market, code)
247
250
  if table is None:
248
251
  hku_error("Can't get table({}{})".format(market, code))
249
- return 0
252
+ return (0, True, Datetime())
250
253
 
251
- last_datetime = table[-1]['datetime'] if table.nrows > 0 else startDate
254
+ last_datetime = int(table[-1]['datetime']) if table.nrows > 0 else startDate
252
255
 
253
256
  today = datetime.date.today()
254
257
  if ktype == 'DAY':
@@ -266,10 +269,10 @@ def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, sta
266
269
  pytdx_kline_type = TDXParams.KLINE_TYPE_5MIN
267
270
  today_datetime = (today.year * 10000 + today.month * 100 + today.day) * 10000 + 1500
268
271
  else:
269
- return 0
272
+ return (0, True, Datetime(last_datetime))
270
273
 
271
274
  if today_datetime <= last_datetime:
272
- return 0
275
+ return (0, True, Datetime(last_datetime))
273
276
 
274
277
  get_bars = api.get_index_bars if stktype == STOCKTYPE.INDEX else api.get_security_bars
275
278
 
@@ -311,27 +314,27 @@ def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, sta
311
314
  if abs(last_krecord['openPrice']*0.001 - bar["open"]) / (last_krecord['openPrice']*0.001) > 0.02:
312
315
  hku_error(
313
316
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord open: {last_krecord['openPrice']*0.001}, bar: {bar['open']}")
314
- return 0
317
+ return (0, False, Datetime(last_datetime))
315
318
  if abs(last_krecord['highPrice']*0.001 - bar["high"]) / (last_krecord['highPrice']*0.001) > 0.02:
316
319
  hku_error(
317
320
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord high: {last_krecord['highPrice']*0.001}, bar: {bar['high']}")
318
- return 0
321
+ return (0, False, Datetime(last_datetime))
319
322
  if abs(last_krecord['lowPrice']*0.001 - bar["low"]) / (last_krecord['lowPrice']*0.001) > 0.02:
320
323
  hku_error(
321
324
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord low: {last_krecord['lowPrice']*0.001}, bar: {bar['low']}")
322
- return 0
325
+ return (0, False, Datetime(last_datetime))
323
326
  if abs(last_krecord['closePrice']*0.001 - bar["close"]) / (last_krecord['closePrice']*0.001) > 0.02:
324
327
  hku_error(
325
328
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord close: {last_krecord['closePrice']*0.001}, bar: {bar['close']}")
326
- return 0
327
- if ktype == 'DAY' and last_krecord['transAmount'] != 0.0 and abs(last_krecord['transAmount'] - round(bar["amount"]*0.001)) / last_krecord['transAmount'] > 0.1:
329
+ return (0, False, Datetime(last_datetime))
330
+ if ktype == 'DAY' and last_krecord['transAmount'] != 0 and (abs(float(last_krecord['transAmount']) - round(bar["amount"]*0.001))) > 10000:
328
331
  hku_error(
329
- f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord amount: {last_krecord['transAmount']}, bar: {bar['amount']*0.001}")
330
- return 0
331
- if ktype == 'DAY' and last_krecord['transCount'] != 0.0 and abs(last_krecord['transCount'] - round(bar["vol"])) / last_krecord['transCount'] > 0.1:
332
+ f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord amount: {float(last_krecord['transAmount'])}, bar: {round(bar['amount']*0.001)}")
333
+ return (0, False, Datetime(last_datetime))
334
+ if ktype == 'DAY' and last_krecord['transCount'] != 0 and abs(float(last_krecord['transCount']) - bar["vol"]) > 10000:
332
335
  hku_error(
333
336
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord count: {last_krecord['transCount']}, bar: {bar['vol']}")
334
- return 0
337
+ return (0, False, Datetime(last_datetime))
335
338
  continue
336
339
 
337
340
  if today_datetime >= bar_datetime > last_datetime \
@@ -378,7 +381,16 @@ def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, sta
378
381
  table.remove()
379
382
 
380
383
  # table.close()
381
- return add_record_count
384
+ return (add_record_count, True, Datetime(last_datetime))
385
+
386
+
387
+ @hku_catch(ret=None)
388
+ def get_hdf5_importer(market, ktype):
389
+ filename = os.path.expanduser('~') + '/.hikyuu/hikyuu.ini'
390
+ config = ConfigParser()
391
+ config.read(filename, encoding='utf-8')
392
+ importer = KDataToHdf5Importer()
393
+ return importer if importer.set_config(config.get("hikyuu", "datadir"), [market], [ktype]) else None
382
394
 
383
395
 
384
396
  def import_data(connect, market, ktype, quotations, api, dest_dir, startDate=199012190000, progress=ProgressBar):
@@ -401,6 +413,9 @@ def import_data(connect, market, ktype, quotations, api, dest_dir, startDate=199
401
413
  if not stock_list:
402
414
  return 0
403
415
 
416
+ failed_limit = 20
417
+ failed_count = 0
418
+ failed_list = []
404
419
  total = len(stock_list)
405
420
  for i, stock in enumerate(stock_list):
406
421
  if stock[3] == 0 or len(stock[2]) != 6:
@@ -408,7 +423,12 @@ def import_data(connect, market, ktype, quotations, api, dest_dir, startDate=199
408
423
  progress(i, total)
409
424
  continue
410
425
 
411
- this_count = import_one_stock_data(connect, api, h5file, market, ktype, stock, startDate)
426
+ this_count, success, lastdate = import_one_stock_data(connect, api, h5file, market, ktype, stock, startDate)
427
+ if not success:
428
+ failed_count += 1
429
+ failed_list.append((market, stock[2], lastdate))
430
+ if failed_count >= failed_limit:
431
+ break
412
432
  add_record_count += this_count
413
433
  if this_count > 0:
414
434
  if ktype == 'DAY':
@@ -418,8 +438,31 @@ def import_data(connect, market, ktype, quotations, api, dest_dir, startDate=199
418
438
  if progress:
419
439
  progress(i, total)
420
440
 
441
+ if total > 0 and progress:
442
+ progress(total, total)
443
+
421
444
  connect.commit()
422
445
  h5file.close()
446
+
447
+ if 0 < failed_count < failed_limit and is_valid_license():
448
+ # 删除最后记录
449
+ ktype_dict = {
450
+ 'DAY': 'DAY',
451
+ '1MIN': 'MIN',
452
+ '5MIN': 'MIN5'
453
+ }
454
+ nktype = ktype_dict[ktype]
455
+ h5_importer = get_hdf5_importer(market, nktype)
456
+ if h5_importer is not None:
457
+ for r in failed_list:
458
+ hku_warn("清理 {}{} {}: {}", r[0], r[1], nktype, r[2].start_of_day())
459
+ h5_importer.remove(r[0], r[1], nktype, r[2].start_of_day())
460
+ hku_warn(f"已清理 {market} {failed_count} 个失败股票的最后记录,建议重新导入")
461
+
462
+ if failed_count >= failed_limit:
463
+ hku_error(f"{market} {ktype} 连续失败20个股票,已停止导入, 建议重新导入")
464
+ return add_record_count
465
+
423
466
  return add_record_count
424
467
 
425
468
 
@@ -479,12 +522,13 @@ def import_on_stock_trans(connect, api, h5file, market, stock_record, max_days):
479
522
  second += 3
480
523
  if second > 59:
481
524
  continue
482
- row['datetime'] = cur_date * 1000000 + minute * 100 + second
483
- row['price'] = int(record['price'] * 1000)
484
- row['vol'] = record['vol']
485
- row['buyorsell'] = record['buyorsell']
486
- row.append()
487
- add_record_count += 1
525
+ if record['price'] > 0.0 and record['vol'] >= 0.0:
526
+ row['datetime'] = cur_date * 1000000 + minute * 100 + second
527
+ row['price'] = int(record['price'] * 1000)
528
+ row['vol'] = record['vol']
529
+ row['buyorsell'] = record['buyorsell']
530
+ row.append()
531
+ add_record_count += 1
488
532
  except Exception as e:
489
533
  hku_error("Failed trans to record! {}", e)
490
534
 
@@ -578,12 +622,13 @@ def import_on_stock_time(connect, api, h5file, market, stock_record, max_days):
578
622
  elif time == 1360:
579
623
  time = 1400
580
624
  try:
581
- row['datetime'] = this_date + time
582
- row['price'] = int(record['price'] * 1000)
583
- row['vol'] = record['vol']
584
- row.append()
625
+ if record['price'] > 0.0 and record['vol'] >= 0.0:
626
+ row['datetime'] = this_date + time
627
+ row['price'] = int(record['price'] * 1000)
628
+ row['vol'] = record['vol']
629
+ row.append()
630
+ add_record_count += 1
585
631
  time += 1
586
- add_record_count += 1
587
632
  except Exception as e:
588
633
  hku_error("Failed trans record {}! {}".format(record, e))
589
634
 
@@ -624,7 +669,7 @@ if __name__ == '__main__':
624
669
  import time
625
670
  starttime = time.time()
626
671
 
627
- dest_dir = "d:\\stock"
672
+ dest_dir = "/Users/fasiondog/stock"
628
673
  tdx_server = '180.101.48.170'
629
674
  tdx_port = 7709
630
675
  quotations = ['stock', 'fund']
@@ -23,15 +23,17 @@
23
23
  # SOFTWARE.
24
24
 
25
25
  import sys
26
+ import os
26
27
  import math
27
28
  import datetime
28
29
  from pytdx.hq import TDXParams
30
+ from configparser import ConfigParser
29
31
 
30
32
  from hikyuu.util.mylog import hku_error, hku_debug
31
33
 
32
34
  import mysql.connector
33
35
 
34
- from hikyuu import Datetime
36
+ from hikyuu import Datetime, is_valid_license, KDataToMySQLImporter
35
37
  from .common import *
36
38
  from .common_pytdx import to_pytdx_market, pytdx_get_day_trans
37
39
  from .common_mysql import (
@@ -318,10 +320,10 @@ def import_one_stock_data(
318
320
  today.year * 10000 + today.month * 100 + today.day
319
321
  ) * 10000 + 1500
320
322
  else:
321
- return 0
323
+ return (0, True, Datetime(last_datetime))
322
324
 
323
325
  if today_datetime <= last_datetime:
324
- return 0
326
+ return (0, True, Datetime(last_datetime))
325
327
 
326
328
  get_bars = (
327
329
  api.get_index_bars if stktype == STOCKTYPE.INDEX else api.get_security_bars
@@ -356,27 +358,27 @@ def import_one_stock_data(
356
358
  if abs(last_krecord[1] - bar["open"]) / last_krecord[1] > 0.01:
357
359
  hku_error(
358
360
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord open: {last_krecord[1]}, bar: {bar['open']}")
359
- return 0
361
+ return (0, False, Datetime(last_datetime))
360
362
  if abs(last_krecord[2] - bar["high"]) / last_krecord[2] > 0.01:
361
363
  hku_error(
362
364
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord high: {last_krecord[2]}, bar: {bar['high']}")
363
- return 0
365
+ return (0, False, Datetime(last_datetime))
364
366
  if abs(last_krecord[3] - bar["low"]) / last_krecord[3] > 0.01:
365
367
  hku_error(
366
368
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord low: {last_krecord[3]}, bar: {bar['low']}")
367
- return 0
369
+ return (0, False, Datetime(last_datetime))
368
370
  if abs(last_krecord[4] - bar["close"]) / last_krecord[4] > 0.01:
369
371
  hku_error(
370
372
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord close: {last_krecord[4]}, bar: {bar['close']}")
371
- return 0
372
- if ktype == 'DAY' and last_krecord[5] != 0.0 and abs(last_krecord[5] - bar["amount"]*0.001) / last_krecord[5] > 0.1:
373
+ return (0, False, Datetime(last_datetime))
374
+ if ktype == 'DAY' and last_krecord[5] != 0.0 and abs(last_krecord[5] - bar["amount"]*0.001) > 10000:
373
375
  hku_error(
374
376
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord amount: {last_krecord[5]}, bar: {bar['amount']*0.001}")
375
- return 0
376
- if ktype == 'DAY' and last_krecord[6] != 0.0 and abs(last_krecord[6] - bar["vol"]) / last_krecord[6] > 0.1:
377
+ return (0, False, Datetime(last_datetime))
378
+ if ktype == 'DAY' and last_krecord[6] != 0.0 and abs(last_krecord[6] - bar["vol"]) > 10000:
377
379
  hku_error(
378
380
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord count: {last_krecord[6]}, bar: {bar['vol']}")
379
- return 0
381
+ return (0, False, Datetime(last_datetime))
380
382
  continue
381
383
 
382
384
  if (
@@ -440,7 +442,17 @@ def import_one_stock_data(
440
442
  connect.commit()
441
443
  cur.close()
442
444
 
443
- return len(buf)
445
+ return (len(buf), True, Datetime(last_datetime))
446
+
447
+
448
+ @hku_catch(ret=None)
449
+ def get_mysql_importer():
450
+ filename = os.path.expanduser('~') + '/.hikyuu/hikyuu.ini'
451
+ config = ConfigParser()
452
+ config.read(filename, encoding='utf-8')
453
+ importer = KDataToMySQLImporter()
454
+ return importer if importer.set_config(config.get("kdata", "host"), config.getint("kdata", "port", fallback=3306),
455
+ config.get("kdata", "usr"), config.get("kdata", "pwd")) else None
444
456
 
445
457
 
446
458
  @hku_catch(trace=True, re_raise=True)
@@ -470,6 +482,9 @@ def import_data(
470
482
 
471
483
  stock_list = get_stock_list(connect, market, quotations)
472
484
 
485
+ failed_limit = 20
486
+ failed_count = 0
487
+ failed_list = []
473
488
  total = len(stock_list)
474
489
  for i, stock in enumerate(stock_list):
475
490
  if stock[3] == 0 or len(stock[2]) != 6:
@@ -477,9 +492,14 @@ def import_data(
477
492
  progress(i, total)
478
493
  continue
479
494
 
480
- this_count = import_one_stock_data(
495
+ this_count, success, lastdate = import_one_stock_data(
481
496
  connect, api, market, ktype, stock, startDate
482
497
  )
498
+ if not success:
499
+ failed_count += 1
500
+ failed_list.append((market, stock[2], lastdate))
501
+ if failed_count >= failed_limit:
502
+ break
483
503
  add_record_count += this_count
484
504
  if this_count > 0:
485
505
  if ktype == "DAY":
@@ -491,6 +511,28 @@ def import_data(
491
511
  progress(i, total)
492
512
 
493
513
  connect.commit()
514
+
515
+ if total > 0 and progress:
516
+ progress(total, total)
517
+
518
+ if 0 < failed_count < failed_limit and is_valid_license():
519
+ # 删除最后记录
520
+ ktype_dict = {
521
+ 'DAY': 'DAY',
522
+ '1MIN': 'MIN',
523
+ '5MIN': 'MIN5'
524
+ }
525
+ nktype = ktype_dict[ktype]
526
+ importer = get_mysql_importer()
527
+ if importer is not None:
528
+ for r in failed_list:
529
+ hku_warn("remove {}{} {}: {}", r[0], r[1], nktype, r[2].start_of_day())
530
+ importer.remove(r[0], r[1], nktype, r[2].start_of_day())
531
+ hku_warn(f"已清理 {market} {failed_count} 个失败股票的最后记录,建议重新导入")
532
+
533
+ if failed_count >= failed_limit:
534
+ hku_error(f"{market} {ktype} 连续失败20个股票,已停止导入, 建议重新导入")
535
+ return add_record_count
494
536
  return add_record_count
495
537
 
496
538
 
@@ -588,14 +630,15 @@ def import_on_stock_trans(connect, api, market, stock_record, max_days):
588
630
  if second > 59:
589
631
  continue
590
632
 
591
- trans_buf.append(
592
- (
593
- cur_date * 1000000 + minute * 100 + second,
594
- record["price"],
595
- record["vol"],
596
- record["buyorsell"],
633
+ if record['price'] > 0.0 and record['vol'] >= 0.0:
634
+ trans_buf.append(
635
+ (
636
+ cur_date * 1000000 + minute * 100 + second,
637
+ record["price"],
638
+ record["vol"],
639
+ record["buyorsell"],
640
+ )
597
641
  )
598
- )
599
642
  except Exception as e:
600
643
  hku_error("Failed trans to record! {}", e)
601
644
 
@@ -721,7 +764,8 @@ def import_on_stock_time(connect, api, market, stock_record, max_days):
721
764
  elif time == 1360:
722
765
  time = 1400
723
766
  try:
724
- time_buf.append((this_date + time, record['price'], record['vol']))
767
+ if record['price'] > 0.0 and record['vol'] >= 0.0:
768
+ time_buf.append((this_date + time, record['price'], record['vol']))
725
769
  time += 1
726
770
  except Exception as e:
727
771
  hku_error("Failed trans record {}! {}".format(record, e))
@@ -55,6 +55,8 @@ def pytdx_import_weight_to_clickhouse(pytdx_api, connect, market):
55
55
  db_last_date, last_total_count, last_free_count = (0, 0, 0)
56
56
 
57
57
  xdxr_list = pytdx_api.get_xdxr_info(pytdx_market, code)
58
+ if xdxr_list is None:
59
+ continue
58
60
  update_last_db_weight = False
59
61
  new_last_db_weight = last_db_weight
60
62
  records = {}
@@ -67,6 +67,8 @@ def pytdx_import_weight_to_mysql(pytdx_api, connect, market):
67
67
  cur.close()
68
68
 
69
69
  xdxr_list = pytdx_api.get_xdxr_info(pytdx_market, code)
70
+ if xdxr_list is None:
71
+ continue
70
72
  update_last_db_weight = False
71
73
  new_last_db_weight = last_db_weight
72
74
  records = {}
@@ -64,6 +64,8 @@ def pytdx_import_weight_to_sqlite(pytdx_api, connect, market):
64
64
  cur.close()
65
65
 
66
66
  xdxr_list = pytdx_api.get_xdxr_info(pytdx_market, code)
67
+ if xdxr_list is None:
68
+ continue
67
69
  update_last_db_weight = False
68
70
  new_last_db_weight = last_db_weight
69
71
  records = {}
@@ -0,0 +1,4 @@
1
+ BEGIN TRANSACTION;
2
+ update `stocktypeinfo` set `minTradeNumber`=100 where `type`=5 and `description`='ETF';
3
+ UPDATE `version` set `version` = 29;
4
+ COMMIT;
@@ -0,0 +1,5 @@
1
+ BEGIN TRANSACTION;
2
+ update `stocktypeinfo` set `minTradeNumber`=200 where `type`=9 and `description`='科创板';
3
+ update `stocktypeinfo` set `minTradeNumber`=100 where `type`=11 and `description`='北交所';
4
+ UPDATE `version` set `version` = 30;
5
+ COMMIT;
@@ -189,7 +189,7 @@ def tdx_import_day_data_from_file(connect, filename, ktype, market, stock_record
189
189
  with open(filename, 'rb') as src_file:
190
190
  data = src_file.read(32)
191
191
  while data:
192
- record = struct.unpack('iiiiifii', data)
192
+ record = struct.unpack('IIIIIfII', data)
193
193
  if lastdatetime and record[0] <= lastdatetime:
194
194
  data = src_file.read(32)
195
195
  continue
@@ -291,7 +291,7 @@ def tdx_import_min_data_from_file(connect, filename, ktype, market, stock_record
291
291
 
292
292
  data = src_file.read(32)
293
293
  while data:
294
- record = struct.unpack('HHfffffii', data)
294
+ record = struct.unpack('HHfffffII', data)
295
295
  if record[3] >= record[2] >= record[4] > 0\
296
296
  and record[3] >= record[5] >= record[4] > 0\
297
297
  and record[5] >= 0 \
hikyuu/data/tdx_to_h5.py CHANGED
@@ -124,14 +124,14 @@ def tdx_import_stock_name_from_file(connect, filename, market, quotations=None):
124
124
  length = len(codepre[0])
125
125
  if code[:length] == codepre[0]:
126
126
  count += 1
127
- #print(market, code, newStockDict[code], codepre)
127
+ # print(market, code, newStockDict[code], codepre)
128
128
  sql = "insert into Stock(marketid, code, name, type, valid, startDate, endDate) \
129
129
  values (%s, '%s', '%s', %s, %s, %s, %s)" \
130
130
  % (marketid, code, newStockDict[code], codepre[1], 1, today, 99999999)
131
131
  cur.execute(sql)
132
132
  break
133
133
 
134
- #print('%s新增股票数:%i' % (market.upper(), count))
134
+ # print('%s新增股票数:%i' % (market.upper(), count))
135
135
  connect.commit()
136
136
  cur.close()
137
137
  return count
@@ -163,7 +163,7 @@ def tdx_import_day_data_from_file(connect, filename, h5file, market, stock_recor
163
163
  with open(filename, 'rb') as src_file:
164
164
  data = src_file.read(32)
165
165
  while data:
166
- record = struct.unpack('iiiiifii', data)
166
+ record = struct.unpack('IIIIIfII', data)
167
167
  if lastdatetime and record[0] <= lastdatetime:
168
168
  data = src_file.read(32)
169
169
  continue
@@ -191,8 +191,8 @@ def tdx_import_day_data_from_file(connect, filename, h5file, market, stock_recor
191
191
  if add_record_count > 0:
192
192
  table.flush()
193
193
 
194
- #更新基础信息数据库中股票对应的起止日期及其有效标志
195
- #if valid == 0:
194
+ # 更新基础信息数据库中股票对应的起止日期及其有效标志
195
+ # if valid == 0:
196
196
  cur = connect.cursor()
197
197
  cur.execute(
198
198
  "update stock set valid=1, startdate=%i, enddate=%i where stockid=%i" %
@@ -201,13 +201,13 @@ def tdx_import_day_data_from_file(connect, filename, h5file, market, stock_recor
201
201
  connect.commit()
202
202
  cur.close()
203
203
 
204
- #记录最新更新日期
204
+ # 记录最新更新日期
205
205
  if (code == '000001' and marketid == MARKETID.SH) \
206
- or (code == '399001' and marketid == MARKETID.SZ) :
206
+ or (code == '399001' and marketid == MARKETID.SZ):
207
207
  update_last_date(connect, marketid, table[-1]['datetime'] / 10000)
208
208
 
209
209
  elif table.nrows == 0:
210
- #print(market, stock_record)
210
+ # print(market, stock_record)
211
211
  table.remove()
212
212
 
213
213
  return add_record_count
@@ -290,7 +290,7 @@ def tdx_import_min_data_from_file(connect, filename, h5file, market, stock_recor
290
290
 
291
291
  data = src_file.read(32)
292
292
  while data:
293
- record = struct.unpack('HHfffffii', data)
293
+ record = struct.unpack('HHfffffII', data)
294
294
  if 0 not in record[2:6]:
295
295
  if record[3] >= record[2] >= record[4] \
296
296
  and record[3] >= record[5] >= record[4]:
@@ -314,7 +314,7 @@ def tdx_import_min_data_from_file(connect, filename, h5file, market, stock_recor
314
314
  if add_record_count > 0:
315
315
  table.flush()
316
316
  elif table.nrows == 0:
317
- #print(market, stock_record)
317
+ # print(market, stock_record)
318
318
  table.remove()
319
319
 
320
320
  return add_record_count
@@ -386,7 +386,7 @@ if __name__ == '__main__':
386
386
 
387
387
  src_dir = "D:\\TdxW_HuaTai"
388
388
  dest_dir = "c:\\stock"
389
- quotations = ['stock', 'fund'] #通达信盘后数据没有债券
389
+ quotations = ['stock', 'fund'] # 通达信盘后数据没有债券
390
390
 
391
391
  connect = sqlite3.connect(dest_dir + "\\stock.db")
392
392
  create_database(connect)
@@ -171,7 +171,7 @@ def tdx_import_day_data_from_file(connect, filename, ktype, market, stock_record
171
171
  with open(filename, 'rb') as src_file:
172
172
  data = src_file.read(32)
173
173
  while data:
174
- record = struct.unpack('iiiiifii', data)
174
+ record = struct.unpack('IIIIIfII', data)
175
175
  if lastdatetime and record[0] <= lastdatetime:
176
176
  data = src_file.read(32)
177
177
  continue
@@ -297,7 +297,7 @@ def tdx_import_min_data_from_file(connect, filename, ktype, market, stock_record
297
297
 
298
298
  data = src_file.read(32)
299
299
  while data:
300
- record = struct.unpack('HHfffffii', data)
300
+ record = struct.unpack('HHfffffII', data)
301
301
  if record[3] >= record[2] >= record[4] > 0\
302
302
  and record[3] >= record[5] >= record[4] > 0\
303
303
  and record[5] >= 0 \
hikyuu/draw/__init__.pyi CHANGED
@@ -9,8 +9,8 @@ from hikyuu.draw.drawplot import gcf
9
9
  from hikyuu.draw.drawplot import get_current_draw_engine
10
10
  from hikyuu.draw.drawplot.matplotlib_draw import DRAWBAND
11
11
  from hikyuu.draw.drawplot.matplotlib_draw import DRAWICON
12
- from hikyuu.draw.drawplot.matplotlib_draw import DRAWIMG
13
12
  from hikyuu.draw.drawplot.matplotlib_draw import DRAWIMG as DRAWBMP
13
+ from hikyuu.draw.drawplot.matplotlib_draw import DRAWIMG
14
14
  from hikyuu.draw.drawplot.matplotlib_draw import DRAWLINE
15
15
  from hikyuu.draw.drawplot.matplotlib_draw import DRAWNUMBER
16
16
  from hikyuu.draw.drawplot.matplotlib_draw import DRAWNUMBER_FIX
@@ -25,8 +25,8 @@ from hikyuu.draw.drawplot.echarts_draw import sys_performance as ec_sys_performa
25
25
  from hikyuu.draw.drawplot.echarts_draw import sysplot as ec_sysplot
26
26
  from hikyuu.draw.drawplot.matplotlib_draw import DRAWBAND
27
27
  from hikyuu.draw.drawplot.matplotlib_draw import DRAWICON
28
- from hikyuu.draw.drawplot.matplotlib_draw import DRAWIMG
29
28
  from hikyuu.draw.drawplot.matplotlib_draw import DRAWIMG as DRAWBMP
29
+ from hikyuu.draw.drawplot.matplotlib_draw import DRAWIMG
30
30
  from hikyuu.draw.drawplot.matplotlib_draw import DRAWLINE
31
31
  from hikyuu.draw.drawplot.matplotlib_draw import DRAWNUMBER
32
32
  from hikyuu.draw.drawplot.matplotlib_draw import DRAWNUMBER_FIX