hikyuu 2.0.9__cp39-none-win_amd64.whl → 2.1.1__cp39-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.
Files changed (119) hide show
  1. hikyuu/analysis/analysis.py +6 -5
  2. hikyuu/cpp/boost_date_time-mt.dll +0 -0
  3. hikyuu/cpp/boost_serialization-mt.dll +0 -0
  4. hikyuu/cpp/boost_wserialization-mt.dll +0 -0
  5. hikyuu/cpp/core39.pyd +0 -0
  6. hikyuu/cpp/hikyuu.dll +0 -0
  7. hikyuu/cpp/sqlite3.dll +0 -0
  8. hikyuu/data/common.py +1 -4
  9. hikyuu/draw/drawplot/matplotlib_draw.py +3 -2
  10. hikyuu/extend.py +3 -1
  11. hikyuu/flat/Spot.py +0 -139
  12. hikyuu/flat/SpotList.py +1 -59
  13. hikyuu/gui/HikyuuTDX.py +17 -11
  14. hikyuu/gui/data/UseTdxImportToH5Thread.py +1 -1
  15. hikyuu/hub.py +1 -1
  16. hikyuu/include/hikyuu/Block.h +2 -2
  17. hikyuu/include/hikyuu/DataType.h +2 -1
  18. hikyuu/include/hikyuu/KRecord.h +1 -1
  19. hikyuu/include/hikyuu/StockManager.h +3 -0
  20. hikyuu/include/hikyuu/analysis/combinate.h +1 -1
  21. hikyuu/include/hikyuu/config.h +3 -12
  22. hikyuu/include/hikyuu/global/agent/hikyuu/flat/__init__.py +1 -0
  23. hikyuu/include/hikyuu/global/agent/spot_generated.h +3 -225
  24. hikyuu/include/hikyuu/indicator/crt/BLOCKSETNUM.h +1 -9
  25. hikyuu/include/hikyuu/indicator/crt/INSUM.h +2 -5
  26. hikyuu/include/hikyuu/strategy/AccountTradeManager.h +3 -1
  27. hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +5 -5
  28. hikyuu/include/hikyuu/trade_sys/condition/ConditionBase.h +1 -1
  29. hikyuu/include/hikyuu/trade_sys/environment/EnvironmentBase.h +5 -5
  30. hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +1 -1
  31. hikyuu/include/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h +1 -1
  32. hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +24 -1
  33. hikyuu/include/hikyuu/trade_sys/selector/build_in.h +1 -0
  34. hikyuu/include/hikyuu/trade_sys/selector/crt/SE_Fixed.h +5 -2
  35. hikyuu/include/hikyuu/trade_sys/selector/crt/SE_MultiFactor.h +2 -5
  36. hikyuu/include/hikyuu/trade_sys/selector/crt/SE_Operator.h +43 -0
  37. hikyuu/include/hikyuu/trade_sys/selector/imp/FixedSelector.h +1 -0
  38. hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +9 -2
  39. hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorAddSelector.h +19 -0
  40. hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorAddValueSelector.h +19 -0
  41. hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorDivSelector.h +19 -0
  42. hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorDivValueSelector.h +19 -0
  43. hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorInvertDivValueSelector.h +19 -0
  44. hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorInvertSubValueSelector.h +19 -0
  45. hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorMulSelector.h +19 -0
  46. hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorMulValueSelector.h +19 -0
  47. hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorSelector.h +99 -0
  48. hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorSubSelector.h +19 -0
  49. hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorSubValueSelector.h +19 -0
  50. hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorValueSelector.h +77 -0
  51. hikyuu/include/hikyuu/trade_sys/signal/SignalBase.h +5 -5
  52. hikyuu/include/hikyuu/trade_sys/slippage/SlippageBase.h +1 -1
  53. hikyuu/include/hikyuu/trade_sys/stoploss/StoplossBase.h +6 -6
  54. hikyuu/include/hikyuu/trade_sys/system/System.h +21 -13
  55. hikyuu/include/hikyuu/utilities/FilterNode.h +267 -0
  56. hikyuu/include/hikyuu/utilities/LRUCache11.h +230 -0
  57. hikyuu/include/hikyuu/{Log.h → utilities/Log.h} +91 -113
  58. hikyuu/include/hikyuu/utilities/Null.h +1 -0
  59. hikyuu/include/hikyuu/utilities/Parameter.h +2 -1
  60. hikyuu/include/hikyuu/utilities/ResourcePool.h +636 -0
  61. hikyuu/include/hikyuu/utilities/SpendTimer.h +10 -9
  62. hikyuu/include/hikyuu/utilities/TimerManager.h +2 -2
  63. hikyuu/include/hikyuu/utilities/any_to_string.h +142 -0
  64. hikyuu/include/hikyuu/utilities/arithmetic.h +69 -33
  65. hikyuu/include/hikyuu/utilities/base64.h +59 -0
  66. hikyuu/include/hikyuu/utilities/config.h +41 -0
  67. hikyuu/include/hikyuu/utilities/datetime/Datetime.h +41 -31
  68. hikyuu/include/hikyuu/utilities/datetime/TimeDelta.h +24 -13
  69. hikyuu/include/hikyuu/utilities/db_connect/DBCondition.h +48 -48
  70. hikyuu/include/hikyuu/utilities/db_connect/DBConnect.h +10 -0
  71. hikyuu/include/hikyuu/utilities/db_connect/DBConnectBase.h +5 -22
  72. hikyuu/include/hikyuu/utilities/db_connect/DBUpgrade.h +3 -3
  73. hikyuu/include/hikyuu/utilities/db_connect/SQLException.h +1 -1
  74. hikyuu/include/hikyuu/utilities/db_connect/SQLResultSet.h +1 -1
  75. hikyuu/include/hikyuu/utilities/db_connect/SQLStatementBase.h +7 -7
  76. hikyuu/include/hikyuu/utilities/db_connect/TableMacro.h +1 -2
  77. hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLConnect.h +9 -9
  78. hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLStatement.h +18 -18
  79. hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteConnect.h +3 -3
  80. hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteStatement.h +2 -2
  81. hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteUtil.h +6 -6
  82. hikyuu/include/hikyuu/{exception.h → utilities/exception.h} +1 -0
  83. hikyuu/include/hikyuu/utilities/http_client/HttpClient.h +229 -0
  84. hikyuu/include/hikyuu/utilities/http_client/__init__.py +1 -0
  85. hikyuu/include/hikyuu/utilities/http_client/nng_wrap.h +517 -0
  86. hikyuu/include/hikyuu/utilities/http_client/url.h +25 -0
  87. hikyuu/include/hikyuu/utilities/{IniParser.h → ini_parser/IniParser.h} +10 -5
  88. hikyuu/include/hikyuu/utilities/ini_parser/__init__.py +1 -0
  89. hikyuu/include/hikyuu/utilities/md5.h +41 -0
  90. hikyuu/include/hikyuu/utilities/mo/__init__.py +1 -0
  91. hikyuu/include/hikyuu/utilities/mo/mo.h +48 -0
  92. hikyuu/include/hikyuu/utilities/mo/moFileReader.h +836 -0
  93. hikyuu/include/hikyuu/{global → utilities}/node/NodeClient.h +25 -18
  94. hikyuu/include/hikyuu/{global → utilities}/node/NodeError.h +1 -1
  95. hikyuu/include/hikyuu/{global → utilities}/node/NodeMessage.h +3 -2
  96. hikyuu/include/hikyuu/utilities/node/NodeServer.h +246 -0
  97. hikyuu/include/hikyuu/utilities/node/__init__.py +1 -0
  98. hikyuu/include/hikyuu/utilities/os.h +20 -14
  99. hikyuu/include/hikyuu/utilities/snowflake.h +110 -0
  100. hikyuu/include/hikyuu/utilities/string_view.h +70 -0
  101. hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +5 -5
  102. hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +5 -5
  103. hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +5 -5
  104. hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +5 -5
  105. hikyuu/include/hikyuu/version.h +5 -5
  106. hikyuu/sqlite3.dll +0 -0
  107. hikyuu/vcruntime140.dll +0 -0
  108. hikyuu/vcruntime140_1.dll +0 -0
  109. hikyuu-2.1.1.dist-info/METADATA +115 -0
  110. {hikyuu-2.0.9.dist-info → hikyuu-2.1.1.dist-info}/RECORD +115 -82
  111. {hikyuu-2.0.9.dist-info → hikyuu-2.1.1.dist-info}/top_level.txt +6 -1
  112. hikyuu/README.rst +0 -79
  113. hikyuu/cpp/boost_atomic-mt.dll +0 -0
  114. hikyuu/cpp/boost_filesystem-mt.dll +0 -0
  115. hikyuu-2.0.9.dist-info/METADATA +0 -126
  116. /hikyuu/include/hikyuu/global/{node → agent/hikyuu}/__init__.py +0 -0
  117. {hikyuu-2.0.9.dist-info → hikyuu-2.1.1.dist-info}/LICENSE +0 -0
  118. {hikyuu-2.0.9.dist-info → hikyuu-2.1.1.dist-info}/WHEEL +0 -0
  119. {hikyuu-2.0.9.dist-info → hikyuu-2.1.1.dist-info}/entry_points.txt +0 -0
