hikyuu 2.6.5__py3-none-win_amd64.whl → 2.6.6__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/__init__.py +6 -0
- hikyuu/__init__.pyi +548 -545
- hikyuu/analysis/__init__.pyi +519 -518
- hikyuu/analysis/analysis.pyi +520 -519
- hikyuu/core.pyi +521 -520
- hikyuu/cpp/__init__.pyi +2 -2
- 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/core310.pyi +35 -25
- hikyuu/cpp/core311.pyd +0 -0
- hikyuu/cpp/core311.pyi +35 -25
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core312.pyi +35 -25
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core313.pyi +35 -25
- hikyuu/cpp/core39.pyd +0 -0
- hikyuu/cpp/core39.pyi +35 -25
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/cpp/i18n/__init__.py +0 -0
- hikyuu/cpp/i18n/zh_CN.mo +0 -0
- hikyuu/cpp/sqlite3.dll +0 -0
- hikyuu/data/clickhouse_upgrade/__init__.py +1 -0
- hikyuu/data/clickhouse_upgrade/createdb.sql +1085 -0
- hikyuu/data/common_clickhouse.py +512 -0
- hikyuu/data/em_block_to_clickhouse.py +120 -0
- hikyuu/data/hku_config_template.py +58 -3
- hikyuu/data/pytdx_finance_to_clickhouse.py +107 -0
- hikyuu/data/pytdx_to_clickhouse.py +841 -0
- hikyuu/data/pytdx_to_mysql.py +4 -4
- hikyuu/data/pytdx_weight_to_clickhouse.py +191 -0
- hikyuu/data/tdx_to_clickhouse.py +448 -0
- hikyuu/data/zh_bond10_to_clickhouse.py +49 -0
- hikyuu/draw/drawplot/__init__.pyi +9 -9
- hikyuu/draw/drawplot/bokeh_draw.pyi +537 -534
- hikyuu/draw/drawplot/common.pyi +1 -1
- hikyuu/draw/drawplot/echarts_draw.pyi +539 -536
- hikyuu/draw/drawplot/matplotlib_draw.pyi +549 -546
- hikyuu/draw/elder.pyi +11 -11
- hikyuu/draw/kaufman.pyi +18 -18
- hikyuu/draw/volume.pyi +10 -10
- hikyuu/extend.pyi +527 -526
- hikyuu/fetcher/stock/zh_stock_a_pytdx.py +9 -20
- hikyuu/fetcher/stock/zh_stock_a_qmt.py +4 -5
- hikyuu/fetcher/stock/zh_stock_a_sina_qq.py +16 -60
- hikyuu/flat/Spot.py +96 -200
- hikyuu/gui/HikyuuTDX.py +132 -3
- hikyuu/gui/data/ImportBlockInfoTask.py +11 -0
- hikyuu/gui/data/ImportHistoryFinanceTask.py +15 -1
- hikyuu/gui/data/ImportPytdxTimeToH5Task.py +11 -1
- hikyuu/gui/data/ImportPytdxToH5Task.py +13 -1
- hikyuu/gui/data/ImportPytdxTransToH5Task.py +11 -1
- hikyuu/gui/data/ImportTdxToH5Task.py +13 -1
- hikyuu/gui/data/ImportWeightToSqliteTask.py +14 -1
- hikyuu/gui/data/ImportZhBond10Task.py +11 -0
- hikyuu/gui/data/MainWindow.py +76 -12
- hikyuu/gui/data/UsePytdxImportToH5Thread.py +45 -26
- hikyuu/gui/data/UseTdxImportToH5Thread.py +19 -1
- hikyuu/gui/dataserver.py +12 -4
- hikyuu/gui/spot_server.py +30 -40
- hikyuu/gui/start_qmt.py +20 -3
- hikyuu/hub.pyi +6 -6
- hikyuu/include/hikyuu/DataType.h +11 -0
- hikyuu/include/hikyuu/StockManager.h +8 -0
- hikyuu/include/hikyuu/data_driver/kdata/mysql/KRecordTable.h +1 -0
- hikyuu/include/hikyuu/global/GlobalSpotAgent.h +1 -1
- hikyuu/include/hikyuu/global/SpotRecord.h +15 -31
- hikyuu/include/hikyuu/global/agent/spot_generated.h +48 -232
- hikyuu/include/hikyuu/global/schedule/scheduler.h +1 -1
- hikyuu/include/hikyuu/plugin/KDataToHdf5Importer.h +3 -0
- hikyuu/include/hikyuu/plugin/dataserver.h +26 -1
- hikyuu/include/hikyuu/plugin/device.h +2 -1
- hikyuu/include/hikyuu/plugin/interface/DataDriverPluginInterface.h +27 -0
- hikyuu/include/hikyuu/plugin/interface/DataServerPluginInterface.h +2 -1
- hikyuu/include/hikyuu/plugin/interface/DevicePluginInterface.h +1 -1
- hikyuu/include/hikyuu/plugin/interface/ImportKDataToHdf5PluginInterface.h +3 -0
- hikyuu/include/hikyuu/plugin/interface/plugins.h +2 -0
- hikyuu/include/hikyuu/strategy/Strategy.h +0 -9
- hikyuu/include/hikyuu/utilities/config.h +1 -1
- hikyuu/include/hikyuu/utilities/mo/mo.h +30 -14
- hikyuu/include/hikyuu/utilities/os.h +6 -0
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/plugin/backtest.dll +0 -0
- hikyuu/plugin/clickhousedriver.dll +0 -0
- hikyuu/plugin/dataserver.dll +0 -0
- hikyuu/plugin/device.dll +0 -0
- hikyuu/plugin/extind.dll +0 -0
- hikyuu/plugin/import2hdf5.dll +0 -0
- hikyuu/plugin/tmreport.dll +0 -0
- hikyuu/trade_manage/__init__.pyi +537 -534
- hikyuu/trade_manage/broker.pyi +3 -3
- hikyuu/trade_manage/broker_easytrader.pyi +1 -1
- hikyuu/trade_manage/trade.pyi +537 -534
- hikyuu/util/__init__.py +1 -0
- hikyuu/util/__init__.pyi +4 -3
- hikyuu/util/check.py +8 -0
- hikyuu/util/check.pyi +5 -1
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.6.5.dist-info → hikyuu-2.6.6.dist-info}/METADATA +2 -2
- {hikyuu-2.6.5.dist-info → hikyuu-2.6.6.dist-info}/RECORD +106 -95
- {hikyuu-2.6.5.dist-info → hikyuu-2.6.6.dist-info}/top_level.txt +2 -2
- hikyuu/include/hikyuu/global/agent/hikyuu/__init__.py +0 -1
- hikyuu/include/hikyuu/global/agent/hikyuu/flat/__init__.py +0 -1
- {hikyuu-2.6.5.dist-info → hikyuu-2.6.6.dist-info}/LICENSE +0 -0
- {hikyuu-2.6.5.dist-info → hikyuu-2.6.6.dist-info}/WHEEL +0 -0
- {hikyuu-2.6.5.dist-info → hikyuu-2.6.6.dist-info}/entry_points.txt +0 -0
|
@@ -145,6 +145,60 @@ pwd = {pwd}
|
|
|
145
145
|
|
|
146
146
|
"""
|
|
147
147
|
|
|
148
|
+
clickhouse_template = """
|
|
149
|
+
[hikyuu]
|
|
150
|
+
tmpdir = {dir}
|
|
151
|
+
datadir = {dir}
|
|
152
|
+
quotation_server = {quotation_server}
|
|
153
|
+
|
|
154
|
+
[block]
|
|
155
|
+
type = clickhouse
|
|
156
|
+
host = {host}
|
|
157
|
+
port = {port}
|
|
158
|
+
usr = {usr}
|
|
159
|
+
pwd = {pwd}
|
|
160
|
+
|
|
161
|
+
[preload]
|
|
162
|
+
day = {day}
|
|
163
|
+
week = {week}
|
|
164
|
+
month = {month}
|
|
165
|
+
quarter = {quarter}
|
|
166
|
+
halfyear = {halfyear}
|
|
167
|
+
year = {year}
|
|
168
|
+
min = {min1}
|
|
169
|
+
min5 = {min5}
|
|
170
|
+
min15 = {min15}
|
|
171
|
+
min30 = {min30}
|
|
172
|
+
min60 = {min60}
|
|
173
|
+
hour2 = {hour2}
|
|
174
|
+
day_max = {day_max}
|
|
175
|
+
week_max = {week_max}
|
|
176
|
+
month_max = {month_max}
|
|
177
|
+
quarter_max = {quarter_max}
|
|
178
|
+
halfyear_max = {halfyear_max}
|
|
179
|
+
year_max = {year_max}
|
|
180
|
+
min_max = {min1_max}
|
|
181
|
+
min5_max = {min5_max}
|
|
182
|
+
min15_max = {min15_max}
|
|
183
|
+
min30_max = {min30_max}
|
|
184
|
+
min60_max = {min60_max}
|
|
185
|
+
hour2_max = {hour2_max}
|
|
186
|
+
|
|
187
|
+
[baseinfo]
|
|
188
|
+
type = clickhouse
|
|
189
|
+
host = {host}
|
|
190
|
+
port = {port}
|
|
191
|
+
usr = {usr}
|
|
192
|
+
pwd = {pwd}
|
|
193
|
+
|
|
194
|
+
[kdata]
|
|
195
|
+
type = clickhouse
|
|
196
|
+
host = {host}
|
|
197
|
+
port = {port}
|
|
198
|
+
usr = {usr}
|
|
199
|
+
pwd = {pwd}
|
|
200
|
+
"""
|
|
201
|
+
|
|
148
202
|
|
|
149
203
|
import_config_template = """
|
|
150
204
|
[quotation]
|
|
@@ -187,17 +241,18 @@ dir = {dir}
|
|
|
187
241
|
|
|
188
242
|
[mysql]
|
|
189
243
|
enable = False
|
|
190
|
-
;tmpdir = D:/stock
|
|
244
|
+
;tmpdir = D:/stock/
|
|
191
245
|
;host = 127.0.0.1
|
|
192
246
|
;port = 3306
|
|
193
247
|
;usr = root
|
|
194
248
|
;pwd =
|
|
195
249
|
|
|
196
|
-
[
|
|
250
|
+
[clickhouse]
|
|
197
251
|
enable = False
|
|
198
252
|
;tmpdir = D:/stock
|
|
199
253
|
;host = 127.0.0.1
|
|
200
|
-
|
|
254
|
+
:http_port = 8123
|
|
255
|
+
;port = 9000
|
|
201
256
|
;usr = root
|
|
202
257
|
;pwd =
|
|
203
258
|
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
#
|
|
3
|
+
# The MIT License (MIT)
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2010-2019 fasiondog/hikyuu
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
|
|
25
|
+
from hikyuu.data.common import MARKET, historyfinancialreader, get_a_stktype_list
|
|
26
|
+
from hikyuu.data.common_pytdx import to_pytdx_market
|
|
27
|
+
from hikyuu.util import *
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@hku_catch(trace=True)
|
|
31
|
+
def pytdx_import_finance_to_clickhouse(db_connect, pytdx_connect, market):
|
|
32
|
+
"""导入公司财务信息"""
|
|
33
|
+
sql = "select code from hku_base.stock where market='{}' and type in {} and valid=1"\
|
|
34
|
+
.format(market, get_a_stktype_list())
|
|
35
|
+
a = db_connect.query(sql)
|
|
36
|
+
all_list = a.result_rows
|
|
37
|
+
# print(all_list)
|
|
38
|
+
|
|
39
|
+
records = []
|
|
40
|
+
for stk in all_list:
|
|
41
|
+
x = pytdx_connect.get_finance_info(to_pytdx_market(market), stk[0])
|
|
42
|
+
if x is not None and x['code'] == stk[0]:
|
|
43
|
+
sql = f"select updated_date from hku_base.stkfinance where market='{market}' and code='{stk[0]}' and updated_date={x['updated_date']}"
|
|
44
|
+
a = db_connect.query(sql)
|
|
45
|
+
a = a.result_rows
|
|
46
|
+
if a:
|
|
47
|
+
continue
|
|
48
|
+
records.append(
|
|
49
|
+
(
|
|
50
|
+
market, stk[0], x['updated_date'], x['ipo_date'], x['province'], x['industry'], x['zongguben'],
|
|
51
|
+
x['liutongguben'], x['guojiagu'], x['faqirenfarengu'], x['farengu'], x['bgu'], x['hgu'],
|
|
52
|
+
x['zhigonggu'], x['zongzichan'], x['liudongzichan'], x['gudingzichan'], x['wuxingzichan'],
|
|
53
|
+
x['gudongrenshu'], x['liudongfuzhai'], x['changqifuzhai'], x['zibengongjijin'], x['jingzichan'],
|
|
54
|
+
x['zhuyingshouru'], x['zhuyinglirun'], x['yingshouzhangkuan'], x['yingyelirun'], x['touzishouyu'],
|
|
55
|
+
x['jingyingxianjinliu'], x['zongxianjinliu'], x['cunhuo'], x['lirunzonghe'], x['shuihoulirun'],
|
|
56
|
+
x['jinglirun'], x['weifenpeilirun'], x['meigujingzichan'], x['baoliu2']
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
if records:
|
|
61
|
+
ic = db_connect.create_insert_context(table='stkfinance', database='hku_base',
|
|
62
|
+
data=records)
|
|
63
|
+
db_connect.insert(context=ic)
|
|
64
|
+
return len(records)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def history_finance_import_clickhouse(connect, filename):
|
|
68
|
+
file_date = filename[-12:-4]
|
|
69
|
+
ret = historyfinancialreader(filename)
|
|
70
|
+
buf = []
|
|
71
|
+
for v in ret:
|
|
72
|
+
buf.append((v[1][:2], v[1][2:], v[2], v[3], file_date))
|
|
73
|
+
if len(ret) > 0:
|
|
74
|
+
connect.command(f"delete from hku_base.historyfinance where file_date={file_date}")
|
|
75
|
+
ic = connect.create_insert_context(table='historyfinance', database='hku_base',
|
|
76
|
+
column_names=['market', 'code', 'report_date', 'values', 'file_date'],
|
|
77
|
+
data=buf)
|
|
78
|
+
connect.insert(context=ic)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
import os
|
|
83
|
+
from configparser import ConfigParser
|
|
84
|
+
dev_config = ConfigParser()
|
|
85
|
+
dev_config.read(os.path.expanduser("~") + '/workspace/dev.ini')
|
|
86
|
+
db = 'clickhouse54-http'
|
|
87
|
+
user = dev_config.get(db, 'user')
|
|
88
|
+
password = dev_config.get(db, 'pwd')
|
|
89
|
+
host = dev_config.get(db, 'host')
|
|
90
|
+
port = dev_config.getint(db, 'port')
|
|
91
|
+
|
|
92
|
+
import clickhouse_connect
|
|
93
|
+
client = clickhouse_connect.get_client(
|
|
94
|
+
host=host, username=user, password=password)
|
|
95
|
+
|
|
96
|
+
tdx_server = "180.101.48.170"
|
|
97
|
+
tdx_port = 7709
|
|
98
|
+
|
|
99
|
+
quotations = ["stock", "fund"]
|
|
100
|
+
from pytdx.hq import TdxHq_API, TDXParams
|
|
101
|
+
api = TdxHq_API()
|
|
102
|
+
api.connect(tdx_server, tdx_port)
|
|
103
|
+
|
|
104
|
+
# pytdx_import_finance_to_clickhouse(client, api, "BJ")
|
|
105
|
+
history_finance_import_clickhouse(client, "/Users/fasiondog/stock/downloads/finance/gpcw20121231.dat")
|
|
106
|
+
|
|
107
|
+
client.close()
|