hikyuu 2.7.0__py3-none-manylinux2014_aarch64.whl → 2.7.3__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.
- hikyuu/__init__.py +25 -7
- hikyuu/__init__.pyi +23 -12
- hikyuu/analysis/__init__.pyi +6 -1
- hikyuu/analysis/analysis.pyi +7 -2
- hikyuu/core.pyi +8 -3
- hikyuu/cpp/core310.pyi +94 -24
- hikyuu/cpp/core310.so +0 -0
- hikyuu/cpp/core311.pyi +94 -24
- hikyuu/cpp/core311.so +0 -0
- hikyuu/cpp/core312.pyi +94 -24
- hikyuu/cpp/core312.so +0 -0
- hikyuu/cpp/core313.pyi +94 -24
- hikyuu/cpp/core313.so +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu_plugin.mo +0 -0
- hikyuu/cpp/libboost_atomic.so +0 -0
- hikyuu/cpp/libboost_atomic.so.1.90.0 +0 -0
- hikyuu/cpp/{libboost_charconv-mt.so → libboost_charconv.so} +0 -0
- hikyuu/cpp/{libboost_charconv-mt.so.1.88.0 → libboost_charconv.so.1.90.0} +0 -0
- hikyuu/cpp/libboost_chrono.so +0 -0
- hikyuu/cpp/libboost_chrono.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_container.so +0 -0
- hikyuu/cpp/libboost_container.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_date_time.so +0 -0
- hikyuu/cpp/libboost_date_time.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_locale.so +0 -0
- hikyuu/cpp/libboost_locale.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_random.so +0 -0
- hikyuu/cpp/libboost_random.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_serialization.so +0 -0
- hikyuu/cpp/libboost_serialization.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_thread.so +0 -0
- hikyuu/cpp/libboost_thread.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_wserialization.so +0 -0
- hikyuu/cpp/libboost_wserialization.so.1.90.0 +0 -0
- hikyuu/cpp/libhikyuu.so +0 -0
- hikyuu/cpp/libsqlite3.so +0 -0
- hikyuu/data/clickhouse_upgrade/0001.sql +2 -0
- hikyuu/data/common_clickhouse.py +1 -3
- hikyuu/data/download_block.py +1 -1
- hikyuu/data/hku_config_template.py +30 -3
- hikyuu/data/mysql_upgrade/0029.sql +2 -0
- hikyuu/data/pytdx_to_clickhouse.py +86 -32
- hikyuu/data/pytdx_to_h5.py +73 -28
- hikyuu/data/pytdx_to_mysql.py +65 -21
- hikyuu/data/pytdx_weight_to_clickhouse.py +2 -0
- hikyuu/data/pytdx_weight_to_mysql.py +2 -0
- hikyuu/data/pytdx_weight_to_sqlite.py +2 -0
- hikyuu/data/sqlite_upgrade/0029.sql +4 -0
- hikyuu/data/tdx_to_clickhouse.py +2 -2
- hikyuu/data/tdx_to_h5.py +11 -11
- hikyuu/data/tdx_to_mysql.py +2 -2
- hikyuu/draw/drawplot/bokeh_draw.pyi +14 -7
- hikyuu/draw/drawplot/echarts_draw.pyi +14 -7
- hikyuu/draw/drawplot/matplotlib_draw.py +8 -2
- hikyuu/draw/drawplot/matplotlib_draw.pyi +14 -7
- hikyuu/extend.pyi +8 -3
- hikyuu/gui/HikyuuTDX.py +42 -3
- hikyuu/gui/data/MainWindow.py +189 -129
- hikyuu/hub.pyi +6 -6
- hikyuu/include/hikyuu/StockManager.h +17 -2
- hikyuu/include/hikyuu/StrategyContext.h +4 -4
- hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/KDataDriver.h +2 -4
- hikyuu/include/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.h +5 -1
- hikyuu/include/hikyuu/data_driver/kdata/sqlite/SQLiteKDataDriver.h +1 -1
- hikyuu/include/hikyuu/global/sysinfo.h +24 -5
- hikyuu/include/hikyuu/indicator/IndicatorImp.h +1 -1
- hikyuu/include/hikyuu/plugin/KDataToClickHouseImporter.h +40 -0
- hikyuu/include/hikyuu/plugin/KDataToMySQLImporter.h +40 -0
- hikyuu/include/hikyuu/plugin/checkdata.h +20 -0
- hikyuu/include/hikyuu/plugin/extind.h +3 -0
- hikyuu/include/hikyuu/plugin/hkuextra.h +2 -0
- hikyuu/include/hikyuu/plugin/interface/CheckDataPluginInterface.h +25 -0
- hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +2 -0
- hikyuu/include/hikyuu/plugin/interface/ImportKDataToClickHousePluginInterface.h +44 -0
- hikyuu/include/hikyuu/plugin/interface/ImportKDataToMySQLPluginInterface.h +42 -0
- hikyuu/include/hikyuu/plugin/interface/plugins.h +6 -0
- hikyuu/include/hikyuu/python/convert_any.h +9 -6
- hikyuu/include/hikyuu/python/pybind_utils.h +1 -1
- hikyuu/include/hikyuu/strategy/Strategy.h +1 -1
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +0 -1
- hikyuu/include/hikyuu/trade_manage/TradeRecord.h +2 -1
- hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/allocatefunds/build_in.h +1 -0
- hikyuu/include/hikyuu/trade_sys/allocatefunds/crt/AF_FixedAmount.h +26 -0
- hikyuu/include/hikyuu/trade_sys/allocatefunds/imp/FixAmountFunds.h +18 -0
- hikyuu/include/hikyuu/trade_sys/condition/ConditionBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/environment/EnvironmentBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/NormalizeBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/ScoresFilterBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +13 -13
- hikyuu/include/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h +9 -11
- hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/signal/SignalBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/slippage/SlippageBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/stoploss/StoplossBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/system/System.h +1 -2
- hikyuu/include/hikyuu/utilities/Log.h +6 -7
- hikyuu/include/hikyuu/utilities/Parameter.h +17 -0
- hikyuu/include/hikyuu/utilities/config.h +28 -0
- hikyuu/include/hikyuu/utilities/plugin/PluginBase.h +17 -2
- hikyuu/include/hikyuu/utilities/plugin/PluginManager.h +41 -22
- hikyuu/include/hikyuu/utilities/thread/GlobalStealThreadPool.h +1 -2
- hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +1 -1
- hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +286 -0
- hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +1 -0
- hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +297 -0
- hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +1 -0
- hikyuu/include/hikyuu/utilities/thread/WorkStealQueue.h +9 -8
- hikyuu/include/hikyuu/utilities/thread/algorithm.h +64 -14
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/plugin/libbacktest.so +0 -0
- hikyuu/plugin/libcheckdata.so +0 -0
- hikyuu/plugin/libclickhousedriver.so +0 -0
- hikyuu/plugin/libdataserver.so +0 -0
- hikyuu/plugin/libdataserver_parquet.so +0 -0
- hikyuu/plugin/libdevice.so +0 -0
- hikyuu/plugin/libextind.so +0 -0
- hikyuu/plugin/libhkuextra.so +0 -0
- hikyuu/plugin/libimport2ch.so +0 -0
- hikyuu/plugin/libimport2hdf5.so +0 -0
- hikyuu/plugin/libimport2mysql.so +0 -0
- hikyuu/plugin/libtmreport.so +0 -0
- hikyuu/trade_manage/__init__.pyi +12 -7
- hikyuu/trade_manage/trade.pyi +12 -7
- hikyuu/trade_sys/trade_sys.py +54 -5
- hikyuu/util/__init__.pyi +1 -1
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.7.0.dist-info → hikyuu-2.7.3.dist-info}/METADATA +10 -4
- {hikyuu-2.7.0.dist-info → hikyuu-2.7.3.dist-info}/RECORD +136 -114
- hikyuu/cpp/libboost_chrono-mt.so +0 -0
- hikyuu/cpp/libboost_chrono-mt.so.1.88.0 +0 -0
- hikyuu/cpp/libboost_date_time-mt.so +0 -0
- hikyuu/cpp/libboost_date_time-mt.so.1.88.0 +0 -0
- hikyuu/cpp/libboost_serialization-mt.so +0 -0
- hikyuu/cpp/libboost_serialization-mt.so.1.88.0 +0 -0
- hikyuu/cpp/libboost_system-mt.so +0 -0
- hikyuu/cpp/libboost_system-mt.so.1.88.0 +0 -0
- hikyuu/cpp/libboost_thread-mt.so +0 -0
- hikyuu/cpp/libboost_thread-mt.so.1.88.0 +0 -0
- hikyuu/cpp/libboost_wserialization-mt.so +0 -0
- hikyuu/cpp/libboost_wserialization-mt.so.1.88.0 +0 -0
- hikyuu/data/pytdx_to_taos.py +0 -736
- {hikyuu-2.7.0.dist-info → hikyuu-2.7.3.dist-info}/WHEEL +0 -0
- {hikyuu-2.7.0.dist-info → hikyuu-2.7.3.dist-info}/entry_points.txt +0 -0
- {hikyuu-2.7.0.dist-info → hikyuu-2.7.3.dist-info}/top_level.txt +0 -0
|
@@ -43,7 +43,7 @@ public:
|
|
|
43
43
|
const KQuery& query) override;
|
|
44
44
|
|
|
45
45
|
private:
|
|
46
|
-
string _getTableName(const string& market, const string& code, KQuery::KType ktype);
|
|
46
|
+
static string _getTableName(const string& market, const string& code, KQuery::KType ktype);
|
|
47
47
|
KRecordList _getKRecordList(const string& market, const string& code,
|
|
48
48
|
const KQuery::KType& kType, size_t start_ix, size_t end_ix);
|
|
49
49
|
KRecordList _getKRecordList(const string& market, const string& code,
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
#include <string>
|
|
11
|
+
#include "hikyuu/utilities/datetime/Datetime.h"
|
|
11
12
|
|
|
12
13
|
#ifndef HKU_API
|
|
13
14
|
#define HKU_API
|
|
@@ -15,6 +16,9 @@
|
|
|
15
16
|
|
|
16
17
|
namespace hku {
|
|
17
18
|
|
|
19
|
+
void sysinfo_init();
|
|
20
|
+
void sysinfo_clean();
|
|
21
|
+
|
|
18
22
|
/**
|
|
19
23
|
* 获取Hikyuu当前版本号
|
|
20
24
|
* @return 版本号
|
|
@@ -34,11 +38,26 @@ std::string HKU_API getVersionWithGit();
|
|
|
34
38
|
*/
|
|
35
39
|
bool HKU_API CanUpgrade();
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
struct HKU_API LatestVersionInfo {
|
|
42
|
+
int version{1003001};
|
|
43
|
+
Datetime release_date;
|
|
44
|
+
std::string remark;
|
|
45
|
+
LatestVersionInfo() = default;
|
|
46
|
+
LatestVersionInfo(const LatestVersionInfo&) = default;
|
|
47
|
+
LatestVersionInfo(LatestVersionInfo&& rhs)
|
|
48
|
+
: version(rhs.version), release_date(rhs.release_date), remark(std::move(rhs.remark)) {}
|
|
49
|
+
LatestVersionInfo& operator=(LatestVersionInfo&& rhs) {
|
|
50
|
+
if (this == &rhs) {
|
|
51
|
+
return *this;
|
|
52
|
+
}
|
|
53
|
+
version = rhs.version;
|
|
54
|
+
release_date = rhs.release_date;
|
|
55
|
+
remark = std::move(rhs.remark);
|
|
56
|
+
return *this;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
LatestVersionInfo HKU_API getLatestVersionInfo();
|
|
42
61
|
|
|
43
62
|
/** 发送反馈信息 */
|
|
44
63
|
void HKU_API sendFeedback();
|
|
@@ -338,8 +338,8 @@ private:
|
|
|
338
338
|
|
|
339
339
|
size_t act_result_num = 0;
|
|
340
340
|
ar& BOOST_SERIALIZATION_NVP(act_result_num);
|
|
341
|
+
_readyBuffer(0, act_result_num);
|
|
341
342
|
for (size_t i = 0; i < act_result_num; ++i) {
|
|
342
|
-
m_pBuffer[i] = new vector<value_t>();
|
|
343
343
|
size_t count = 0;
|
|
344
344
|
ar& bs::make_nvp<size_t>(format("count_{}", i).c_str(), count);
|
|
345
345
|
vector<value_t>& values = *m_pBuffer[i];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-05-06
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/DataType.h"
|
|
11
|
+
#include "interface/ImportKDataToClickHousePluginInterface.h"
|
|
12
|
+
|
|
13
|
+
namespace hku {
|
|
14
|
+
|
|
15
|
+
class HKU_API KDataToClickHouseImporter {
|
|
16
|
+
public:
|
|
17
|
+
KDataToClickHouseImporter();
|
|
18
|
+
virtual ~KDataToClickHouseImporter();
|
|
19
|
+
|
|
20
|
+
bool setConfig(const string& host, int port, const string& user, const string& pwd);
|
|
21
|
+
|
|
22
|
+
Datetime getLastDatetime(const string& market, const string& code, const KQuery::KType& ktype);
|
|
23
|
+
|
|
24
|
+
void addKRecordList(const string& market, const string& code, const vector<KRecord>& krecords,
|
|
25
|
+
const KQuery::KType& ktype);
|
|
26
|
+
|
|
27
|
+
void addTimeLineList(const string& market, const string& code, const TimeLineList& timeline);
|
|
28
|
+
|
|
29
|
+
void addTransList(const string& market, const string& code, const TransRecordList& translist);
|
|
30
|
+
|
|
31
|
+
void updateIndex(const string& market, const string& code, const KQuery::KType& ktype);
|
|
32
|
+
|
|
33
|
+
void remove(const string& market, const string& code, const KQuery::KType& ktype,
|
|
34
|
+
Datetime start);
|
|
35
|
+
|
|
36
|
+
private:
|
|
37
|
+
ImportKDataToClickHousePluginInterface* m_plugin{nullptr};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
} // namespace hku
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-05-06
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/DataType.h"
|
|
11
|
+
#include "interface/ImportKDataToMySQLPluginInterface.h"
|
|
12
|
+
|
|
13
|
+
namespace hku {
|
|
14
|
+
|
|
15
|
+
class HKU_API KDataToMySQLImporter {
|
|
16
|
+
public:
|
|
17
|
+
KDataToMySQLImporter();
|
|
18
|
+
virtual ~KDataToMySQLImporter();
|
|
19
|
+
|
|
20
|
+
bool setConfig(const string& host, int port, const string& user, const string& pwd);
|
|
21
|
+
|
|
22
|
+
Datetime getLastDatetime(const string& market, const string& code, const KQuery::KType& ktype);
|
|
23
|
+
|
|
24
|
+
void addKRecordList(const string& market, const string& code, const vector<KRecord>& krecords,
|
|
25
|
+
const KQuery::KType& ktype);
|
|
26
|
+
|
|
27
|
+
void addTimeLineList(const string& market, const string& code, const TimeLineList& timeline);
|
|
28
|
+
|
|
29
|
+
void addTransList(const string& market, const string& code, const TransRecordList& translist);
|
|
30
|
+
|
|
31
|
+
void updateIndex(const string& market, const string& code, const KQuery::KType& ktype);
|
|
32
|
+
|
|
33
|
+
void remove(const string& market, const string& code, const KQuery::KType& ktype,
|
|
34
|
+
Datetime start);
|
|
35
|
+
|
|
36
|
+
private:
|
|
37
|
+
ImportKDataToMySQLPluginInterface* m_plugin{nullptr};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
} // namespace hku
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-12-20
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/DataType.h"
|
|
11
|
+
#include "interface/CheckDataPluginInterface.h"
|
|
12
|
+
|
|
13
|
+
namespace hku {
|
|
14
|
+
|
|
15
|
+
std::pair<std::string, vector<std::string>> HKU_API checkData(const StockList& stock_list,
|
|
16
|
+
const Datetime& start_date,
|
|
17
|
+
const Datetime& end_date,
|
|
18
|
+
const KQuery::KType& check_ktype);
|
|
19
|
+
|
|
20
|
+
}
|
|
@@ -191,6 +191,9 @@ Indicator HKU_API AGG_VAR(const Indicator& ind, const KQuery::KType& ktype = KQu
|
|
|
191
191
|
Indicator HKU_API AGG_QUANTILE(const Indicator& ind, const KQuery::KType& ktype = KQuery::MIN,
|
|
192
192
|
bool fill_null = false, int unit = 1, double quantile = 0.75);
|
|
193
193
|
|
|
194
|
+
Indicator HKU_API AGG_VWAP(const KQuery::KType& ktype = KQuery::MIN, bool fill_null = false,
|
|
195
|
+
int unit = 1);
|
|
196
|
+
|
|
194
197
|
using agg_func_t = std::function<double(const DatetimeList& src_ds, const Indicator::value_t* src,
|
|
195
198
|
size_t group_start, size_t group_last)>;
|
|
196
199
|
Indicator HKU_API AGG_FUNC(const Indicator& ind, agg_func_t agg_func,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-05-19
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/Stock.h"
|
|
11
|
+
#include "hikyuu/utilities/plugin/PluginBase.h"
|
|
12
|
+
|
|
13
|
+
namespace hku {
|
|
14
|
+
|
|
15
|
+
class CheckDataPluginInterface : public PluginBase {
|
|
16
|
+
public:
|
|
17
|
+
CheckDataPluginInterface() = default;
|
|
18
|
+
virtual ~CheckDataPluginInterface() = default;
|
|
19
|
+
|
|
20
|
+
virtual std::pair<std::string, vector<std::string>> checkData(
|
|
21
|
+
const StockList& stock_list, const Datetime& start_date, const Datetime& end_date,
|
|
22
|
+
const KQuery::KType& check_ktype) = 0;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
} // namespace hku
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-04-08
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/KRecord.h"
|
|
11
|
+
#include "hikyuu/KQuery.h"
|
|
12
|
+
#include "hikyuu/TimeLineRecord.h"
|
|
13
|
+
#include "hikyuu/TransRecord.h"
|
|
14
|
+
#include "hikyuu/utilities/plugin/PluginBase.h"
|
|
15
|
+
|
|
16
|
+
namespace hku {
|
|
17
|
+
|
|
18
|
+
class ImportKDataToClickHousePluginInterface : public PluginBase {
|
|
19
|
+
public:
|
|
20
|
+
ImportKDataToClickHousePluginInterface() = default;
|
|
21
|
+
virtual ~ImportKDataToClickHousePluginInterface() = default;
|
|
22
|
+
|
|
23
|
+
virtual bool setConfig(const string& host, int port, const string& user, const string& pwd) = 0;
|
|
24
|
+
|
|
25
|
+
virtual Datetime getLastDatetime(const string& market, const string& code,
|
|
26
|
+
const KQuery::KType& ktype) = 0;
|
|
27
|
+
|
|
28
|
+
virtual void addKRecordList(const string& market, const string& code,
|
|
29
|
+
const vector<KRecord>& krecords, const KQuery::KType& ktype) = 0;
|
|
30
|
+
|
|
31
|
+
virtual void addTimeLineList(const string& market, const string& code,
|
|
32
|
+
const TimeLineList& timeline) = 0;
|
|
33
|
+
|
|
34
|
+
virtual void addTransList(const string& market, const string& code,
|
|
35
|
+
const TransRecordList& translist) = 0;
|
|
36
|
+
|
|
37
|
+
virtual void updateIndex(const string& market, const string& code,
|
|
38
|
+
const KQuery::KType& ktype) = 0;
|
|
39
|
+
|
|
40
|
+
virtual void remove(const string& market, const string& code, const KQuery::KType& ktype,
|
|
41
|
+
Datetime start) = 0;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
} // namespace hku
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-04-08
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/KRecord.h"
|
|
11
|
+
#include "hikyuu/KQuery.h"
|
|
12
|
+
#include "hikyuu/utilities/plugin/PluginBase.h"
|
|
13
|
+
|
|
14
|
+
namespace hku {
|
|
15
|
+
|
|
16
|
+
class ImportKDataToMySQLPluginInterface : public PluginBase {
|
|
17
|
+
public:
|
|
18
|
+
ImportKDataToMySQLPluginInterface() = default;
|
|
19
|
+
virtual ~ImportKDataToMySQLPluginInterface() = default;
|
|
20
|
+
|
|
21
|
+
virtual bool setConfig(const string& host, int port, const string& user, const string& pwd) = 0;
|
|
22
|
+
|
|
23
|
+
virtual Datetime getLastDatetime(const string& market, const string& code,
|
|
24
|
+
const KQuery::KType& ktype) = 0;
|
|
25
|
+
|
|
26
|
+
virtual void addKRecordList(const string& market, const string& code,
|
|
27
|
+
const vector<KRecord>& krecords, const KQuery::KType& ktype) = 0;
|
|
28
|
+
|
|
29
|
+
virtual void updateIndex(const string& market, const string& code,
|
|
30
|
+
const KQuery::KType& ktype) = 0;
|
|
31
|
+
|
|
32
|
+
virtual void addTimeLineList(const string& market, const string& code,
|
|
33
|
+
const TimeLineList& timeline) = 0;
|
|
34
|
+
|
|
35
|
+
virtual void addTransList(const string& market, const string& code,
|
|
36
|
+
const TransRecordList& translist) = 0;
|
|
37
|
+
|
|
38
|
+
virtual void remove(const string& market, const string& code, const KQuery::KType& ktype,
|
|
39
|
+
Datetime start) = 0;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
} // namespace hku
|
|
@@ -13,10 +13,13 @@
|
|
|
13
13
|
#include "DevicePluginInterface.h"
|
|
14
14
|
#include "DataServerPluginInterface.h"
|
|
15
15
|
#include "ImportKDataToHdf5PluginInterface.h"
|
|
16
|
+
#include "ImportKDataToClickHousePluginInterface.h"
|
|
17
|
+
#include "ImportKDataToMySQLPluginInterface.h"
|
|
16
18
|
#include "ExtendIndicatorsPluginInterface.h"
|
|
17
19
|
#include "TMReportPluginInterface.h"
|
|
18
20
|
#include "DataDriverPluginInterface.h"
|
|
19
21
|
#include "HkuExtraPluginInterface.h"
|
|
22
|
+
#include "CheckDataPluginInterface.h"
|
|
20
23
|
|
|
21
24
|
namespace hku {
|
|
22
25
|
|
|
@@ -24,9 +27,12 @@ namespace hku {
|
|
|
24
27
|
#define HKU_PLUGIN_DEVICE "device"
|
|
25
28
|
#define HKU_PLUGIN_DATASERVER "dataserver"
|
|
26
29
|
#define HKU_PLUGIN_IMPORTKDATATOHDF5 "import2hdf5"
|
|
30
|
+
#define HKU_PLUGIN_IMPORTKDATATOCLICKHOUSE "import2ch"
|
|
31
|
+
#define HKU_PLUGIN_IMPORTKDATATOMYSQL "import2mysql"
|
|
27
32
|
#define HKU_PLUGIN_EXTEND_INDICATOR "extind"
|
|
28
33
|
#define HKU_PLUGIN_TMREPORT "tmreport"
|
|
29
34
|
#define HKU_PLUGIN_CLICKHOUSE_DRIVER "clickhousedriver"
|
|
30
35
|
#define HKU_PLUGIN_HKU_EXTRA "hkuextra"
|
|
36
|
+
#define HKU_PLUGIN_CHECK_DATA "checkdata"
|
|
31
37
|
|
|
32
38
|
} // namespace hku
|
|
@@ -104,12 +104,12 @@ public:
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
if (PyLong_Check(src)) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
value = static_cast<
|
|
107
|
+
long long ll_val = PyLong_AsLongLong(src);
|
|
108
|
+
if (ll_val < std::numeric_limits<int>::min() ||
|
|
109
|
+
ll_val > std::numeric_limits<int>::max()) {
|
|
110
|
+
value = static_cast<int64_t>(ll_val);
|
|
111
111
|
} else {
|
|
112
|
-
value =
|
|
112
|
+
value = static_cast<int>(ll_val);
|
|
113
113
|
}
|
|
114
114
|
return true;
|
|
115
115
|
}
|
|
@@ -192,8 +192,11 @@ public:
|
|
|
192
192
|
} else {
|
|
193
193
|
Py_RETURN_FALSE;
|
|
194
194
|
}
|
|
195
|
+
} else if (x.type() == typeid(int64_t)) {
|
|
196
|
+
long long ll_val = (long long)boost::any_cast<int64_t>(x);
|
|
197
|
+
return PyLong_FromLongLong(ll_val);
|
|
195
198
|
} else if (x.type() == typeid(int)) {
|
|
196
|
-
return Py_BuildValue("
|
|
199
|
+
return Py_BuildValue("i", boost::any_cast<int>(x));
|
|
197
200
|
} else if (x.type() == typeid(double)) {
|
|
198
201
|
return Py_BuildValue("d", boost::any_cast<double>(x));
|
|
199
202
|
} else if (x.type() == typeid(std::string)) {
|
|
@@ -35,7 +35,7 @@ public:
|
|
|
35
35
|
Strategy();
|
|
36
36
|
explicit Strategy(const string& name, const string& config_file = "");
|
|
37
37
|
Strategy(const vector<string>& codeList, const vector<KQuery::KType>& ktypeList,
|
|
38
|
-
const unordered_map<string,
|
|
38
|
+
const unordered_map<string, int64_t>& preloadNum = {}, const string& name = "Strategy",
|
|
39
39
|
const string& config_file = "");
|
|
40
40
|
explicit Strategy(const StrategyContext& context, const string& name = "Strategy",
|
|
41
41
|
const string& config_file = "");
|
|
@@ -38,7 +38,8 @@ enum BUSINESS {
|
|
|
38
38
|
BUSINESS_RETURN_STOCK = 12, /**< 归还股票资产 */
|
|
39
39
|
BUSINESS_SELL_SHORT = 13, /**< 卖空 */
|
|
40
40
|
BUSINESS_BUY_SHORT = 14, /**< 卖空后回补 */
|
|
41
|
-
|
|
41
|
+
BUSINESS_SUOGU = 15, /**< 缩扩股 */
|
|
42
|
+
BUSINESS_INVALID = 16 /**< 无效类型 */
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
/**
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2019 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025年12月9日
|
|
5
|
+
* Author: stone
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
#ifndef TRADE_SYS_ALLOCATEFUNDS_CRT_AF_FIXEDAMOUNT_H_
|
|
10
|
+
#define TRADE_SYS_ALLOCATEFUNDS_CRT_AF_FIXEDAMOUNT_H_
|
|
11
|
+
|
|
12
|
+
#include "../AllocateFundsBase.h"
|
|
13
|
+
|
|
14
|
+
namespace hku {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @brief 固定金额分配,每个选中的资产都不能超过此金额交易
|
|
18
|
+
* @param amount 指定的固定交易金额
|
|
19
|
+
* @return AFPtr
|
|
20
|
+
* @ingroup AllocateFunds
|
|
21
|
+
*/
|
|
22
|
+
AFPtr HKU_API AF_FixedAmount(double amount = 20000.0);
|
|
23
|
+
|
|
24
|
+
} /* namespace hku */
|
|
25
|
+
|
|
26
|
+
#endif /* TRADE_SYS_ALLOCATEFUNDS_CRT_AF_FIXEDAMOUNT_H_ */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include "../AllocateFundsBase.h"
|
|
3
|
+
|
|
4
|
+
namespace hku {
|
|
5
|
+
|
|
6
|
+
class FixedAmountFunds : public AllocateFundsBase {
|
|
7
|
+
ALLOCATEFUNDS_IMP(FixedAmountFunds)
|
|
8
|
+
ALLOCATEFUNDS_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
9
|
+
|
|
10
|
+
public:
|
|
11
|
+
FixedAmountFunds();
|
|
12
|
+
virtual ~FixedAmountFunds();
|
|
13
|
+
virtual void _checkParam(const string& name) const override;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
} /* namespace hku */
|
|
17
|
+
|
|
18
|
+
|
|
@@ -88,7 +88,7 @@ public:
|
|
|
88
88
|
|
|
89
89
|
/** 克隆操作 */
|
|
90
90
|
typedef shared_ptr<Portfolio> PortfolioPtr;
|
|
91
|
-
PortfolioPtr clone()
|
|
91
|
+
PortfolioPtr clone();
|
|
92
92
|
|
|
93
93
|
/** 运行前准备 */
|
|
94
94
|
void readyForRun();
|
|
@@ -99,7 +99,7 @@ public:
|
|
|
99
99
|
virtual string str() const;
|
|
100
100
|
|
|
101
101
|
virtual void _reset() {}
|
|
102
|
-
virtual PortfolioPtr _clone()
|
|
102
|
+
virtual PortfolioPtr _clone() {
|
|
103
103
|
return std::make_shared<Portfolio>();
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -113,6 +113,10 @@ public:
|
|
|
113
113
|
*/
|
|
114
114
|
virtual json lastSuggestion() const;
|
|
115
115
|
|
|
116
|
+
virtual bool isPythonObject() const {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
|
|
116
120
|
private:
|
|
117
121
|
void initParam();
|
|
118
122
|
|
|
@@ -122,10 +126,6 @@ private:
|
|
|
122
126
|
const string& mode);
|
|
123
127
|
|
|
124
128
|
protected:
|
|
125
|
-
virtual bool isPythonObject() const {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
129
|
// 跟踪打印当前TM持仓情况
|
|
130
130
|
void traceMomentTMAfterRunAtOpen(const Datetime& date);
|
|
131
131
|
void traceMomentTMAfterRunAtClose(const Datetime& date);
|
|
@@ -177,13 +177,13 @@ private:
|
|
|
177
177
|
#endif /* HKU_SUPPORT_SERIALIZATION */
|
|
178
178
|
};
|
|
179
179
|
|
|
180
|
-
#define PORTFOLIO_IMP(classname)
|
|
181
|
-
public:
|
|
182
|
-
virtual PortfolioPtr _clone()
|
|
183
|
-
return std::make_shared<classname>();
|
|
184
|
-
}
|
|
185
|
-
virtual void _reset() override;
|
|
186
|
-
virtual void _readyForRun() override;
|
|
180
|
+
#define PORTFOLIO_IMP(classname) \
|
|
181
|
+
public: \
|
|
182
|
+
virtual PortfolioPtr _clone() override { \
|
|
183
|
+
return std::make_shared<classname>(); \
|
|
184
|
+
} \
|
|
185
|
+
virtual void _reset() override; \
|
|
186
|
+
virtual void _readyForRun() override; \
|
|
187
187
|
virtual void _runMoment(const Datetime& date, const Datetime& nextCycle, bool adjust) override;
|
|
188
188
|
|
|
189
189
|
/**
|
|
@@ -62,8 +62,8 @@ public:
|
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* 买入时计算目标价格
|
|
65
|
-
* @param datetime
|
|
66
|
-
* @param price
|
|
65
|
+
* @param datetime 当前时间
|
|
66
|
+
* @param price 当前价格
|
|
67
67
|
* @return 返回Null<price_t>时,表示未限定目标; 返回0,意味着需要卖出
|
|
68
68
|
*/
|
|
69
69
|
virtual price_t getGoal(const Datetime& datetime, price_t price) = 0;
|
|
@@ -80,9 +80,8 @@ public:
|
|
|
80
80
|
virtual ProfitGoalPtr _clone() = 0;
|
|
81
81
|
|
|
82
82
|
/** 子类计算接口,由setTO调用 */
|
|
83
|
-
virtual void _calculate()
|
|
83
|
+
virtual void _calculate() {}
|
|
84
84
|
|
|
85
|
-
protected:
|
|
86
85
|
virtual bool isPythonObject() const {
|
|
87
86
|
return false;
|
|
88
87
|
}
|
|
@@ -143,13 +142,12 @@ private: \
|
|
|
143
142
|
#define PROFIT_GOAL_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
144
143
|
#endif
|
|
145
144
|
|
|
146
|
-
#define PROFITGOAL_IMP(classname)
|
|
147
|
-
public:
|
|
148
|
-
virtual ProfitGoalPtr _clone() override {
|
|
149
|
-
return std::make_shared<classname>();
|
|
150
|
-
}
|
|
151
|
-
virtual price_t getGoal(const Datetime&, price_t) override;
|
|
152
|
-
virtual void _calculate() override;
|
|
145
|
+
#define PROFITGOAL_IMP(classname) \
|
|
146
|
+
public: \
|
|
147
|
+
virtual ProfitGoalPtr _clone() override { \
|
|
148
|
+
return std::make_shared<classname>(); \
|
|
149
|
+
} \
|
|
150
|
+
virtual price_t getGoal(const Datetime&, price_t) override;
|
|
153
151
|
|
|
154
152
|
/**
|
|
155
153
|
* 客户程序都应使用该指针类型
|