@@ -109,11 +109,12 @@ def analysis_sys_list(stks, query, sys_proto, keys=["累计投入本金", "当
109
109
  k = stk.get_kdata(query)
110
110
  my_sys = sys_proto.clone()
111
111
  my_sys.run(k, reset_all=True)
112
- per.statistics(my_sys.tm, k[-1].datetime if len(k) > 0 else Datetime())
113
- ret["证券代码"].append(stk.market_code)
114
- ret["证券名称"].append(stk.name)
115
- for key in keys:
116
- ret[key].append(per[key])
112
+ if len(k) > 0:
113
+ per.statistics(my_sys.tm, k[-1].datetime)
114
+ ret["证券代码"].append(stk.market_code)
115
+ ret["证券名称"].append(stk.name)
116
+ for key in keys:
117
+ ret[key].append(per[key])
117
118
  return pd.DataFrame(ret)
118
119
 
119
120
 
Binary file
Binary file
Binary file
hikyuu/cpp/core39.pyd CHANGED
Binary file
hikyuu/cpp/hikyuu.dll CHANGED
Binary file
hikyuu/cpp/sqlite3.dll CHANGED
Binary file
hikyuu/data/common.py CHANGED
@@ -27,7 +27,6 @@ import re
27
27
  import akshare as ak
28
28
  import pandas as pd
29
29
  import datetime
30
- from hikyuu.core import cpp_bytes_to_vector_float_blob
31
30
  from hikyuu.util import *
32
31
 
33
32
 
@@ -203,7 +202,7 @@ def get_china_bond10_rate(start_date="19901219"):
203
202
  def modifiy_code(code):
204
203
  if code.startswith(('0', '3')):
205
204
  return 'SZ' + code
206
- if code.startswith(('4', '8')):
205
+ if code.startswith(('4', '8', '92')):
207
206
  return 'BJ' + code
208
207
  if code.startswith('6'):
209
208
  return 'SH' + code
@@ -244,8 +243,6 @@ def historyfinancialreader(filepath):
244
243
  cw_info = list(struct.unpack(report_pack_format, info_data))
245
244
  report_date = int(cw_info[313]) # 财务公告日期
246
245
  report_date = 19000000 + report_date if report_date > 800000 else 20000000 + report_date
247
- # results.append((modifiy_code(code), report_date, cw_info))
248
- # results.append((file_date, modifiy_code(code), report_date, cpp_bytes_to_vector_float_blob(info_data)))
249
246
  results.append((file_date, modifiy_code(code), report_date, info_data))
250
247
  cw_file.close()
251
248
  return results
@@ -760,7 +760,8 @@ def sys_performance(sys, ref_stk=None):
760
760
  ref_k = ref_stk.get_kdata(sys.query)
761
761
  hku_check(len(ref_k) > 0, "The length of ref_k is zero! Maybe The query date is out of the ref-stock range!\n ref_k: {}", ref_k)
762
762
 
763
- query = Query(ref_k[0].datetime.start_of_day(), ref_k[-1].datetime.start_of_day() + Seconds(1), Query.DAY)
763
+ query = Query(ref_k[0].datetime.start_of_day(), ref_k[-1].datetime.start_of_day() +
764
+ Seconds(1), Query.DAY, recover_type=Query.EQUAL_BACKWARD)
764
765
  ref_k = ref_stk.get_kdata(query)
765
766
 
766
767
  ref_dates = ref_k.get_datetime_list()
@@ -772,7 +773,7 @@ def sys_performance(sys, ref_stk=None):
772
773
  funds_return = VALUE(funds_return)
773
774
  funds_return.name = "系统累积收益率"
774
775
  ref_return = ROCR(ref_k.close, 0)
775
- ref_return.name = ref_stk.name
776
+ ref_return.name = f"{ref_stk.name}({ref_stk.market_code})"
776
777
 
777
778
  per = Performance()
778
779
  text = per.report(sys.tm, query.end_datetime)
hikyuu/extend.py CHANGED
@@ -1,10 +1,12 @@
1
1
  #
2
2
  # 对 C++ 引出类和函数进行扩展, pybind11 对小函数到导出效率不如 python 直接执行
3
3
  #
4
+
5
+ # 优先加载 hikyuu 库,防止 windows 公共依赖库不同导致DLL初始化失败
6
+ from .core import *
4
7
  import numpy as np
5
8
  import pandas as pd
6
9
  from datetime import *
7
- from .core import *
8
10
 
9
11
  # ------------------------------------------------------------------
10
12
  # 增加Datetime、Stock的hash支持,以便可做为dict的key
hikyuu/flat/Spot.py CHANGED
@@ -438,142 +438,3 @@ def SpotEnd(builder):
438
438
 
439
439
  def End(builder):
440
440
  return SpotEnd(builder)
441
-
442
-
443
- class SpotT(object):
444
-
445
- # SpotT
446
- def __init__(self):
447
- self.market = None # type: str
448
- self.code = None # type: str
449
- self.name = None # type: str
450
- self.datetime = None # type: str
451
- self.yesterdayClose = 0.0 # type: float
452
- self.open = 0.0 # type: float
453
- self.high = 0.0 # type: float
454
- self.low = 0.0 # type: float
455
- self.close = 0.0 # type: float
456
- self.amount = 0.0 # type: float
457
- self.volume = 0.0 # type: float
458
- self.bid1 = 0.0 # type: float
459
- self.bid1Amount = 0.0 # type: float
460
- self.bid2 = 0.0 # type: float
461
- self.bid2Amount = 0.0 # type: float
462
- self.bid3 = 0.0 # type: float
463
- self.bid3Amount = 0.0 # type: float
464
- self.bid4 = 0.0 # type: float
465
- self.bid4Amount = 0.0 # type: float
466
- self.bid5 = 0.0 # type: float
467
- self.bid5Amount = 0.0 # type: float
468
- self.ask1 = 0.0 # type: float
469
- self.ask1Amount = 0.0 # type: float
470
- self.ask2 = 0.0 # type: float
471
- self.ask2Amount = 0.0 # type: float
472
- self.ask3 = 0.0 # type: float
473
- self.ask3Amount = 0.0 # type: float
474
- self.ask4 = 0.0 # type: float
475
- self.ask4Amount = 0.0 # type: float
476
- self.ask5 = 0.0 # type: float
477
- self.ask5Amount = 0.0 # type: float
478
-
479
- @classmethod
480
- def InitFromBuf(cls, buf, pos):
481
- spot = Spot()
482
- spot.Init(buf, pos)
483
- return cls.InitFromObj(spot)
484
-
485
- @classmethod
486
- def InitFromPackedBuf(cls, buf, pos=0):
487
- n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
488
- return cls.InitFromBuf(buf, pos+n)
489
-
490
- @classmethod
491
- def InitFromObj(cls, spot):
492
- x = SpotT()
493
- x._UnPack(spot)
494
- return x
495
-
496
- # SpotT
497
- def _UnPack(self, spot):
498
- if spot is None:
499
- return
500
- self.market = spot.Market()
501
- self.code = spot.Code()
502
- self.name = spot.Name()
503
- self.datetime = spot.Datetime()
504
- self.yesterdayClose = spot.YesterdayClose()
505
- self.open = spot.Open()
506
- self.high = spot.High()
507
- self.low = spot.Low()
508
- self.close = spot.Close()
509
- self.amount = spot.Amount()
510
- self.volume = spot.Volume()
511
- self.bid1 = spot.Bid1()
512
- self.bid1Amount = spot.Bid1Amount()
513
- self.bid2 = spot.Bid2()
514
- self.bid2Amount = spot.Bid2Amount()
515
- self.bid3 = spot.Bid3()
516
- self.bid3Amount = spot.Bid3Amount()
517
- self.bid4 = spot.Bid4()
518
- self.bid4Amount = spot.Bid4Amount()
519
- self.bid5 = spot.Bid5()
520
- self.bid5Amount = spot.Bid5Amount()
521
- self.ask1 = spot.Ask1()
522
- self.ask1Amount = spot.Ask1Amount()
523
- self.ask2 = spot.Ask2()
524
- self.ask2Amount = spot.Ask2Amount()
525
- self.ask3 = spot.Ask3()
526
- self.ask3Amount = spot.Ask3Amount()
527
- self.ask4 = spot.Ask4()
528
- self.ask4Amount = spot.Ask4Amount()
529
- self.ask5 = spot.Ask5()
530
- self.ask5Amount = spot.Ask5Amount()
531
-
532
- # SpotT
533
- def Pack(self, builder):
534
- if self.market is not None:
535
- market = builder.CreateString(self.market)
536
- if self.code is not None:
537
- code = builder.CreateString(self.code)
538
- if self.name is not None:
539
- name = builder.CreateString(self.name)
540
- if self.datetime is not None:
541
- datetime = builder.CreateString(self.datetime)
542
- SpotStart(builder)
543
- if self.market is not None:
544
- SpotAddMarket(builder, market)
545
- if self.code is not None:
546
- SpotAddCode(builder, code)
547
- if self.name is not None:
548
- SpotAddName(builder, name)
549
- if self.datetime is not None:
550
- SpotAddDatetime(builder, datetime)
551
- SpotAddYesterdayClose(builder, self.yesterdayClose)
552
- SpotAddOpen(builder, self.open)
553
- SpotAddHigh(builder, self.high)
554
- SpotAddLow(builder, self.low)
555
- SpotAddClose(builder, self.close)
556
- SpotAddAmount(builder, self.amount)
557
- SpotAddVolume(builder, self.volume)
558
- SpotAddBid1(builder, self.bid1)
559
- SpotAddBid1Amount(builder, self.bid1Amount)
560
- SpotAddBid2(builder, self.bid2)
561
- SpotAddBid2Amount(builder, self.bid2Amount)
562
- SpotAddBid3(builder, self.bid3)
563
- SpotAddBid3Amount(builder, self.bid3Amount)
564
- SpotAddBid4(builder, self.bid4)
565
- SpotAddBid4Amount(builder, self.bid4Amount)
566
- SpotAddBid5(builder, self.bid5)
567
- SpotAddBid5Amount(builder, self.bid5Amount)
568
- SpotAddAsk1(builder, self.ask1)
569
- SpotAddAsk1Amount(builder, self.ask1Amount)
570
- SpotAddAsk2(builder, self.ask2)
571
- SpotAddAsk2Amount(builder, self.ask2Amount)
572
- SpotAddAsk3(builder, self.ask3)
573
- SpotAddAsk3Amount(builder, self.ask3Amount)
574
- SpotAddAsk4(builder, self.ask4)
575
- SpotAddAsk4Amount(builder, self.ask4Amount)
576
- SpotAddAsk5(builder, self.ask5)
577
- SpotAddAsk5Amount(builder, self.ask5Amount)
578
- spot = SpotEnd(builder)
579
- return spot
hikyuu/flat/SpotList.py CHANGED
@@ -64,7 +64,7 @@ def AddSpot(builder, spot):
64
64
  def SpotListStartSpotVector(builder, numElems):
65
65
  return builder.StartVector(4, numElems, 4)
66
66
 
67
- def StartSpotVector(builder, numElems: int) -> int:
67
+ def StartSpotVector(builder, numElems):
68
68
  return SpotListStartSpotVector(builder, numElems)
69
69
 
70
70
  def SpotListEnd(builder):
@@ -72,61 +72,3 @@ def SpotListEnd(builder):
72
72
 
73
73
  def End(builder):
74
74
  return SpotListEnd(builder)
75
-
76
- import hikyuu.flat.Spot
77
- try:
78
- from typing import List
79
- except:
80
- pass
81
-
82
- class SpotListT(object):
83
-
84
- # SpotListT
85
- def __init__(self):
86
- self.spot = None # type: List[hikyuu.flat.Spot.SpotT]
87
-
88
- @classmethod
89
- def InitFromBuf(cls, buf, pos):
90
- spotList = SpotList()
91
- spotList.Init(buf, pos)
92
- return cls.InitFromObj(spotList)
93
-
94
- @classmethod
95
- def InitFromPackedBuf(cls, buf, pos=0):
96
- n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
97
- return cls.InitFromBuf(buf, pos+n)
98
-
99
- @classmethod
100
- def InitFromObj(cls, spotList):
101
- x = SpotListT()
102
- x._UnPack(spotList)
103
- return x
104
-
105
- # SpotListT
106
- def _UnPack(self, spotList):
107
- if spotList is None:
108
- return
109
- if not spotList.SpotIsNone():
110
- self.spot = []
111
- for i in range(spotList.SpotLength()):
112
- if spotList.Spot(i) is None:
113
- self.spot.append(None)
114
- else:
115
- spot_ = hikyuu.flat.Spot.SpotT.InitFromObj(spotList.Spot(i))
116
- self.spot.append(spot_)
117
-
118
- # SpotListT
119
- def Pack(self, builder):
120
- if self.spot is not None:
121
- spotlist = []
122
- for i in range(len(self.spot)):
123
- spotlist.append(self.spot[i].Pack(builder))
124
- SpotListStartSpotVector(builder, len(self.spot))
125
- for i in reversed(range(len(self.spot))):
126
- builder.PrependUOffsetTRelative(spotlist[i])
127
- spot = builder.EndVector()
128
- SpotListStart(builder)
129
- if self.spot is not None:
130
- SpotListAddSpot(builder, spot)
131
- spotList = SpotListEnd(builder)
132
- return spotList
hikyuu/gui/HikyuuTDX.py CHANGED
@@ -8,6 +8,10 @@ import datetime
8
8
  import multiprocessing
9
9
  from configparser import ConfigParser
10
10
  from logging.handlers import QueueListener
11
+
12
+ # 优先加载,处理 VS 17.10 升级后依赖 dll 不兼容问题
13
+ import hikyuu
14
+
11
15
  import PyQt5
12
16
 
13
17
  from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox
@@ -240,6 +244,13 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
240
244
  self.mp_log_q_lisener.start()
241
245
 
242
246
  def initUI(self):
247
+ # 读取配置文件放在 output 重定向之前,防止配置文件读取失败没有提示
248
+ # 读取保存的配置文件信息,如果不存在,则使用默认配置
249
+ this_dir = self.getUserConfigDir()
250
+ import_config = ConfigParser()
251
+ if os.path.exists(this_dir + '/importdata-gui.ini'):
252
+ import_config.read(this_dir + '/importdata-gui.ini', encoding='utf-8')
253
+
243
254
  self._is_sched_import_running = False
244
255
  self._is_collect_running = False
245
256
  self._stream = None
@@ -272,12 +283,6 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
272
283
  self.time_start_dateEdit.setMinimumDate(today - datetime.timedelta(300))
273
284
  self.collect_status_label.setText("已停止")
274
285
 
275
- # 读取保存的配置文件信息,如果不存在,则使用默认配置
276
- this_dir = self.getUserConfigDir()
277
- import_config = ConfigParser()
278
- if os.path.exists(this_dir + '/importdata-gui.ini'):
279
- import_config.read(this_dir + '/importdata-gui.ini', encoding='utf-8')
280
-
281
286
  # 初始化导入行情数据类型配置
282
287
  self.import_stock_checkBox.setChecked(import_config.getboolean('quotation', 'stock', fallback=True))
283
288
  self.import_fund_checkBox.setChecked(import_config.getboolean('quotation', 'fund', fallback=True))
@@ -675,6 +680,12 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
675
680
 
676
681
  @pyqtSlot()
677
682
  def on_start_import_pushButton_clicked(self):
683
+ try:
684
+ self.saveConfig()
685
+ except Exception as e:
686
+ QMessageBox.about(self, "保存配置信息失败", str(e))
687
+ return
688
+
678
689
  config = self.getCurrentConfig()
679
690
  if config.getboolean('hdf5', 'enable') \
680
691
  and (not os.path.lexists(config['hdf5']['dir']) or not os.path.isdir(config['hdf5']['dir'])):
@@ -686,11 +697,6 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
686
697
  or not os.path.isdir(config['tdx']['dir'])):
687
698
  QMessageBox.about(self, "错误", "请确认通达信安装目录是否正确!")
688
699
  return
689
- try:
690
- self.saveConfig()
691
- except Exception as e:
692
- QMessageBox.about(self, "保存配置信息失败", str(e))
693
- return
694
700
 
695
701
  self.import_running = True
696
702
  self.start_import_pushButton.setEnabled(False)
@@ -152,7 +152,7 @@ class UseTdxImportToH5Thread(QThread):
152
152
  hdf5_import_progress[market][ktype] = progress
153
153
  current_progress = (hdf5_import_progress['SH'][ktype] + hdf5_import_progress['SZ'][ktype]) // 2
154
154
  self.send_message(['IMPORT_KDATA', ktype, current_progress])
155
- elif taskname == 'IMPORT_KDATA':
155
+ elif taskname == 'IMPORT_FINANCE':
156
156
  self.send_message([taskname, progress])
157
157
  else:
158
158
  self.logger.error("Unknow task: {}".format(taskname))
hikyuu/hub.py CHANGED
@@ -496,7 +496,7 @@ class HubManager(metaclass=SingletonType):
496
496
  """
497
497
  abs_path = os.path.abspath(filename) # 当前文件的绝对路径
498
498
  path_parts = pathlib.Path(abs_path).parts
499
- local_base = path_parts[-4] if path_parts[-3] in ('pf', 'sys', 'ind', 'other') else path_parts[4]
499
+ local_base = path_parts[-4] if path_parts[-3] in ('pf', 'sys', 'ind', 'other') else path_parts[-5]
500
500
  hub_model = self._session.query(HubModel.name).filter_by(local_base=local_base).first()
501
501
  checkif(hub_model is None, local_base, HubNotFoundError)
502
502
  return hub_model.name
@@ -64,14 +64,14 @@ public:
64
64
  /** 设置板块类别 */
65
65
  void category(const string& category) {
66
66
  if (!m_data)
67
- m_data = shared_ptr<Data>(new Data);
67
+ m_data = make_shared<Data>();
68
68
  m_data->m_category = category;
69
69
  }
70
70
 
71
71
  /** 设置名称 */
72
72
  void name(const string& name) {
73
73
  if (!m_data)
74
- m_data = shared_ptr<Data>(new Data);
74
+ m_data = make_shared<Data>();
75
75
  m_data->m_name = name;
76
76
  }
77
77
 
@@ -29,7 +29,8 @@
29
29
  #include <map>
30
30
  #include <unordered_map>
31
31
 
32
- #include "Log.h"
32
+ #include "config.h"
33
+ #include "utilities/Log.h"
33
34
  #include "utilities/osdef.h"
34
35
  #include "utilities/cppdef.h"
35
36
  #include "utilities/datetime/Datetime.h"
@@ -23,7 +23,7 @@ public:
23
23
  price_t openPrice; ///< 开盘价
24
24
  price_t highPrice; ///< 最高价
25
25
  price_t lowPrice; ///< 最低价
26
- price_t closePrice; ///< 最低价
26
+ price_t closePrice; ///< 收盘价
27
27
  price_t transAmount; ///< 成交金额(千元)
28
28
  price_t transCount; ///< 成交量(手),日线以下为股数
29
29
 
@@ -255,6 +255,9 @@ private:
255
255
  /** 加载历史财经字段索引 */
256
256
  void loadHistoryFinanceField();
257
257
 
258
+ /** 加载历史财务数据 */
259
+ void loadHistoryFinance();
260
+
258
261
  private:
259
262
  StockManager();
260
263
 
@@ -10,7 +10,7 @@
10
10
  #include "hikyuu/indicator/Indicator.h"
11
11
  #include "hikyuu/trade_sys/system/System.h"
12
12
  #include "hikyuu/trade_manage/Performance.h"
13
- #include "../Log.h"
13
+ #include "hikyuu/utilities/Log.h"
14
14
 
15
15
  namespace hku {
16
16
 
@@ -19,21 +19,12 @@
19
19
  // 检查下标越界
20
20
  #define CHECK_ACCESS_BOUND 1
21
21
 
22
- // 默认激活的日志级别
23
- #define LOG_ACTIVE_LEVEL 2
24
-
25
- // 是否使用 spdlog
26
- #define USE_SPDLOG_LOGGER 1
27
-
28
- // 使用异步 logger
29
- #define HKU_USE_SPDLOG_ASYNC_LOGGER 0
30
-
31
- // spdlog默认日志级别
32
- #define SPDLOG_ACTIVE_LEVEL 2
33
-
34
22
  // 启用MSVC内存泄漏检查
35
23
  #define ENABLE_MSVC_LEAK_DETECT 0
36
24
 
25
+ // 启用内存泄漏检测,用于 linux 系统
26
+ #define HKU_ENABLE_LEAK_DETECT 0
27
+
37
28
  // 启用发送用户使用信息
38
29
  #define HKU_ENABLE_SEND_FEEDBACK 1
39
30