hikyuu 2.0.9__cp311-none-win_amd64.whl → 2.1.1__cp311-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/core311.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
@@ -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 == 23 &&
12
- FLATBUFFERS_VERSION_MINOR == 5 &&
13
- FLATBUFFERS_VERSION_REVISION == 26,
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
@@ -23,14 +23,11 @@ Indicator HKU_API INSUM(const Block& block, const KQuery& query, const Indicator
23
23
 
24
24
  /**
25
25
  * 返回板块各成分该指标相应输出按计算类型得到的计算值.计算类型:0-累加,1-平均数,2-最大值,3-最小值.
26
- * @param category 板块类别
27
- * @param category 板块名称
28
- * @param query 指定范围
26
+ * @param block 指定板块
29
27
  * @param ind 指定指标
30
28
  * @param mode 计算类型:0-累加,1-平均数,2-最大值,3-最小值.
31
29
  * @return Indicator
32
30
  */
33
- Indicator HKU_API INSUM(const string& category, const string& name, const KQuery& query,
34
- const Indicator& ind, int mode);
31
+ Indicator HKU_API INSUM(const Block& block, const Indicator& ind, int mode);
35
32
 
36
33
  } // namespace hku
@@ -7,6 +7,7 @@
7
7
 
8
8
  #pragma once
9
9
 
10
+ #if 0
10
11
  #include <httplib.h>
11
12
  #include "../trade_manage/TradeManagerBase.h"
12
13
 
@@ -426,4 +427,5 @@ inline TMPtr crtAccountTM(const string& name, const string& pwd) {
426
427
  return std::make_shared<AccountTradeManager>(name, pwd);
427
428
  }
428
429
 
429
- } // namespace hku
430
+ } // namespace hku
431
+ #endif
@@ -175,11 +175,11 @@ private: \
175
175
  #define ALLOCATEFUNDS_NO_PRIVATE_MEMBER_SERIALIZATION
176
176
  #endif
177
177
 
178
- #define ALLOCATEFUNDS_IMP(classname) \
179
- public: \
180
- virtual AFPtr _clone() override { \
181
- return AFPtr(new classname()); \
182
- } \
178
+ #define ALLOCATEFUNDS_IMP(classname) \
179
+ public: \
180
+ virtual AFPtr _clone() override { \
181
+ return std::make_shared<classname>(); \
182
+ } \
183
183
  virtual SystemWeightList _allocateWeight(const Datetime&, const SystemWeightList&) override;
184
184
 
185
185
  typedef shared_ptr<AllocateFundsBase> AllocateFundsPtr;
@@ -180,7 +180,7 @@ typedef shared_ptr<ConditionBase> CNPtr;
180
180
  #define CONDITION_IMP(classname) \
181
181
  public: \
182
182
  virtual ConditionPtr _clone() { \
183
- return ConditionPtr(new classname()); \
183
+ return std::make_shared<classname>(); \
184
184
  } \
185
185
  virtual void _calculate();
186
186
 
@@ -151,11 +151,11 @@ private: \
151
151
  typedef shared_ptr<EnvironmentBase> EnvironmentPtr;
152
152
  typedef shared_ptr<EnvironmentBase> EVPtr;
153
153
 
154
- #define ENVIRONMENT_IMP(classname) \
155
- public: \
156
- virtual EnvironmentPtr _clone() { \
157
- return EnvironmentPtr(new classname()); \
158
- } \
154
+ #define ENVIRONMENT_IMP(classname) \
155
+ public: \
156
+ virtual EnvironmentPtr _clone() { \
157
+ return std::make_shared<classname>(); \
158
+ } \
159
159
  virtual void _calculate();
160
160
 
161
161
  /**
@@ -209,7 +209,7 @@ typedef shared_ptr<MoneyManagerBase> MMPtr;
209
209
  #define MONEY_MANAGER_IMP(classname) \
210
210
  public: \
211
211
  virtual MoneyManagerPtr _clone() override { \
212
- return MoneyManagerPtr(new classname()); \
212
+ return std::make_shared<classname>(); \
213
213
  } \
214
214
  virtual double _getBuyNumber(const Datetime& datetime, const Stock& stock, price_t price, \
215
215
  price_t risk, SystemPart from) override;
@@ -141,7 +141,7 @@ private: \
141
141
  #define PROFITGOAL_IMP(classname) \
142
142
  public: \
143
143
  virtual ProfitGoalPtr _clone() override { \
144
- return ProfitGoalPtr(new classname()); \
144
+ return std::make_shared<classname>(); \
145
145
  } \
146
146
  virtual price_t getGoal(const Datetime&, price_t) override; \
147
147
  virtual void _calculate() override;
@@ -61,6 +61,20 @@ public:
61
61
  */
62
62
  void addStockList(const StockList& stkList, const SystemPtr& protoSys);
63
63
 
