hikyuu 2.0.9__cp312-none-win_amd64.whl → 2.1.0__cp312-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hikyuu/analysis/analysis.py +6 -5
- hikyuu/cpp/boost_date_time-mt.dll +0 -0
- hikyuu/cpp/boost_serialization-mt.dll +0 -0
- hikyuu/cpp/boost_wserialization-mt.dll +0 -0
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/sqlite3.dll +0 -0
- hikyuu/data/common.py +1 -4
- hikyuu/draw/drawplot/matplotlib_draw.py +3 -2
- hikyuu/flat/Spot.py +0 -139
- hikyuu/flat/SpotList.py +1 -59
- hikyuu/gui/HikyuuTDX.py +6 -5
- hikyuu/gui/data/UseTdxImportToH5Thread.py +1 -1
- hikyuu/hub.py +1 -1
- hikyuu/include/hikyuu/Block.h +2 -2
- hikyuu/include/hikyuu/config.h +3 -0
- hikyuu/include/hikyuu/global/agent/hikyuu/__init__.py +1 -0
- hikyuu/include/hikyuu/global/agent/hikyuu/flat/__init__.py +1 -0
- hikyuu/include/hikyuu/global/agent/spot_generated.h +3 -225
- hikyuu/include/hikyuu/indicator/crt/BLOCKSETNUM.h +1 -9
- hikyuu/include/hikyuu/indicator/crt/INSUM.h +2 -5
- hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +5 -5
- hikyuu/include/hikyuu/trade_sys/condition/ConditionBase.h +1 -1
- hikyuu/include/hikyuu/trade_sys/environment/EnvironmentBase.h +5 -5
- hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +1 -1
- hikyuu/include/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h +1 -1
- hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +24 -1
- hikyuu/include/hikyuu/trade_sys/selector/build_in.h +1 -0
- hikyuu/include/hikyuu/trade_sys/selector/crt/SE_Fixed.h +5 -2
- hikyuu/include/hikyuu/trade_sys/selector/crt/SE_MultiFactor.h +2 -5
- hikyuu/include/hikyuu/trade_sys/selector/crt/SE_Operator.h +43 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/FixedSelector.h +1 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +9 -2
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorAddSelector.h +19 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorAddValueSelector.h +19 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorDivSelector.h +19 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorDivValueSelector.h +19 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorInvertDivValueSelector.h +19 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorInvertSubValueSelector.h +19 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorMulSelector.h +19 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorMulValueSelector.h +19 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorSelector.h +99 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorSubSelector.h +19 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorSubValueSelector.h +19 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorValueSelector.h +77 -0
- hikyuu/include/hikyuu/trade_sys/signal/SignalBase.h +5 -5
- hikyuu/include/hikyuu/trade_sys/slippage/SlippageBase.h +1 -1
- hikyuu/include/hikyuu/trade_sys/stoploss/StoplossBase.h +6 -6
- hikyuu/include/hikyuu/trade_sys/system/System.h +21 -13
- hikyuu/include/hikyuu/utilities/os.h +5 -0
- hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +2 -2
- hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +2 -2
- hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +2 -2
- hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +2 -2
- hikyuu/include/hikyuu/version.h +5 -5
- {hikyuu-2.0.9.dist-info → hikyuu-2.1.0.dist-info}/METADATA +2 -2
- {hikyuu-2.0.9.dist-info → hikyuu-2.1.0.dist-info}/RECORD +61 -48
- {hikyuu-2.0.9.dist-info → hikyuu-2.1.0.dist-info}/top_level.txt +2 -0
- hikyuu/cpp/boost_atomic-mt.dll +0 -0
- hikyuu/cpp/boost_filesystem-mt.dll +0 -0
- {hikyuu-2.0.9.dist-info → hikyuu-2.1.0.dist-info}/LICENSE +0 -0
- {hikyuu-2.0.9.dist-info → hikyuu-2.1.0.dist-info}/WHEEL +0 -0
- {hikyuu-2.0.9.dist-info → hikyuu-2.1.0.dist-info}/entry_points.txt +0 -0
hikyuu/analysis/analysis.py
CHANGED
|
@@ -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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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/core312.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() +
|
|
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/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
|
|
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
|
@@ -675,6 +675,12 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
|
|
675
675
|
|
|
676
676
|
@pyqtSlot()
|
|
677
677
|
def on_start_import_pushButton_clicked(self):
|
|
678
|
+
try:
|
|
679
|
+
self.saveConfig()
|
|
680
|
+
except Exception as e:
|
|
681
|
+
QMessageBox.about(self, "保存配置信息失败", str(e))
|
|
682
|
+
return
|
|
683
|
+
|
|
678
684
|
config = self.getCurrentConfig()
|
|
679
685
|
if config.getboolean('hdf5', 'enable') \
|
|
680
686
|
and (not os.path.lexists(config['hdf5']['dir']) or not os.path.isdir(config['hdf5']['dir'])):
|
|
@@ -686,11 +692,6 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
|
|
686
692
|
or not os.path.isdir(config['tdx']['dir'])):
|
|
687
693
|
QMessageBox.about(self, "错误", "请确认通达信安装目录是否正确!")
|
|
688
694
|
return
|
|
689
|
-
try:
|
|
690
|
-
self.saveConfig()
|
|
691
|
-
except Exception as e:
|
|
692
|
-
QMessageBox.about(self, "保存配置信息失败", str(e))
|
|
693
|
-
return
|
|
694
695
|
|
|
695
696
|
self.import_running = True
|
|
696
697
|
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 == '
|
|
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[
|
|
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
|
hikyuu/include/hikyuu/Block.h
CHANGED
|
@@ -64,14 +64,14 @@ public:
|
|
|
64
64
|
/** 设置板块类别 */
|
|
65
65
|
void category(const string& category) {
|
|
66
66
|
if (!m_data)
|
|
67
|
-
m_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 =
|
|
74
|
+
m_data = make_shared<Data>();
|
|
75
75
|
m_data->m_name = name;
|
|
76
76
|
}
|
|
77
77
|
|
hikyuu/include/hikyuu/config.h
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
// Ensure the included flatbuffers.h is the same version as when this file was
|
|
10
10
|
// generated, otherwise it may not be compatible.
|
|
11
|
-
static_assert(FLATBUFFERS_VERSION_MAJOR ==
|
|
12
|
-
FLATBUFFERS_VERSION_MINOR ==
|
|
13
|
-
FLATBUFFERS_VERSION_REVISION ==
|
|
11
|
+
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
|
|
12
|
+
FLATBUFFERS_VERSION_MINOR == 3 &&
|
|
13
|
+
FLATBUFFERS_VERSION_REVISION == 25,
|
|
14
14
|
"Non-compatible flatbuffers version included");
|
|
15
15
|
|
|
16
16
|
namespace hikyuu {
|
|
@@ -18,49 +18,11 @@ namespace flat {
|
|
|
18
18
|
|
|
19
19
|
struct Spot;
|
|
20
20
|
struct SpotBuilder;
|
|
21
|
-
struct SpotT;
|
|
22
21
|
|
|
23
22
|
struct SpotList;
|
|
24
23
|
struct SpotListBuilder;
|
|
25
|
-
struct SpotListT;
|
|
26
|
-
|
|
27
|
-
struct SpotT : public ::flatbuffers::NativeTable {
|
|
28
|
-
typedef Spot TableType;
|
|
29
|
-
std::string market{};
|
|
30
|
-
std::string code{};
|
|
31
|
-
std::string name{};
|
|
32
|
-
std::string datetime{};
|
|
33
|
-
double yesterday_close = 0.0;
|
|
34
|
-
double open = 0.0;
|
|
35
|
-
double high = 0.0;
|
|
36
|
-
double low = 0.0;
|
|
37
|
-
double close = 0.0;
|
|
38
|
-
double amount = 0.0;
|
|
39
|
-
double volume = 0.0;
|
|
40
|
-
double bid1 = 0.0;
|
|
41
|
-
double bid1_amount = 0.0;
|
|
42
|
-
double bid2 = 0.0;
|
|
43
|
-
double bid2_amount = 0.0;
|
|
44
|
-
double bid3 = 0.0;
|
|
45
|
-
double bid3_amount = 0.0;
|
|
46
|
-
double bid4 = 0.0;
|
|
47
|
-
double bid4_amount = 0.0;
|
|
48
|
-
double bid5 = 0.0;
|
|
49
|
-
double bid5_amount = 0.0;
|
|
50
|
-
double ask1 = 0.0;
|
|
51
|
-
double ask1_amount = 0.0;
|
|
52
|
-
double ask2 = 0.0;
|
|
53
|
-
double ask2_amount = 0.0;
|
|
54
|
-
double ask3 = 0.0;
|
|
55
|
-
double ask3_amount = 0.0;
|
|
56
|
-
double ask4 = 0.0;
|
|
57
|
-
double ask4_amount = 0.0;
|
|
58
|
-
double ask5 = 0.0;
|
|
59
|
-
double ask5_amount = 0.0;
|
|
60
|
-
};
|
|
61
24
|
|
|
62
25
|
struct Spot FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
|
63
|
-
typedef SpotT NativeTableType;
|
|
64
26
|
typedef SpotBuilder Builder;
|
|
65
27
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
|
66
28
|
VT_MARKET = 4,
|
|
@@ -227,9 +189,6 @@ struct Spot FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
|
|
227
189
|
VerifyField<double>(verifier, VT_ASK5_AMOUNT, 8) &&
|
|
228
190
|
verifier.EndTable();
|
|
229
191
|
}
|
|
230
|
-
SpotT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
|
231
|
-
void UnPackTo(SpotT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
|
232
|
-
static ::flatbuffers::Offset<Spot> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const SpotT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
|
233
192
|
};
|
|
234
193
|
|
|
235
194
|
struct SpotBuilder {
|
|
@@ -480,19 +439,7 @@ inline ::flatbuffers::Offset<Spot> CreateSpotDirect(
|
|
|
480
439
|
ask5_amount);
|
|
481
440
|
}
|
|
482
441
|
|
|
483
|
-
::flatbuffers::Offset<Spot> CreateSpot(::flatbuffers::FlatBufferBuilder &_fbb, const SpotT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
|
484
|
-
|
|
485
|
-
struct SpotListT : public ::flatbuffers::NativeTable {
|
|
486
|
-
typedef SpotList TableType;
|
|
487
|
-
std::vector<std::unique_ptr<hikyuu::flat::SpotT>> spot{};
|
|
488
|
-
SpotListT() = default;
|
|
489
|
-
SpotListT(const SpotListT &o);
|
|
490
|
-
SpotListT(SpotListT&&) FLATBUFFERS_NOEXCEPT = default;
|
|
491
|
-
SpotListT &operator=(SpotListT o) FLATBUFFERS_NOEXCEPT;
|
|
492
|
-
};
|
|
493
|
-
|
|
494
442
|
struct SpotList FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
|
495
|
-
typedef SpotListT NativeTableType;
|
|
496
443
|
typedef SpotListBuilder Builder;
|
|
497
444
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
|
498
445
|
VT_SPOT = 4
|
|
@@ -507,9 +454,6 @@ struct SpotList FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
|
|
507
454
|
verifier.VerifyVectorOfTables(spot()) &&
|
|
508
455
|
verifier.EndTable();
|
|
509
456
|
}
|
|
510
|
-
SpotListT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
|
511
|
-
void UnPackTo(SpotListT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
|
512
|
-
static ::flatbuffers::Offset<SpotList> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const SpotListT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
|
513
457
|
};
|
|
514
458
|
|
|
515
459
|
struct SpotListBuilder {
|
|
@@ -547,160 +491,6 @@ inline ::flatbuffers::Offset<SpotList> CreateSpotListDirect(
|
|
|
547
491
|
spot__);
|
|
548
492
|
}
|
|
549
493
|
|
|
550
|
-
::flatbuffers::Offset<SpotList> CreateSpotList(::flatbuffers::FlatBufferBuilder &_fbb, const SpotListT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
|
551
|
-
|
|
552
|
-
inline SpotT *Spot::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
|
553
|
-
auto _o = std::unique_ptr<SpotT>(new SpotT());
|
|
554
|
-
UnPackTo(_o.get(), _resolver);
|
|
555
|
-
return _o.release();
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
inline void Spot::UnPackTo(SpotT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
|
559
|
-
(void)_o;
|
|
560
|
-
(void)_resolver;
|
|
561
|
-
{ auto _e = market(); if (_e) _o->market = _e->str(); }
|
|
562
|
-
{ auto _e = code(); if (_e) _o->code = _e->str(); }
|
|
563
|
-
{ auto _e = name(); if (_e) _o->name = _e->str(); }
|
|
564
|
-
{ auto _e = datetime(); if (_e) _o->datetime = _e->str(); }
|
|
565
|
-
{ auto _e = yesterday_close(); _o->yesterday_close = _e; }
|
|
566
|
-
{ auto _e = open(); _o->open = _e; }
|
|
567
|
-
{ auto _e = high(); _o->high = _e; }
|
|
568
|
-
{ auto _e = low(); _o->low = _e; }
|
|
569
|
-
{ auto _e = close(); _o->close = _e; }
|
|
570
|
-
{ auto _e = amount(); _o->amount = _e; }
|
|
571
|
-
{ auto _e = volume(); _o->volume = _e; }
|
|
572
|
-
{ auto _e = bid1(); _o->bid1 = _e; }
|
|
573
|
-
{ auto _e = bid1_amount(); _o->bid1_amount = _e; }
|
|
574
|
-
{ auto _e = bid2(); _o->bid2 = _e; }
|
|
575
|
-
{ auto _e = bid2_amount(); _o->bid2_amount = _e; }
|
|
576
|
-
{ auto _e = bid3(); _o->bid3 = _e; }
|
|
577
|
-
{ auto _e = bid3_amount(); _o->bid3_amount = _e; }
|
|
578
|
-
{ auto _e = bid4(); _o->bid4 = _e; }
|
|
579
|
-
{ auto _e = bid4_amount(); _o->bid4_amount = _e; }
|
|
580
|
-
{ auto _e = bid5(); _o->bid5 = _e; }
|
|
581
|
-
{ auto _e = bid5_amount(); _o->bid5_amount = _e; }
|
|
582
|
-
{ auto _e = ask1(); _o->ask1 = _e; }
|
|
583
|
-
{ auto _e = ask1_amount(); _o->ask1_amount = _e; }
|
|
584
|
-
{ auto _e = ask2(); _o->ask2 = _e; }
|
|
585
|
-
{ auto _e = ask2_amount(); _o->ask2_amount = _e; }
|
|
586
|
-
{ auto _e = ask3(); _o->ask3 = _e; }
|
|
587
|
-
{ auto _e = ask3_amount(); _o->ask3_amount = _e; }
|
|
588
|
-
{ auto _e = ask4(); _o->ask4 = _e; }
|
|
589
|
-
{ auto _e = ask4_amount(); _o->ask4_amount = _e; }
|
|
590
|
-
{ auto _e = ask5(); _o->ask5 = _e; }
|
|
591
|
-
{ auto _e = ask5_amount(); _o->ask5_amount = _e; }
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
inline ::flatbuffers::Offset<Spot> Spot::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const SpotT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
|
595
|
-
return CreateSpot(_fbb, _o, _rehasher);
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
inline ::flatbuffers::Offset<Spot> CreateSpot(::flatbuffers::FlatBufferBuilder &_fbb, const SpotT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
|
599
|
-
(void)_rehasher;
|
|
600
|
-
(void)_o;
|
|
601
|
-
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const SpotT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
|
602
|
-
auto _market = _o->market.empty() ? 0 : _fbb.CreateString(_o->market);
|
|
603
|
-
auto _code = _o->code.empty() ? 0 : _fbb.CreateString(_o->code);
|
|
604
|
-
auto _name = _o->name.empty() ? 0 : _fbb.CreateString(_o->name);
|
|
605
|
-
auto _datetime = _o->datetime.empty() ? 0 : _fbb.CreateString(_o->datetime);
|
|
606
|
-
auto _yesterday_close = _o->yesterday_close;
|
|
607
|
-
auto _open = _o->open;
|
|
608
|
-
auto _high = _o->high;
|
|
609
|
-
auto _low = _o->low;
|
|
610
|
-
auto _close = _o->close;
|
|
611
|
-
auto _amount = _o->amount;
|
|
612
|
-
auto _volume = _o->volume;
|
|
613
|
-
auto _bid1 = _o->bid1;
|
|
614
|
-
auto _bid1_amount = _o->bid1_amount;
|
|
615
|
-
auto _bid2 = _o->bid2;
|
|
616
|
-
auto _bid2_amount = _o->bid2_amount;
|
|
617
|
-
auto _bid3 = _o->bid3;
|
|
618
|
-
auto _bid3_amount = _o->bid3_amount;
|
|
619
|
-
auto _bid4 = _o->bid4;
|
|
620
|
-
auto _bid4_amount = _o->bid4_amount;
|
|
621
|
-
auto _bid5 = _o->bid5;
|
|
622
|
-
auto _bid5_amount = _o->bid5_amount;
|
|
623
|
-
auto _ask1 = _o->ask1;
|
|
624
|
-
auto _ask1_amount = _o->ask1_amount;
|
|
625
|
-
auto _ask2 = _o->ask2;
|
|
626
|
-
auto _ask2_amount = _o->ask2_amount;
|
|
627
|
-
auto _ask3 = _o->ask3;
|
|
628
|
-
auto _ask3_amount = _o->ask3_amount;
|
|
629
|
-
auto _ask4 = _o->ask4;
|
|
630
|
-
auto _ask4_amount = _o->ask4_amount;
|
|
631
|
-
auto _ask5 = _o->ask5;
|
|
632
|
-
auto _ask5_amount = _o->ask5_amount;
|
|
633
|
-
return hikyuu::flat::CreateSpot(
|
|
634
|
-
_fbb,
|
|
635
|
-
_market,
|
|
636
|
-
_code,
|
|
637
|
-
_name,
|
|
638
|
-
_datetime,
|
|
639
|
-
_yesterday_close,
|
|
640
|
-
_open,
|
|
641
|
-
_high,
|
|
642
|
-
_low,
|
|
643
|
-
_close,
|
|
644
|
-
_amount,
|
|
645
|
-
_volume,
|
|
646
|
-
_bid1,
|
|
647
|
-
_bid1_amount,
|
|
648
|
-
_bid2,
|
|
649
|
-
_bid2_amount,
|
|
650
|
-
_bid3,
|
|
651
|
-
_bid3_amount,
|
|
652
|
-
_bid4,
|
|
653
|
-
_bid4_amount,
|
|
654
|
-
_bid5,
|
|
655
|
-
_bid5_amount,
|
|
656
|
-
_ask1,
|
|
657
|
-
_ask1_amount,
|
|
658
|
-
_ask2,
|
|
659
|
-
_ask2_amount,
|
|
660
|
-
_ask3,
|
|
661
|
-
_ask3_amount,
|
|
662
|
-
_ask4,
|
|
663
|
-
_ask4_amount,
|
|
664
|
-
_ask5,
|
|
665
|
-
_ask5_amount);
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
inline SpotListT::SpotListT(const SpotListT &o) {
|
|
669
|
-
spot.reserve(o.spot.size());
|
|
670
|
-
for (const auto &spot_ : o.spot) { spot.emplace_back((spot_) ? new hikyuu::flat::SpotT(*spot_) : nullptr); }
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
inline SpotListT &SpotListT::operator=(SpotListT o) FLATBUFFERS_NOEXCEPT {
|
|
674
|
-
std::swap(spot, o.spot);
|
|
675
|
-
return *this;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
inline SpotListT *SpotList::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
|
679
|
-
auto _o = std::unique_ptr<SpotListT>(new SpotListT());
|
|
680
|
-
UnPackTo(_o.get(), _resolver);
|
|
681
|
-
return _o.release();
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
inline void SpotList::UnPackTo(SpotListT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
|
685
|
-
(void)_o;
|
|
686
|
-
(void)_resolver;
|
|
687
|
-
{ auto _e = spot(); if (_e) { _o->spot.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->spot[_i]) { _e->Get(_i)->UnPackTo(_o->spot[_i].get(), _resolver); } else { _o->spot[_i] = std::unique_ptr<hikyuu::flat::SpotT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->spot.resize(0); } }
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
inline ::flatbuffers::Offset<SpotList> SpotList::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const SpotListT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
|
691
|
-
return CreateSpotList(_fbb, _o, _rehasher);
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
inline ::flatbuffers::Offset<SpotList> CreateSpotList(::flatbuffers::FlatBufferBuilder &_fbb, const SpotListT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
|
695
|
-
(void)_rehasher;
|
|
696
|
-
(void)_o;
|
|
697
|
-
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const SpotListT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
|
698
|
-
auto _spot = _o->spot.size() ? _fbb.CreateVector<::flatbuffers::Offset<hikyuu::flat::Spot>> (_o->spot.size(), [](size_t i, _VectorArgs *__va) { return CreateSpot(*__va->__fbb, __va->__o->spot[i].get(), __va->__rehasher); }, &_va ) : 0;
|
|
699
|
-
return hikyuu::flat::CreateSpotList(
|
|
700
|
-
_fbb,
|
|
701
|
-
_spot);
|
|
702
|
-
}
|
|
703
|
-
|
|
704
494
|
inline const hikyuu::flat::SpotList *GetSpotList(const void *buf) {
|
|
705
495
|
return ::flatbuffers::GetRoot<hikyuu::flat::SpotList>(buf);
|
|
706
496
|
}
|
|
@@ -731,18 +521,6 @@ inline void FinishSizePrefixedSpotListBuffer(
|
|
|
731
521
|
fbb.FinishSizePrefixed(root);
|
|
732
522
|
}
|
|
733
523
|
|
|
734
|
-
inline std::unique_ptr<hikyuu::flat::SpotListT> UnPackSpotList(
|
|
735
|
-
const void *buf,
|
|
736
|
-
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
|
737
|
-
return std::unique_ptr<hikyuu::flat::SpotListT>(GetSpotList(buf)->UnPack(res));
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
inline std::unique_ptr<hikyuu::flat::SpotListT> UnPackSizePrefixedSpotList(
|
|
741
|
-
const void *buf,
|
|
742
|
-
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
|
743
|
-
return std::unique_ptr<hikyuu::flat::SpotListT>(GetSizePrefixedSpotList(buf)->UnPack(res));
|
|
744
|
-
}
|
|
745
|
-
|
|
746
524
|
} // namespace flat
|
|
747
525
|
} // namespace hikyuu
|
|
748
526
|
|
|
@@ -18,14 +18,6 @@ namespace hku {
|
|
|
18
18
|
* @return Indicator
|
|
19
19
|
*/
|
|
20
20
|
Indicator HKU_API BLOCKSETNUM(const Block& blk, const KQuery& query);
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 横向统计(返回板块股个数)
|
|
24
|
-
* @param category 板块分类
|
|
25
|
-
* @param name 板块名称
|
|
26
|
-
* @param query 统计范围
|
|
27
|
-
* @return Indicator
|
|
28
|
-
*/
|
|
29
|
-
Indicator HKU_API BLOCKSETNUM(const string& category, const string& name, const KQuery& query);
|
|
21
|
+
Indicator HKU_API BLOCKSETNUM(const Block& blk);
|
|
30
22
|
|
|
31
23
|
} // namespace hku
|