hikyuu 2.6.8.5__py3-none-win_amd64.whl → 2.7.0__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 +31 -16
- hikyuu/__init__.pyi +610 -590
- hikyuu/analysis/__init__.pyi +584 -563
- hikyuu/analysis/analysis.pyi +585 -564
- hikyuu/core.py +2 -0
- hikyuu/core.pyi +586 -565
- 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_system-mt.dll +0 -0
- hikyuu/cpp/boost_wserialization-mt.dll +0 -0
- hikyuu/cpp/core310.pyd +0 -0
- hikyuu/cpp/core310.pyi +501 -104
- hikyuu/cpp/core311.pyd +0 -0
- hikyuu/cpp/core311.pyi +501 -104
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core312.pyi +501 -104
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core313.pyi +501 -104
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
- hikyuu/data/clickhouse_upgrade/createdb.sql +105 -105
- hikyuu/data/common.py +3 -3
- hikyuu/data/common_clickhouse.py +1 -1
- hikyuu/data/download_block.py +351 -0
- hikyuu/data/em_block_to_clickhouse.py +26 -74
- hikyuu/data/em_block_to_mysql.py +25 -75
- hikyuu/data/em_block_to_sqlite.py +26 -78
- hikyuu/data/hku_config_template.py +3 -3
- hikyuu/data/pytdx_to_clickhouse.py +15 -11
- hikyuu/data/pytdx_to_h5.py +6 -2
- hikyuu/data/pytdx_to_mysql.py +5 -1
- hikyuu/data/pytdx_weight_to_clickhouse.py +1 -1
- hikyuu/data/pytdx_weight_to_mysql.py +1 -1
- hikyuu/data/pytdx_weight_to_sqlite.py +1 -1
- hikyuu/data/zh_bond10_to_clickhouse.py +1 -1
- hikyuu/draw/drawplot/__init__.pyi +8 -8
- hikyuu/draw/drawplot/bokeh_draw.pyi +600 -580
- hikyuu/draw/drawplot/common.pyi +1 -1
- hikyuu/draw/drawplot/echarts_draw.pyi +602 -582
- hikyuu/draw/drawplot/matplotlib_draw.py +4 -74
- hikyuu/draw/drawplot/matplotlib_draw.pyi +612 -592
- hikyuu/draw/elder.pyi +11 -11
- hikyuu/draw/kaufman.pyi +18 -18
- hikyuu/draw/volume.pyi +10 -10
- hikyuu/examples/notebook/Demo/Demo1.ipynb +48 -33
- hikyuu/extend.py +0 -8
- hikyuu/extend.pyi +594 -574
- hikyuu/fetcher/stock/zh_block_em.py +12 -40
- hikyuu/gui/HikyuuTDX.py +99 -31
- hikyuu/gui/data/CollectSpotThread.py +1 -1
- hikyuu/gui/data/EscapetimeThread.py +8 -14
- hikyuu/gui/data/ImportBlockInfoTask.py +3 -10
- hikyuu/gui/data/MainWindow.py +1196 -717
- hikyuu/gui/data/SchedImportThread.py +2 -2
- hikyuu/gui/data/UsePytdxImportToH5Thread.py +3 -3
- hikyuu/gui/data/UseQmtImportToH5Thread.py +2 -2
- hikyuu/gui/data/UseTdxImportToH5Thread.py +3 -3
- hikyuu/gui/data/tool.py +32 -25
- hikyuu/gui/dataserver.py +5 -3
- hikyuu/gui/images/liandongxiaopu.png +0 -0
- hikyuu/hub.pyi +6 -6
- hikyuu/include/hikyuu/DataType.h +4 -16
- hikyuu/include/hikyuu/KData.h +6 -3
- hikyuu/include/hikyuu/KDataPrivatedBufferImp.h +1 -1
- hikyuu/include/hikyuu/KDataSharedBufferImp.h +1 -1
- hikyuu/include/hikyuu/KQuery.h +2 -2
- hikyuu/include/hikyuu/Stock.h +4 -1
- hikyuu/include/hikyuu/StockManager.h +13 -3
- hikyuu/include/hikyuu/config.h +0 -3
- hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +8 -0
- hikyuu/include/hikyuu/data_driver/BlockInfoDriver.h +6 -0
- hikyuu/include/hikyuu/data_driver/KDataDriver.h +26 -1
- hikyuu/include/hikyuu/data_driver/base_info/mysql/MySQLBaseInfoDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/base_info/sqlite/SQLiteBaseInfoDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/block_info/mysql/MySQLBlockInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/block_info/qianlong/QLBlockInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/block_info/sqlite/SQLiteBlockInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/kdata/DoNothingKDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/cvs/KDataTempCsvDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/sqlite/SQLiteKDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/tdx/TdxKDataDriver.h +1 -1
- hikyuu/include/hikyuu/hikyuu.h +1 -1
- hikyuu/include/hikyuu/indicator/build_in.h +1 -0
- hikyuu/include/hikyuu/indicator/crt/CYCLE.h +4 -4
- hikyuu/include/hikyuu/indicator/crt/HSL.h +2 -2
- hikyuu/include/hikyuu/indicator/crt/QUANTILE_TRUNC.h +30 -0
- hikyuu/include/hikyuu/indicator/crt/TURNOVER.h +1 -0
- hikyuu/include/hikyuu/indicator/crt/ZSCORE.h +2 -2
- hikyuu/include/hikyuu/indicator/imp/IQuantileTrunc.h +25 -0
- hikyuu/include/hikyuu/misc.h +38 -0
- hikyuu/include/hikyuu/plugin/dataserver.h +2 -1
- hikyuu/include/hikyuu/plugin/device.h +10 -0
- hikyuu/include/hikyuu/plugin/extind.h +37 -0
- hikyuu/include/hikyuu/plugin/interface/DataServerPluginInterface.h +2 -2
- hikyuu/include/hikyuu/plugin/interface/DevicePluginInterface.h +2 -0
- hikyuu/include/hikyuu/plugin/interface/ExtendIndicatorsPluginInterface.h +12 -0
- hikyuu/include/hikyuu/plugin/interface/plugins.h +0 -5
- hikyuu/include/hikyuu/python/pybind_utils.h +0 -12
- hikyuu/include/hikyuu/strategy/RunSystemInStrategy.h +3 -0
- hikyuu/include/hikyuu/trade_manage/Performance.h +4 -4
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +10 -1
- hikyuu/include/hikyuu/trade_sys/moneymanager/imp/FixedCapitalFundsMM.h +0 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +36 -3
- hikyuu/include/hikyuu/trade_sys/multifactor/NormalizeBase.h +125 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/ScoresFilterBase.h +125 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/build_in.h +3 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/buildin_norm.h +36 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/buildin_scfilter.h +51 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/GroupSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/IgnoreLessOrEqualValueSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/IgnoreNanSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/MinAmountPercentSCFilter.h +25 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/PriceSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/TopNSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/EqualWeightMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICIRMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/WeightMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormMinMax.h +23 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormQuantile.h +28 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormQuantileUniform.h +28 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormZScore.h +25 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/__init__.py +1 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/quantile_trunc.h +16 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +7 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/imp/SimplePortfolio.h +7 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/imp/WithoutAFPortfolio.h +7 -0
- hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +49 -0
- hikyuu/include/hikyuu/trade_sys/selector/build_in.h +1 -0
- hikyuu/include/hikyuu/trade_sys/selector/crt/SE_MultiFactor2.h +40 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +0 -3
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector2.h +49 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/logic/OperatorSelector.h +1 -1
- hikyuu/include/hikyuu/trade_sys/selector/imp/logic/OperatorValueSelector.h +1 -1
- hikyuu/include/hikyuu/trade_sys/signal/imp/BandSignal2.h +0 -4
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/AddValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/DivValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/MulValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorSignal.h +1 -1
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorValueSignal.h +4 -4
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/SubValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/slippage/build_in.h +5 -1
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_LogNormal.h +22 -0
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_Normal.h +22 -0
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_TruncNormal.h +25 -0
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_Uniform.h +23 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/LogNormalSlippage.h +28 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/NormalSlippage.h +28 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/TruncNormalSlippage.h +28 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/UniformSlippage.h +24 -0
- hikyuu/include/hikyuu/trade_sys/system/System.h +14 -1
- hikyuu/include/hikyuu/utilities/SpendTimer.h +17 -7
- hikyuu/include/hikyuu/utilities/arithmetic.h +45 -0
- hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLConnect.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLStatement.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteConnect.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteStatement.h +1 -1
- hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +4 -1
- hikyuu/include/hikyuu/version.h +5 -5
- hikyuu/plugin/backtest.dll +0 -0
- hikyuu/plugin/clickhousedriver.dll +0 -0
- hikyuu/plugin/dataserver.dll +0 -0
- hikyuu/plugin/dataserver_parquet.dll +0 -0
- hikyuu/plugin/device.dll +0 -0
- hikyuu/plugin/extind.dll +0 -0
- hikyuu/plugin/hkuextra.dll +0 -0
- hikyuu/plugin/import2hdf5.dll +0 -0
- hikyuu/plugin/tmreport.dll +0 -0
- hikyuu/trade_manage/__init__.pyi +600 -580
- hikyuu/trade_manage/broker.pyi +3 -3
- hikyuu/trade_manage/broker_easytrader.pyi +1 -1
- hikyuu/trade_manage/trade.py +0 -2
- hikyuu/trade_manage/trade.pyi +600 -580
- hikyuu/util/__init__.pyi +2 -2
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.6.8.5.dist-info → hikyuu-2.7.0.dist-info}/METADATA +36 -33
- {hikyuu-2.6.8.5.dist-info → hikyuu-2.7.0.dist-info}/RECORD +185 -168
- {hikyuu-2.6.8.5.dist-info → hikyuu-2.7.0.dist-info}/top_level.txt +2 -2
- hikyuu/cpp/core39.pyd +0 -0
- hikyuu/cpp/core39.pyi +0 -14381
- hikyuu/data_driver/__init__.py +0 -49
- hikyuu/data_driver/jqdata_data_driver.py +0 -277
- hikyuu/data_driver/pytdx_data_driver.py +0 -292
- hikyuu/fetcher/stock/zh_stock_a_huatai.py +0 -51
- hikyuu/fetcher/stock/zh_stock_a_pytdx.py +0 -129
- hikyuu/gui/data/CollectToMemThread.py +0 -123
- hikyuu/gui/data/CollectToMySQLThread.py +0 -178
- hikyuu/gui/start_huatai_insight.py +0 -510
- hikyuu/include/hikyuu/plugin/hkuviews.h +0 -36
- hikyuu/include/hikyuu/plugin/interface/HkuViewsPluginInterface.h +0 -34
- hikyuu/include/hikyuu/views/arrow_common.h +0 -38
- hikyuu/include/hikyuu/views/arrow_views.h +0 -117
- hikyuu/plugin/hkuviews.dll +0 -0
- hikyuu/tools/update_block_info.py +0 -168
- /hikyuu/include/hikyuu/{views → trade_sys/multifactor/filter}/__init__.py +0 -0
- {hikyuu-2.6.8.5.dist-info → hikyuu-2.7.0.dist-info}/WHEEL +0 -0
- {hikyuu-2.6.8.5.dist-info → hikyuu-2.7.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025 hikyuu.org
|
|
3
|
-
*
|
|
4
|
-
* Created on: 2025-08-13
|
|
5
|
-
* Author: fasiondog
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include "arrow_common.h"
|
|
11
|
-
#include "hikyuu/Stock.h"
|
|
12
|
-
#include "hikyuu/indicator/Indicator.h"
|
|
13
|
-
#include "hikyuu/trade_manage/PositionRecord.h"
|
|
14
|
-
#include "hikyuu/trade_manage/TradeRecord.h"
|
|
15
|
-
|
|
16
|
-
namespace hku {
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @ingroup Views
|
|
20
|
-
* @{
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
//-----------------------------------------------------------
|
|
24
|
-
// arrow错误时抛出异常, 其他情况仅可能返回为空表, 而不是空指针
|
|
25
|
-
//-----------------------------------------------------------
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 获取指定股票集合在指定交易日的行情数据,不包含当日停牌无数据的股票
|
|
29
|
-
* @param stks 股票列表
|
|
30
|
-
* @param date 交易日
|
|
31
|
-
* @param market 市场代码(用于获取交易日历)
|
|
32
|
-
* @return
|
|
33
|
-
*/
|
|
34
|
-
std::shared_ptr<arrow::Table> HKU_API getMarketView(const StockList& stks, const Datetime& date,
|
|
35
|
-
const string& market = "SH");
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* 获取指定股票集合在最后交易日的行情数据,不包含当日停牌无数据的股票。如自动接收行情数据,则为实时行情数据
|
|
39
|
-
* @param stks 股票列表
|
|
40
|
-
* @param market 市场代码(用于获取交易日历)
|
|
41
|
-
* @return
|
|
42
|
-
*/
|
|
43
|
-
std::shared_ptr<arrow::Table> HKU_API getMarketView(const StockList& stks,
|
|
44
|
-
const string& market = "SH");
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 计算指定证券列表的各指标结果,以 arrow table 形式返回
|
|
48
|
-
* @param stks 指定证券列表
|
|
49
|
-
* @param inds 指定指标列表
|
|
50
|
-
* @param query 查询条件
|
|
51
|
-
* @param market 指定行情市场(用于日期对齐)
|
|
52
|
-
* @return * arrow::Result<std::shared_ptr<arrow::Table>>
|
|
53
|
-
*/
|
|
54
|
-
std::shared_ptr<arrow::Table> HKU_API getIndicatorsView(const StockList& stks,
|
|
55
|
-
const IndicatorList& inds,
|
|
56
|
-
const KQuery& query,
|
|
57
|
-
const string& market = "SH");
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* 获取指定日期的各指定证券的各指标视图
|
|
61
|
-
* @param stks 证券列表
|
|
62
|
-
* @param inds 指标列表
|
|
63
|
-
* @param date 指定日期
|
|
64
|
-
* @param cal_len 计算需要的数据长度
|
|
65
|
-
* @param ktype k线类型
|
|
66
|
-
* @param market 指定行情市场(用于日期对齐)
|
|
67
|
-
* @return arrow::Result<std::shared_ptr<arrow::Table>>
|
|
68
|
-
*/
|
|
69
|
-
std::shared_ptr<arrow::Table> HKU_API getIndicatorsView(const StockList& stks,
|
|
70
|
-
const IndicatorList& inds,
|
|
71
|
-
const Datetime& date, size_t cal_len = 100,
|
|
72
|
-
const KQuery::KType& ktype = KQuery::DAY,
|
|
73
|
-
const string& market = "SH");
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Indicator转换为 Arrow Table,包含时间序列,则带有时间列,否则无时间列
|
|
77
|
-
* @param ind Indicator
|
|
78
|
-
* @return arrow::Result<std::shared_ptr<arrow::Table>>
|
|
79
|
-
*/
|
|
80
|
-
std::shared_ptr<arrow::Table> HKU_API getIndicatorView(const Indicator& ind);
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Indicator转换为 Arrow Table,仅包含值,不包含时间序列
|
|
84
|
-
* @return arrow::Result<std::shared_ptr<arrow::Table>>
|
|
85
|
-
*/
|
|
86
|
-
std::shared_ptr<arrow::Table> HKU_API getIndicatorValueView(const Indicator& ind);
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* KData 转换至 arrow table
|
|
90
|
-
* @return arrow::Result<std::shared_ptr<arrow::Table>>
|
|
91
|
-
*/
|
|
92
|
-
std::shared_ptr<arrow::Table> HKU_API getKDataView(const KData& kdata);
|
|
93
|
-
|
|
94
|
-
/** KRecordList 转换至 arrow table */
|
|
95
|
-
std::shared_ptr<arrow::Table> HKU_API getKRecordListView(const KRecordList& ks);
|
|
96
|
-
|
|
97
|
-
/** TimeLineList 转换至 arrow table */
|
|
98
|
-
std::shared_ptr<arrow::Table> HKU_API getTimeLineListView(const TimeLineList& ts);
|
|
99
|
-
|
|
100
|
-
/** TransRecordList 转换至 arrow table */
|
|
101
|
-
std::shared_ptr<arrow::Table> HKU_API getTransRecordListView(const TransRecordList& ts);
|
|
102
|
-
|
|
103
|
-
/** StockWeightList 转换至 arrow table */
|
|
104
|
-
std::shared_ptr<arrow::Table> HKU_API getStockWeightListView(const StockWeightList& sws);
|
|
105
|
-
|
|
106
|
-
/** DatetimeList 转换至 arrow table */
|
|
107
|
-
std::shared_ptr<arrow::Table> HKU_API getDatetimeListView(const DatetimeList& dates);
|
|
108
|
-
|
|
109
|
-
/** TradeRecordList 转换至 arrow table */
|
|
110
|
-
std::shared_ptr<arrow::Table> HKU_API getTradeRecordListView(const TradeRecordList& trades);
|
|
111
|
-
|
|
112
|
-
/** PositionList 转换至 arrow table */
|
|
113
|
-
std::shared_ptr<arrow::Table> HKU_API
|
|
114
|
-
getPositionRecordListView(const PositionRecordList& positions);
|
|
115
|
-
|
|
116
|
-
/** @} */
|
|
117
|
-
} // namespace hku
|
hikyuu/plugin/hkuviews.dll
DELETED
|
Binary file
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/python
|
|
2
|
-
# -*- coding: utf8 -*-
|
|
3
|
-
#
|
|
4
|
-
# Create on: 2023-12-18
|
|
5
|
-
# Author: fasiondog
|
|
6
|
-
|
|
7
|
-
import requests
|
|
8
|
-
import akshare as ak
|
|
9
|
-
from hikyuu.interactive import *
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def get_code_market_dict():
|
|
13
|
-
ret = {}
|
|
14
|
-
for s in sm:
|
|
15
|
-
if s.type in (constant.STOCKTYPE_A, constant.STOCKTYPE_A_BJ, constant.STOCKTYPE_B, constant.STOCKTYPE_GEM, constant.STOCKTYPE_START):
|
|
16
|
-
ret[s.code] = "0" if s.market == 'SH' else "1"
|
|
17
|
-
return ret
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def get_all_hybk_info():
|
|
21
|
-
code_market = get_code_market_dict()
|
|
22
|
-
blk_names = ak.stock_board_industry_name_em()['板块名称']
|
|
23
|
-
ret = {}
|
|
24
|
-
for blk_name in blk_names:
|
|
25
|
-
print(blk_name)
|
|
26
|
-
ret[blk_name] = []
|
|
27
|
-
stk_codes = ak.stock_board_industry_cons_em(blk_name)
|
|
28
|
-
stk_codes = stk_codes['代码'].to_list()
|
|
29
|
-
for stk_code in stk_codes:
|
|
30
|
-
try:
|
|
31
|
-
ret[blk_name].append(f"{code_market[stk_code]},{stk_code}")
|
|
32
|
-
except:
|
|
33
|
-
print(stk_code)
|
|
34
|
-
return ret
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def get_all_gnbk_info():
|
|
38
|
-
code_market = get_code_market_dict()
|
|
39
|
-
blk_names = ak.stock_board_concept_name_em()['板块名称']
|
|
40
|
-
ret = {}
|
|
41
|
-
for blk_name in blk_names:
|
|
42
|
-
print(blk_name)
|
|
43
|
-
ret[blk_name] = []
|
|
44
|
-
stk_codes = ak.stock_board_concept_cons_em(blk_name)
|
|
45
|
-
stk_codes = stk_codes['代码'].to_list()
|
|
46
|
-
for stk_code in stk_codes:
|
|
47
|
-
try:
|
|
48
|
-
ret[blk_name].append(f"{code_market[stk_code]},{stk_code}")
|
|
49
|
-
except:
|
|
50
|
-
print(stk_code)
|
|
51
|
-
return ret
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def get_all_dybk_info():
|
|
55
|
-
url = "http://13.push2.eastmoney.com/api/qt/clist/get"
|
|
56
|
-
params = {
|
|
57
|
-
"pn": "1",
|
|
58
|
-
"pz": "50000",
|
|
59
|
-
"po": "1",
|
|
60
|
-
"np": "1",
|
|
61
|
-
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
|
|
62
|
-
"fltt": "2",
|
|
63
|
-
"invt": "2",
|
|
64
|
-
"fid": "f3",
|
|
65
|
-
"fs": "m:90+t:1+f:!50",
|
|
66
|
-
"fields": "f12,f14",
|
|
67
|
-
# "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,"
|
|
68
|
-
# "f136,f115,f152",
|
|
69
|
-
"_": "1623833739532",
|
|
70
|
-
}
|
|
71
|
-
r = requests.get(url, params=params)
|
|
72
|
-
data_json = r.json()
|
|
73
|
-
data_json = data_json["data"]["diff"]
|
|
74
|
-
|
|
75
|
-
params = {
|
|
76
|
-
"pn": "1",
|
|
77
|
-
"pz": "2000",
|
|
78
|
-
"po": "1",
|
|
79
|
-
"np": "1",
|
|
80
|
-
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
|
|
81
|
-
"fltt": "2",
|
|
82
|
-
"invt": "2",
|
|
83
|
-
"fid": "f3",
|
|
84
|
-
# "fs": f"b:{stock_board_code} f:!50",
|
|
85
|
-
"fields": "f12",
|
|
86
|
-
"_": "1626081702127",
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
ret = {}
|
|
90
|
-
code_market = get_code_market_dict()
|
|
91
|
-
for v in data_json:
|
|
92
|
-
# print(v)
|
|
93
|
-
blk_code = v["f12"]
|
|
94
|
-
blk_name = v["f14"]
|
|
95
|
-
print(blk_name)
|
|
96
|
-
ret[blk_name] = []
|
|
97
|
-
params["fs"] = f"b:{blk_code} f:!50"
|
|
98
|
-
r = requests.get(url, params=params)
|
|
99
|
-
stk_json = r.json()
|
|
100
|
-
stk_json = stk_json["data"]["diff"]
|
|
101
|
-
|
|
102
|
-
for item in stk_json:
|
|
103
|
-
stk_code = item["f12"]
|
|
104
|
-
try:
|
|
105
|
-
ret[blk_name].append(f"{code_market[stk_code]},{stk_code}")
|
|
106
|
-
except:
|
|
107
|
-
print(stk_code)
|
|
108
|
-
return ret
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
def get_all_zsbk_info():
|
|
112
|
-
code_market = get_code_market_dict()
|
|
113
|
-
blk_info = ak.index_stock_info()
|
|
114
|
-
blk_codes = blk_info["index_code"]
|
|
115
|
-
blk_names = blk_info["display_name"]
|
|
116
|
-
ret = {}
|
|
117
|
-
total = len(blk_codes)
|
|
118
|
-
# for blk_name in blk_names:
|
|
119
|
-
for i in range(total):
|
|
120
|
-
blk_name = blk_names[i]
|
|
121
|
-
blk_code = blk_codes[i]
|
|
122
|
-
print(i, blk_name)
|
|
123
|
-
# 沪深指数有重复,避免深指覆盖
|
|
124
|
-
if blk_name in ret:
|
|
125
|
-
continue
|
|
126
|
-
try:
|
|
127
|
-
ret[blk_name] = []
|
|
128
|
-
stk_codes = ak.index_stock_cons_csindex(symbol=blk_code)
|
|
129
|
-
stk_codes = stk_codes['成分券代码'].to_list()
|
|
130
|
-
for stk_code in stk_codes:
|
|
131
|
-
try:
|
|
132
|
-
ret[blk_name].append(f"{code_market[stk_code]},{stk_code}")
|
|
133
|
-
except:
|
|
134
|
-
print(stk_code)
|
|
135
|
-
except KeyboardInterrupt:
|
|
136
|
-
exit(-1)
|
|
137
|
-
except:
|
|
138
|
-
print("Failed!", blk_code, blk_name)
|
|
139
|
-
return ret
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
def write_blk_file(blk_info, filename):
|
|
143
|
-
with open(filename, 'w', encoding='utf-8') as f:
|
|
144
|
-
for k in blk_info:
|
|
145
|
-
print(k)
|
|
146
|
-
if blk_info[k]:
|
|
147
|
-
f.write(f"[{k}]\n")
|
|
148
|
-
for code in blk_info[k]:
|
|
149
|
-
f.write(f'{code}\n')
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if __name__ == "__main__":
|
|
153
|
-
# # 更新行业板块
|
|
154
|
-
# x = get_all_hybk_info()
|
|
155
|
-
# write_blk_file(x, 'hikyuu/config/block/hybk.ini')
|
|
156
|
-
|
|
157
|
-
# # 更新概念板块
|
|
158
|
-
# x = get_all_gnbk_info()
|
|
159
|
-
# write_blk_file(x, 'hikyuu/config/block/gnbk.ini')
|
|
160
|
-
|
|
161
|
-
# # 更新地域板块
|
|
162
|
-
# x = get_all_dybk_info()
|
|
163
|
-
# write_blk_file(x, 'hikyuu/config/block/dybk.ini')
|
|
164
|
-
|
|
165
|
-
# 更新指数成分
|
|
166
|
-
x = get_all_zsbk_info()
|
|
167
|
-
write_blk_file(x, 'hikyuu/config/block/zsbk.ini')
|
|
168
|
-
# print(x)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|