64
+ /**
65
+ * 直接加入已有系统策略示例
66
+ * @note 应该已经绑定 stock
67
+ * @param sys
68
+ */
69
+ void addSystem(const SYSPtr& sys);
70
+
71
+ /**
72
+ * 直接加入已有系统策略示例
73
+ * @note 应该已经绑定 stock
74
+ * @param sys
75
+ */
76
+ void addSystemList(const SystemList& sys);
77
+
64
78
  /**
65
79
  * @brief 获取原型系统列表
66
80
  * @return const SystemList&
@@ -101,9 +115,18 @@ public:
101
115
 
102
116
  virtual bool isMatchAF(const AFPtr& af) = 0;
103
117
 
118
+ /** 用于逻辑运算的子类中添加原型系统,一般不需要子类实现 */
119
+ virtual void _addSystem(const SYSPtr& sys) {}
120
+
121
+ /** 用于逻辑运算的子类中添加原型系统,一般不需要子类实现 */
122
+ virtual void _removeAll() {}
123
+
104
124
  /* 仅供PF调用,由PF通知其实际运行的系统列表,并启动计算 */
105
125
  void calculate(const SystemList& pf_realSysList, const KQuery& query);
106
126
 
127
+ /* 仅供PF调用,建立实际系统到原型系统映射 */
128
+ virtual void bindRealToProto(const SYSPtr& real, const SYSPtr& proto) {}
129
+
107
130
  void calculate_proto(const KQuery& query);
108
131
 
109
132
  private:
@@ -175,7 +198,7 @@ private: \
175
198
  #define SELECTOR_IMP(classname) \
176
199
  public: \
177
200
  virtual SelectorPtr _clone() override { \
178
- return SelectorPtr(new classname()); \
201
+ return std::make_shared<classname>(); \
179
202
  } \
180
203
  virtual SystemWeightList getSelected(Datetime date) override; \
181
204
  virtual bool isMatchAF(const AFPtr& af) override; \
@@ -11,6 +11,7 @@
11
11
 
12
12
  #include "crt/SE_Fixed.h"
13
13
  #include "crt/SE_MultiFactor.h"
14
+ #include "crt/SE_Operator.h"
14
15
  #include "crt/SE_Signal.h"
15
16
 
16
17
  #endif /* TRADE_SYS_SELECTOR_BUILD_IN_H_ */
@@ -15,20 +15,23 @@ namespace hku {
15
15
 
16
16
  /**
17
17
  * @brief 固定选择器,每天都选择指定的交易系统
18
+ * @param weight 固定权重
18
19
  * @return SelectorPtr
19
20
  * @ingroup Selector
20
21
  */
21
- SelectorPtr HKU_API SE_Fixed();
22
+ SelectorPtr HKU_API SE_Fixed(double weight = 1.0);
22
23
 
23
24
  /**
24
25
  * @brief 固定选择器,每天都选择指定的交易系统
25
26
  * @details 对指定的每个股票以原型系统创建相应的交易系统
26
27
  * @param stock_list 指定的股票列表
27
28
  * @param sys 原型系统
29
+ * @param weight 固定权重
28
30
  * @return SelectorPtr
29
31
  * @ingroup Selector
30
32
  */
31
- SelectorPtr HKU_API SE_Fixed(const StockList& stock_list, const SystemPtr& sys);
33
+ SelectorPtr HKU_API SE_Fixed(const StockList& stock_list, const SystemPtr& sys,
34
+ double weight = 1.0);
32
35
 
33
36
  } /* namespace hku */
34
37
 
@@ -24,9 +24,7 @@ SelectorPtr HKU_API SE_MultiFactor(const MFPtr& mf, int topn = 10);
24
24
  /**
25
25
  * 基于 MultiFactor 选股算法
26
26
  * @param src_inds 原始因子公式
27
- * @param stks 证券列表
28
- * @param query 查询条件
29
- * @param topn 只选取时间截面中前 topn 个系统
27
+ * @param topn 只选取时间截面中前 topn 个系统,小于等于0时代表不限制
30
28
  * @param ic_n ic 对应的 ic_n 日收益率
31
29
  * @param ic_rolling_n 计算滚动 IC (即 IC 的 n 日移动平均)周期
32
30
  * @param ref_stk 参照对比证券,未指定时,默认使用 sh000300 沪深300指数
@@ -34,8 +32,7 @@ SelectorPtr HKU_API SE_MultiFactor(const MFPtr& mf, int topn = 10);
34
32
  * @return SelectorPtr
35
33
  * @ingroup Selector
36
34
  */
