hikyuu 2.2.2__py3-none-win_amd64.whl → 2.2.4__py3-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/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/core310.pyd +0 -0
- hikyuu/cpp/core311.pyd +0 -0
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core38.pyd +0 -0
- hikyuu/cpp/core39.pyd +0 -0
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/cpp/sqlite3.dll +0 -0
- hikyuu/data/hku_config_template.py +1 -1
- hikyuu/data/mysql_upgrade/0024.sql +2 -0
- hikyuu/draw/drawplot/matplotlib_draw.py +6 -1
- hikyuu/examples/notebook/Demo/Demo1.ipynb +85 -84
- hikyuu/gui/HikyuuTDX.py +16 -15
- hikyuu/gui/data/MainWindow.py +129 -112
- hikyuu/hub.py +3 -3
- hikyuu/include/hikyuu/DataType.h +3 -1
- hikyuu/include/hikyuu/StockManager.h +10 -0
- hikyuu/include/hikyuu/data_driver/BlockInfoDriver.h +15 -1
- hikyuu/include/hikyuu/data_driver/block_info/mysql/MySQLBlockInfoDriver.h +8 -1
- hikyuu/include/hikyuu/data_driver/block_info/qianlong/QLBlockInfoDriver.h +3 -1
- hikyuu/include/hikyuu/data_driver/block_info/sqlite/SQLiteBlockInfoDriver.h +8 -1
- hikyuu/include/hikyuu/trade_manage/OrderBrokerBase.h +25 -0
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +0 -4
- hikyuu/include/hikyuu/trade_sys/selector/imp/optimal/PerformanceOptimalSelector.h +1 -1
- hikyuu/include/hikyuu/trade_sys/system/crt/SYS_WalkForward.h +1 -7
- hikyuu/include/hikyuu/utilities/Parameter.h +2 -2
- hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLStatement.h +1 -0
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/test/Datetime.py +12 -12
- hikyuu/test/Indicator.py +36 -36
- hikyuu/test/KData.py +11 -11
- hikyuu/test/Stock.py +10 -10
- {hikyuu-2.2.2.dist-info → hikyuu-2.2.4.dist-info}/METADATA +24 -1
- {hikyuu-2.2.2.dist-info → hikyuu-2.2.4.dist-info}/RECORD +42 -43
- {hikyuu-2.2.2.dist-info → hikyuu-2.2.4.dist-info}/WHEEL +1 -1
- hikyuu/sqlite3.dll +0 -0
- hikyuu/vcruntime140.dll +0 -0
- hikyuu/vcruntime140_1.dll +0 -0
- {hikyuu-2.2.2.dist-info → hikyuu-2.2.4.dist-info}/LICENSE +0 -0
- {hikyuu-2.2.2.dist-info → hikyuu-2.2.4.dist-info}/entry_points.txt +0 -0
- {hikyuu-2.2.2.dist-info → hikyuu-2.2.4.dist-info}/top_level.txt +0 -0
|
@@ -129,6 +129,16 @@ public:
|
|
|
129
129
|
*/
|
|
130
130
|
Block getBlock(const string& category, const string& name);
|
|
131
131
|
|
|
132
|
+
void addBlock(const Block& blk) {
|
|
133
|
+
saveBlock(blk);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
void saveBlock(const Block& blk);
|
|
137
|
+
void removeBlock(const string& category, const string& name);
|
|
138
|
+
void removeBlock(const Block& blk) {
|
|
139
|
+
removeBlock(blk.category(), blk.name());
|
|
140
|
+
}
|
|
141
|
+
|
|
132
142
|
/**
|
|
133
143
|
* 获取指定分类的板块列表
|
|
134
144
|
* @param category 板块分类
|
|
@@ -23,7 +23,7 @@ class HKU_API BlockInfoDriver {
|
|
|
23
23
|
|
|
24
24
|
public:
|
|
25
25
|
BlockInfoDriver(const string& name);
|
|
26
|
-
virtual ~BlockInfoDriver(){};
|
|
26
|
+
virtual ~BlockInfoDriver() {};
|
|
27
27
|
|
|
28
28
|
/** 获取驱动名称 */
|
|
29
29
|
const string& name() const;
|
|
@@ -74,6 +74,20 @@ public:
|
|
|
74
74
|
*/
|
|
75
75
|
virtual BlockList getBlockList() = 0;
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* 保存指定的板块
|
|
79
|
+
* @note 如果已存在同名板块,则覆盖;如果板块分类或名称存在修改,需要手工在修改前删除原板块
|
|
80
|
+
* @param block
|
|
81
|
+
*/
|
|
82
|
+
virtual void save(const Block& block) = 0;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 删除指定的板块
|
|
86
|
+
* @param category 板块分类
|
|
87
|
+
* @param name 板块名称
|
|
88
|
+
*/
|
|
89
|
+
virtual void remove(const string& category, const string& name) = 0;
|
|
90
|
+
|
|
77
91
|
private:
|
|
78
92
|
bool checkType();
|
|
79
93
|
|
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
|
+
#include <mutex>
|
|
10
11
|
#include "../../BlockInfoDriver.h"
|
|
11
12
|
|
|
12
13
|
namespace hku {
|
|
13
14
|
|
|
14
15
|
class MySQLBlockInfoDriver : public BlockInfoDriver {
|
|
15
16
|
public:
|
|
16
|
-
MySQLBlockInfoDriver() : BlockInfoDriver("mysql"){};
|
|
17
|
+
MySQLBlockInfoDriver() : BlockInfoDriver("mysql") {};
|
|
17
18
|
virtual ~MySQLBlockInfoDriver();
|
|
18
19
|
|
|
19
20
|
virtual void load() override;
|
|
@@ -21,9 +22,15 @@ public:
|
|
|
21
22
|
virtual Block getBlock(const string&, const string&) override;
|
|
22
23
|
virtual BlockList getBlockList(const string& category) override;
|
|
23
24
|
virtual BlockList getBlockList() override;
|
|
25
|
+
virtual void save(const Block& block) override;
|
|
26
|
+
virtual void remove(const string& category, const string& name) override;
|
|
27
|
+
|
|
28
|
+
private:
|
|
29
|
+
DBConnectPtr getConnect();
|
|
24
30
|
|
|
25
31
|
private:
|
|
26
32
|
unordered_map<string, unordered_map<string, Block>> m_buffer;
|
|
33
|
+
std::shared_mutex m_buffer_mutex;
|
|
27
34
|
};
|
|
28
35
|
|
|
29
36
|
} // namespace hku
|
|
@@ -15,13 +15,15 @@ namespace hku {
|
|
|
15
15
|
|
|
16
16
|
class QLBlockInfoDriver : public BlockInfoDriver {
|
|
17
17
|
public:
|
|
18
|
-
QLBlockInfoDriver() : BlockInfoDriver("qianlong"){};
|
|
18
|
+
QLBlockInfoDriver() : BlockInfoDriver("qianlong") {};
|
|
19
19
|
virtual ~QLBlockInfoDriver();
|
|
20
20
|
|
|
21
21
|
virtual bool _init() override;
|
|
22
22
|
virtual Block getBlock(const string&, const string&) override;
|
|
23
23
|
virtual BlockList getBlockList(const string& category) override;
|
|
24
24
|
virtual BlockList getBlockList() override;
|
|
25
|
+
virtual void save(const Block& block) override;
|
|
26
|
+
virtual void remove(const string& category, const string& name) override;
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
} /* namespace hku */
|
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
|
+
#include <mutex>
|
|
10
11
|
#include "../../BlockInfoDriver.h"
|
|
11
12
|
|
|
12
13
|
namespace hku {
|
|
13
14
|
|
|
14
15
|
class SQLiteBlockInfoDriver : public BlockInfoDriver {
|
|
15
16
|
public:
|
|
16
|
-
SQLiteBlockInfoDriver() : BlockInfoDriver("sqlite3"){};
|
|
17
|
+
SQLiteBlockInfoDriver() : BlockInfoDriver("sqlite3") {};
|
|
17
18
|
virtual ~SQLiteBlockInfoDriver();
|
|
18
19
|
|
|
19
20
|
virtual void load() override;
|
|
@@ -21,9 +22,15 @@ public:
|
|
|
21
22
|
virtual Block getBlock(const string&, const string&) override;
|
|
22
23
|
virtual BlockList getBlockList(const string& category) override;
|
|
23
24
|
virtual BlockList getBlockList() override;
|
|
25
|
+
virtual void save(const Block& block) override;
|
|
26
|
+
virtual void remove(const string& category, const string& name) override;
|
|
27
|
+
|
|
28
|
+
private:
|
|
29
|
+
DBConnectPtr getConnect();
|
|
24
30
|
|
|
25
31
|
private:
|
|
26
32
|
unordered_map<string, unordered_map<string, Block>> m_buffer;
|
|
33
|
+
std::shared_mutex m_buffer_mutex;
|
|
27
34
|
};
|
|
28
35
|
|
|
29
36
|
} // namespace hku
|
|
@@ -147,8 +147,33 @@ public:
|
|
|
147
147
|
|
|
148
148
|
protected:
|
|
149
149
|
string m_name;
|
|
150
|
+
|
|
151
|
+
//============================================
|
|
152
|
+
// 序列化支持
|
|
153
|
+
//============================================
|
|
154
|
+
#if HKU_SUPPORT_SERIALIZATION
|
|
155
|
+
private:
|
|
156
|
+
friend class boost::serialization::access;
|
|
157
|
+
template <class Archive>
|
|
158
|
+
void save(Archive& ar, const unsigned int version) const {
|
|
159
|
+
ar& BOOST_SERIALIZATION_NVP(m_name);
|
|
160
|
+
ar& BOOST_SERIALIZATION_NVP(m_params);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
template <class Archive>
|
|
164
|
+
void load(Archive& ar, const unsigned int version) {
|
|
165
|
+
ar& BOOST_SERIALIZATION_NVP(m_name);
|
|
166
|
+
ar& BOOST_SERIALIZATION_NVP(m_params);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
BOOST_SERIALIZATION_SPLIT_MEMBER()
|
|
170
|
+
#endif /* HKU_SUPPORT_SERIALIZATION */
|
|
150
171
|
};
|
|
151
172
|
|
|
173
|
+
#if HKU_SUPPORT_SERIALIZATION
|
|
174
|
+
BOOST_SERIALIZATION_ASSUME_ABSTRACT(OrderBrokerBase)
|
|
175
|
+
#endif
|
|
176
|
+
|
|
152
177
|
/**
|
|
153
178
|
* 客户程序应使用此类型进行实际操作
|
|
154
179
|
* @ingroup OrderBroker
|
|
@@ -737,10 +737,6 @@ private:
|
|
|
737
737
|
#endif /* HKU_SUPPORT_SERIALIZATION */
|
|
738
738
|
};
|
|
739
739
|
|
|
740
|
-
#if HKU_SUPPORT_SERIALIZATION
|
|
741
|
-
BOOST_SERIALIZATION_ASSUME_ABSTRACT(TradeManagerBase)
|
|
742
|
-
#endif
|
|
743
|
-
|
|
744
740
|
inline void TradeManagerBase::baseCheckParam(const string& name) const {
|
|
745
741
|
if ("precision" == name) {
|
|
746
742
|
int precision = getParam<int>("precision");
|
|
@@ -22,7 +22,7 @@ public:
|
|
|
22
22
|
virtual void _checkParam(const string& name) const override;
|
|
23
23
|
virtual void calculate(const SystemList& pf_realSysList, const KQuery& query) override;
|
|
24
24
|
|
|
25
|
-
virtual SystemWeightList getSelected(Datetime date);
|
|
25
|
+
virtual SystemWeightList getSelected(Datetime date) override;
|
|
26
26
|
virtual SelectorPtr _clone() override;
|
|
27
27
|
virtual void _reset() override;
|
|
28
28
|
|
|
@@ -12,16 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
namespace hku {
|
|
14
14
|
|
|
15
|
-
// SystemPtr HKU_API SYS_WalkForward(const SystemList& candidate_sys_list,
|
|
16
|
-
// const TradeManagerPtr& tm = TradeManagerPtr(),
|
|
17
|
-
// size_t train_len = 100, size_t test_len = 20,
|
|
18
|
-
// const string& key = "帐户平均年收益率%",
|
|
19
|
-
// const TradeManagerPtr& train_tm = TradeManagerPtr());
|
|
20
|
-
|
|
21
15
|
SystemPtr HKU_API SYS_WalkForward(const SystemList& candidate_sys_list,
|
|
22
16
|
const TradeManagerPtr& tm = TradeManagerPtr(),
|
|
23
17
|
size_t train_len = 100, size_t test_len = 20,
|
|
24
|
-
const SelectorPtr& se =
|
|
18
|
+
const SelectorPtr& se = SE_PerformanceOptimal(),
|
|
25
19
|
const TradeManagerPtr& train_tm = TradeManagerPtr());
|
|
26
20
|
|
|
27
21
|
} // namespace hku
|
|
@@ -463,7 +463,7 @@ void Parameter::set(const string& name, const ValueType& value) {
|
|
|
463
463
|
return;
|
|
464
464
|
}
|
|
465
465
|
|
|
466
|
-
if (m_params[name].type()
|
|
466
|
+
if (strcmp(m_params[name].type().name(), typeid(ValueType).name()) != 0) {
|
|
467
467
|
if ((m_params[name].type() == typeid(int) || m_params[name].type() == typeid(int64_t)) &&
|
|
468
468
|
(typeid(ValueType) == typeid(int) || typeid(ValueType) == typeid(int64_t))) {
|
|
469
469
|
// 忽略,允许设定
|
|
@@ -494,7 +494,7 @@ inline void Parameter::set(const string& name, const boost::any& value) {
|
|
|
494
494
|
return;
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
-
if (m_params[name].type()
|
|
497
|
+
if (strcmp(m_params[name].type().name(), value.type().name()) != 0) {
|
|
498
498
|
throw std::logic_error("Mismatching type! need type " +
|
|
499
499
|
string(m_params[name].type().name()) + " but value type is " +
|
|
500
500
|
string(value.type().name()));
|
hikyuu/include/hikyuu/version.h
CHANGED
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
#define HKU_VERSION_H
|
|
13
13
|
|
|
14
14
|
// clang-format off
|
|
15
|
-
#define HKU_VERSION "2.2.
|
|
15
|
+
#define HKU_VERSION "2.2.4"
|
|
16
16
|
#define HKU_VERSION_MAJOR 2
|
|
17
17
|
#define HKU_VERSION_MINOR 2
|
|
18
|
-
#define HKU_VERSION_ALTER
|
|
19
|
-
#define HKU_VERSION_BUILD
|
|
18
|
+
#define HKU_VERSION_ALTER 4
|
|
19
|
+
#define HKU_VERSION_BUILD 202412082122
|
|
20
20
|
#define HKU_VERSION_MODE "RELEASE"
|
|
21
|
-
#define HKU_VERSION_GIT "2.2.
|
|
21
|
+
#define HKU_VERSION_GIT "2.2.4 master.2fafc6fb (RELEASE)"
|
|
22
22
|
// clang-format on
|
|
23
23
|
|
|
24
24
|
#endif /* HKU_VERSION_H */
|
hikyuu/test/Datetime.py
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
# -*- coding: utf8 -*-
|
|
3
3
|
# cp936
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# ===============================================================================
|
|
6
6
|
# 作者:fasiondog
|
|
7
7
|
# 历史:1)20120927, Added by fasiondog
|
|
8
|
-
|
|
8
|
+
# ===============================================================================
|
|
9
9
|
|
|
10
10
|
import unittest
|
|
11
11
|
|
|
@@ -24,16 +24,16 @@ class DatetimeTest(unittest.TestCase):
|
|
|
24
24
|
self.assertEqual(Datetime(140001010000), Datetime.min())
|
|
25
25
|
self.assertEqual(Datetime(999912310000), Datetime.max())
|
|
26
26
|
|
|
27
|
-
self.
|
|
28
|
-
self.
|
|
29
|
-
self.
|
|
30
|
-
self.
|
|
31
|
-
self.
|
|
32
|
-
self.
|
|
33
|
-
self.
|
|
34
|
-
self.
|
|
35
|
-
self.
|
|
36
|
-
self.
|
|
27
|
+
self.assertEqual(d, Datetime(201209272301))
|
|
28
|
+
self.assertNotEqual(d, Datetime(200101010000))
|
|
29
|
+
self.assertGreaterEqual(d, Datetime(201209272301))
|
|
30
|
+
self.assertTrue(d >= Datetime(201209272259))
|
|
31
|
+
self.assertTrue(d <= Datetime(201209272301))
|
|
32
|
+
self.assertTrue(d <= Datetime(201209272302))
|
|
33
|
+
self.assertTrue(not (d > Datetime(201209272301)))
|
|
34
|
+
self.assertTrue(d > Datetime(201209272259))
|
|
35
|
+
self.assertTrue(not (d < Datetime(201209272301)))
|
|
36
|
+
self.assertTrue(d < Datetime(201209272302))
|
|
37
37
|
|
|
38
38
|
d = Datetime(200101010159)
|
|
39
39
|
self.assertEqual(str(d), "2001-01-01 01:59:00")
|
hikyuu/test/Indicator.py
CHANGED
|
@@ -48,10 +48,10 @@ class IndicatorTest(unittest.TestCase):
|
|
|
48
48
|
self.assertEqual(m.name, "AddIndicator")
|
|
49
49
|
self.assertEqual(len(m), 4)
|
|
50
50
|
self.assertEqual(m.empty(), False)
|
|
51
|
-
self.
|
|
52
|
-
self.
|
|
53
|
-
self.
|
|
54
|
-
self.
|
|
51
|
+
self.assertTrue(abs(m[0] - 1) < 0.0001)
|
|
52
|
+
self.assertTrue(abs(m[1] - 2) < 0.0001)
|
|
53
|
+
self.assertTrue(abs(m[2] - 3) < 0.0001)
|
|
54
|
+
self.assertTrue(abs(m[3] - 4) < 0.0001)
|
|
55
55
|
|
|
56
56
|
b = toPriceList([1, 2, 3, 4])
|
|
57
57
|
x = PRICELIST(b)
|
|
@@ -59,10 +59,10 @@ class IndicatorTest(unittest.TestCase):
|
|
|
59
59
|
m = m(x)
|
|
60
60
|
self.assertEqual(len(m), 4)
|
|
61
61
|
self.assertEqual(m.empty(), False)
|
|
62
|
-
self.
|
|
63
|
-
self.
|
|
64
|
-
self.
|
|
65
|
-
self.
|
|
62
|
+
self.assertTrue(abs(m[0] - 2) < 0.0001)
|
|
63
|
+
self.assertTrue(abs(m[1] - 3) < 0.0001)
|
|
64
|
+
self.assertTrue(abs(m[2] - 4) < 0.0001)
|
|
65
|
+
self.assertTrue(abs(m[3] - 5) < 0.0001)
|
|
66
66
|
|
|
67
67
|
def test_operator(self):
|
|
68
68
|
a = toPriceList([0, 1, 2, 3, 5])
|
|
@@ -76,16 +76,16 @@ class IndicatorTest(unittest.TestCase):
|
|
|
76
76
|
self.assertEqual(a[3], 7)
|
|
77
77
|
|
|
78
78
|
a = x1 + 1.1
|
|
79
|
-
self.
|
|
80
|
-
self.
|
|
81
|
-
self.
|
|
82
|
-
self.
|
|
79
|
+
self.assertTrue(abs(a[0] - 1.1) < 0.0001)
|
|
80
|
+
self.assertTrue(abs(a[1] - 2.1) < 0.0001)
|
|
81
|
+
self.assertTrue(abs(a[2] - 3.1) < 0.0001)
|
|
82
|
+
self.assertTrue(abs(a[3] - 4.1) < 0.0001)
|
|
83
83
|
|
|
84
84
|
a = 2.1 + x1
|
|
85
|
-
self.
|
|
86
|
-
self.
|
|
87
|
-
self.
|
|
88
|
-
self.
|
|
85
|
+
self.assertTrue(abs(a[0] - 2.1) < 0.0001)
|
|
86
|
+
self.assertTrue(abs(a[1] - 3.1) < 0.0001)
|
|
87
|
+
self.assertTrue(abs(a[2] - 4.1) < 0.0001)
|
|
88
|
+
self.assertTrue(abs(a[3] - 5.1) < 0.0001)
|
|
89
89
|
|
|
90
90
|
a = x2 - x1
|
|
91
91
|
self.assertEqual(a[0], 1)
|
|
@@ -124,10 +124,10 @@ class IndicatorTest(unittest.TestCase):
|
|
|
124
124
|
self.assertEqual(a[3], 6)
|
|
125
125
|
|
|
126
126
|
a = x2 / x1
|
|
127
|
-
self.
|
|
127
|
+
self.assertTrue(isinf(a[0]))
|
|
128
128
|
self.assertEqual(a[1], 2)
|
|
129
129
|
self.assertEqual(a[2], 1.5)
|
|
130
|
-
self.
|
|
130
|
+
self.assertTrue(abs(a[3] - 4.0 / 3.0) < 0.0001)
|
|
131
131
|
|
|
132
132
|
a = x1 / 0.5
|
|
133
133
|
self.assertEqual(a[0], 0)
|
|
@@ -136,10 +136,10 @@ class IndicatorTest(unittest.TestCase):
|
|
|
136
136
|
self.assertEqual(a[3], 6)
|
|
137
137
|
|
|
138
138
|
a = 2. / x1
|
|
139
|
-
self.
|
|
139
|
+
self.assertTrue(isinf(a[0]))
|
|
140
140
|
self.assertEqual(a[1], 2.0)
|
|
141
141
|
self.assertEqual(a[2], 1.)
|
|
142
|
-
self.
|
|
142
|
+
self.assertTrue(abs(a[3] - 2.0/3.0) < 0.0001)
|
|
143
143
|
|
|
144
144
|
a = x1 > x2
|
|
145
145
|
self.assertEqual(a[0], 0 > 1)
|
|
@@ -180,19 +180,19 @@ class IndicatorTest(unittest.TestCase):
|
|
|
180
180
|
self.assertEqual(a.empty(), False)
|
|
181
181
|
self.assertEqual(v.empty(), False)
|
|
182
182
|
|
|
183
|
-
self.
|
|
184
|
-
self.
|
|
185
|
-
self.
|
|
186
|
-
self.
|
|
187
|
-
self.
|
|
188
|
-
self.
|
|
183
|
+
self.assertTrue(abs(o[0] - 96.05) < 0.0001)
|
|
184
|
+
self.assertTrue(abs(h[0] - 99.98) < 0.0001)
|
|
185
|
+
self.assertTrue(abs(l[0] - 95.79) < 0.0001)
|
|
186
|
+
self.assertTrue(abs(c[0] - 99.98) < 0.0001)
|
|
187
|
+
self.assertTrue(abs(a[0] - 49.4) < 0.0001)
|
|
188
|
+
self.assertTrue(abs(v[0] - 1260) < 0.0001)
|
|
189
189
|
|
|
190
|
-
self.
|
|
191
|
-
self.
|
|
192
|
-
self.
|
|
193
|
-
self.
|
|
194
|
-
self.
|
|
195
|
-
self.
|
|
190
|
+
self.assertTrue(abs(o[1] - 104.3) < 0.0001)
|
|
191
|
+
self.assertTrue(abs(h[1] - 104.39) < 0.0001)
|
|
192
|
+
self.assertTrue(abs(l[1] - 99.98) < 0.0001)
|
|
193
|
+
self.assertTrue(abs(c[1] - 104.39) < 0.0001)
|
|
194
|
+
self.assertTrue(abs(a[1] - 8.4) < 0.0001)
|
|
195
|
+
self.assertTrue(abs(v[1] - 197) < 0.0001)
|
|
196
196
|
|
|
197
197
|
def test_MA(self):
|
|
198
198
|
a = toPriceList([0, 1, 2, 3])
|
|
@@ -200,10 +200,10 @@ class IndicatorTest(unittest.TestCase):
|
|
|
200
200
|
m = MA(x, 2)
|
|
201
201
|
self.assertEqual(len(m), 4)
|
|
202
202
|
self.assertEqual(m.discard, 0)
|
|
203
|
-
self.
|
|
204
|
-
self.
|
|
205
|
-
self.
|
|
206
|
-
self.
|
|
203
|
+
self.assertTrue(abs(m[0] - 0.0) < 0.0001)
|
|
204
|
+
self.assertTrue(abs(m[1] - 0.5) < 0.0001)
|
|
205
|
+
self.assertTrue(abs(m[2] - 1.5) < 0.0001)
|
|
206
|
+
self.assertTrue(abs(m[3] - 2.5) < 0.0001)
|
|
207
207
|
|
|
208
208
|
def test_pickle(self):
|
|
209
209
|
if not constant.pickle_support:
|
hikyuu/test/KData.py
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
# -*- coding: utf8 -*-
|
|
3
3
|
# gb18030
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# ===============================================================================
|
|
6
6
|
# 作者:fasiondog
|
|
7
7
|
# 历史:1)20130220, Added by fasiondog
|
|
8
|
-
|
|
8
|
+
# ===============================================================================
|
|
9
9
|
|
|
10
10
|
import unittest
|
|
11
11
|
|
|
@@ -33,14 +33,14 @@ class KDataTest(unittest.TestCase):
|
|
|
33
33
|
self.assertEqual(k.end_pos, 10)
|
|
34
34
|
self.assertEqual(k.last_pos, 9)
|
|
35
35
|
self.assertEqual(k[0].datetime, Datetime(199012190000))
|
|
36
|
-
self.
|
|
37
|
-
self.
|
|
38
|
-
self.
|
|
39
|
-
self.
|
|
40
|
-
self.
|
|
41
|
-
self.
|
|
42
|
-
self.
|
|
43
|
-
self.
|
|
36
|
+
self.assertTrue(abs(k[0].open - 96.05) < 0.0001)
|
|
37
|
+
self.assertTrue(abs(k[0].high - 99.980) < 0.0001)
|
|
38
|
+
self.assertTrue(abs(k[0].low - 95.79) < 0.0001)
|
|
39
|
+
self.assertTrue(abs(k[0].close - 99.98) < 0.0001)
|
|
40
|
+
self.assertTrue(abs(k[0].amount - 49.4) < 0.0001)
|
|
41
|
+
self.assertTrue(abs(k[0].volume - 1260) < 0.0001)
|
|
42
|
+
self.assertTrue(abs(k[1].open - 104.3) < 0.0001)
|
|
43
|
+
self.assertTrue(abs(k[9].open - 127.61) < 0.0001)
|
|
44
44
|
|
|
45
45
|
def test_pickle(self):
|
|
46
46
|
if not constant.pickle_support:
|
|
@@ -61,4 +61,4 @@ class KDataTest(unittest.TestCase):
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
def suite():
|
|
64
|
-
return unittest.TestLoader().loadTestsFromTestCase(KDataTest)
|
|
64
|
+
return unittest.TestLoader().loadTestsFromTestCase(KDataTest)
|
hikyuu/test/Stock.py
CHANGED
|
@@ -36,12 +36,12 @@ class StockTest(unittest.TestCase):
|
|
|
36
36
|
|
|
37
37
|
s1 = sm['sh000001']
|
|
38
38
|
s2 = sm['sh000001']
|
|
39
|
-
self.
|
|
40
|
-
self.
|
|
39
|
+
self.assertTrue(s1 == s2)
|
|
40
|
+
self.assertTrue(not (s1 != s2))
|
|
41
41
|
|
|
42
42
|
s2 = sm['sz000001']
|
|
43
|
-
self.
|
|
44
|
-
self.
|
|
43
|
+
self.assertTrue(not (s1 == s2))
|
|
44
|
+
self.assertTrue(s1 != s2)
|
|
45
45
|
|
|
46
46
|
def test_pickle(self):
|
|
47
47
|
if not constant.pickle_support:
|
|
@@ -79,7 +79,7 @@ class StockTest(unittest.TestCase):
|
|
|
79
79
|
|
|
80
80
|
self.assertEqual(stk.valid, False)
|
|
81
81
|
stk.valid = True
|
|
82
|
-
self.
|
|
82
|
+
self.assertTrue(stk.valid)
|
|
83
83
|
|
|
84
84
|
self.assertNotEqual(stk.type, constant.STOCKTYPE_A)
|
|
85
85
|
stk.type = constant.STOCKTYPE_A
|
|
@@ -113,14 +113,14 @@ class StockTest(unittest.TestCase):
|
|
|
113
113
|
self.assertEqual(len(k), 1)
|
|
114
114
|
self.assertEqual(k[0], KRecord(Datetime(20010101), 5.0, 9.0, 4.0, 6.5, 1000.0, 100000.0))
|
|
115
115
|
|
|
116
|
-
self.
|
|
116
|
+
self.assertTrue(stk not in sm)
|
|
117
117
|
sm.add_stock(stk)
|
|
118
|
-
self.
|
|
118
|
+
self.assertTrue(stk in sm)
|
|
119
119
|
stk2 = sm['ab000001']
|
|
120
|
-
self.
|
|
121
|
-
self.
|
|
120
|
+
self.assertTrue(not stk2.is_null())
|
|
121
|
+
self.assertTrue(stk2, stk)
|
|
122
122
|
sm.remove_stock("ab000001")
|
|
123
|
-
self.
|
|
123
|
+
self.assertTrue(stk not in sm)
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
def suite():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hikyuu
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.4
|
|
4
4
|
Summary: Hikyuu Quant Framework for System Trading Analysis and backtester
|
|
5
5
|
Home-page: http://hikyuu.org/
|
|
6
6
|
Author: fasiondog
|
|
@@ -16,6 +16,8 @@ Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
|
16
16
|
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
17
17
|
Classifier: License :: OSI Approved :: MIT License
|
|
18
18
|
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
20
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
19
21
|
Classifier: Programming Language :: Python :: 3
|
|
20
22
|
Classifier: Programming Language :: Python :: 3.8
|
|
21
23
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -125,3 +127,24 @@ Hikyuu Quant Framework是一款基于C++/Python的开源量化交易研究框架
|
|
|
125
127
|
## QQ交流群:114910869, 或扫码加入
|
|
126
128
|
|
|
127
129
|

|
|
130
|
+
|
|
131
|
+
## 项目依赖说明
|
|
132
|
+
|
|
133
|
+
Hikyuu直接依赖以下开源项目(由以下项目间接依赖的项目未列出),感谢所有开源作者的贡献:
|
|
134
|
+
|
|
135
|
+
| 名称 | 项目地址 | License |
|
|
136
|
+
| ------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
137
|
+
| xmake | [https://github.com/xmake-io/xmake](https://github.com/xmake-io/xmake) | Apache 2.0 |
|
|
138
|
+
| hdf5 | [https://github.com/HDFGroup/hdf5](https://github.com/HDFGroup/hdf5) | [hdf5 license](https://github.com/HDFGroup/hdf5?tab=License-1-ov-file#License-1-ov-file) |
|
|
139
|
+
| mysql(client) | [https://github.com/mysql/mysql-server]() | [mysql license](https://github.com/mysql/mysql-server?tab=License-1-ov-file#readme) |
|
|
140
|
+
| fmt | [https://github.com/fmtlib/fmt](https://github.com/fmtlib/fmt) | [fmt license](https://github.com/fmtlib/fmt?tab=License-1-ov-file#readme) |
|
|
141
|
+
| spdlog | [https://github.com/gabime/spdlog](https://github.com/gabime/spdlog) | MIT |
|
|
142
|
+
| sqlite | [https://www.sqlite.org/](https://www.sqlite.org/) | [sqlite license](https://www.sqlite.org/copyright.html) |
|
|
143
|
+
| flatbuffers | [https://github.com/google/flatbuffers](https://github.com/google/flatbuffers) | Apache 2.0 |
|
|
144
|
+
| nng | [https://github.com/nanomsg/nng](https://github.com/nanomsg/nng) | MIT |
|
|
145
|
+
| nlohmann_json | [https://github.com/nlohmann/json](https://github.com/nlohmann/json) | MIT |
|
|
146
|
+
| boost | [https://www.boost.org/](https://www.boost.org/) | [Boost Software License](https://www.boost.org/users/license.html) |
|
|
147
|
+
| python | [https://www.python.org/](https://www.python.org/) | [Python license](https://docs.python.org/3/license.html) |
|
|
148
|
+
| pybind11 | [https://github.com/pybind/pybind11](https://github.com/pybind/pybind11) | [pybind11 license](https://github.com/pybind/pybind11?tab=License-1-ov-file#readme) |
|
|
149
|
+
| gzip-hpp | [https://github.com/mapbox/gzip-hpp](https://github.com/mapbox/gzip-hpp) | BSD-2-Clause license |
|
|
150
|
+
| doctest | [https://github.com/doctest/doctest](https://github.com/doctest/doctest) | MIT |
|