37
- SelectorPtr HKU_API SE_MultiFactor(const IndicatorList& src_inds, const StockList& stks,
38
- const KQuery& query, int topn = 10, int ic_n = 5,
35
+ SelectorPtr HKU_API SE_MultiFactor(const IndicatorList& src_inds, int topn = 10, int ic_n = 5,
39
36
  int ic_rolling_n = 120, const Stock& ref_stk = Stock(),
40
37
  const string& mode = "MF_ICIRWeight");
41
38
 
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Copyright (c) 2024 hikyuu.org
3
+ *
4
+ * Created on: 2024-05-27
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "../SelectorBase.h"
11
+
12
+ namespace hku {
13
+
14
+ HKU_API SelectorPtr operator+(const SelectorPtr& se1, const SelectorPtr& se2);
15
+ HKU_API SelectorPtr operator-(const SelectorPtr& se1, const SelectorPtr& se2);
16
+ HKU_API SelectorPtr operator*(const SelectorPtr& se1, const SelectorPtr& se2);
17
+ HKU_API SelectorPtr operator/(const SelectorPtr& se1, const SelectorPtr& se2);
18
+
19
+ inline SelectorPtr operator&(const SelectorPtr& se1, const SelectorPtr& se2) {
20
+ return se1 * se2;
21
+ }
22
+
23
+ inline SelectorPtr operator|(const SelectorPtr& se1, const SelectorPtr& se2) {
24
+ return se1 + se2;
25
+ }
26
+
27
+ HKU_API SelectorPtr operator+(const SelectorPtr& se, double value);
28
+ inline SelectorPtr operator+(double value, const SelectorPtr& se) {
29
+ return se + value;
30
+ }
31
+
32
+ HKU_API SelectorPtr operator-(const SelectorPtr& se, double value);
33
+ HKU_API SelectorPtr operator-(double value, const SelectorPtr& se);
34
+
35
+ HKU_API SelectorPtr operator*(const SelectorPtr& se, double value);
36
+ inline SelectorPtr operator*(double value, const SelectorPtr& se) {
37
+ return se * value;
38
+ }
39
+
40
+ HKU_API SelectorPtr operator/(const SelectorPtr& se, double value);
41
+ HKU_API SelectorPtr operator/(double value, const SelectorPtr& se);
42
+
43
+ } // namespace hku
@@ -19,6 +19,7 @@ class FixedSelector : public SelectorBase {
19
19
 
20
20
  public:
21
21
  FixedSelector();
22
+ FixedSelector(double weight);
22
23
  virtual ~FixedSelector();
23
24
  };
24
25
 
@@ -25,18 +25,25 @@ public:
25
25
  virtual bool isMatchAF(const AFPtr& af) override;
26
26
  virtual void _calculate() override;
27
27
 
28
+ void setIndicators(const IndicatorList& inds) {
29
+ HKU_ASSERT(!inds.empty());
30
+ m_inds = inds;
31
+ }
32
+
28
33
  private:
34
+ IndicatorList m_inds;
29
35
  MFPtr m_mf;
30
36
  unordered_map<Stock, SYSPtr> m_stk_sys_dict;
31
37
 
32
38
  //============================================
33
- // 序列化支持
34
- //============================================
39
+ // 序列化支持
40
+ //============================================
35
41
  #if HKU_SUPPORT_SERIALIZATION
36
42
  friend class boost::serialization::access;
37
43
  template <class Archive>
38
44
  void serialize(Archive& ar, const unsigned int version) {
39
45
  ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(SelectorBase);
46
+ ar& BOOST_SERIALIZATION_NVP(m_inds);
40
47
  ar& BOOST_SERIALIZATION_NVP(m_mf);
41
48
  }
42
49
  #endif
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright (c) 2024 hikyuu.org
3
+ *
4
+ * Created on: 2024-05-27
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "OperatorSelector.h"
11
+
12
+ namespace hku {
13
+
14
+ class HKU_API OperatorAddSelector : public OperatorSelector {
15
+ OPERATOR_SELECTOR_IMP(OperatorAddSelector, "SE_Add")
16
+ OPERATOR_SELECTOR_SERIALIZATION
17
+ };
18
+
19
+ } // namespace hku
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright (c) 2024 hikyuu.org
3
+ *
4
+ * Created on: 2024-05-27
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "OperatorValueSelector.h"
11
+
12
+ namespace hku {
13
+
14
+ class HKU_API OperatorAddValueSelector : public OperatorValueSelector {
15
+ OPERATOR_VALUE_SELECTOR_IMP(OperatorAddValueSelector, "SE_AddValue")
16
+ OPERATOR_VALUE_SELECTOR_SERIALIZATION
17
+ };
18
+
19
+ } // namespace hku
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright (c) 2024 hikyuu.org
3
+ *
4
+ * Created on: 2024-05-27
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "OperatorSelector.h"
11
+
12
+ namespace hku {
13
+
14
+ class HKU_API OperatorDivSelector : public OperatorSelector {
15
+ OPERATOR_SELECTOR_IMP(OperatorDivSelector, "SE_Div")
16
+ OPERATOR_SELECTOR_SERIALIZATION
17
+ };
18
+
19
+ } // namespace hku
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright (c) 2024 hikyuu.org
3
+ *
4
+ * Created on: 2024-05-27
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "OperatorValueSelector.h"
11
+
12
+ namespace hku {
13
+
14
+ class HKU_API OperatorDivValueSelector : public OperatorValueSelector {
15
+ OPERATOR_VALUE_SELECTOR_IMP(OperatorDivValueSelector, "SE_DivValue")
16
+ OPERATOR_VALUE_SELECTOR_SERIALIZATION
17
+ };
18
+
19
+ } // namespace hku