Skip to content

Commit

Permalink
Merge pull request #266 from fasiondog/release
Browse files Browse the repository at this point in the history
Release 2.1.0
  • Loading branch information
fasiondog authored Jun 17, 2024
2 parents 92dce67 + c84b47d commit 4982fa1
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 24 deletions.
8 changes: 4 additions & 4 deletions docs/source/indicator/indicator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@

BLOCKSET(block, query)

BLOCKSET(category, name, query)
BLOCKSET(stks, query)

:param Block block: 待统计的板块
:param Block block | sequence stks: 待统计的板块 或 stock list
:param Query query: 统计范围


Expand Down Expand Up @@ -538,9 +538,9 @@

INSUM(block, query, ind, mode)

INSUM(category, name, query, ind, mode)
INSUM(stks, query, ind, mode)

:param Block block: 指定板块
:param Block block | sequence stks: 指定板块 或 证券列表
:param Query query: 指定范围
:param Indicator ind: 指定指标
:param int mode: 计算类型:0-累加,1-平均数,2-最大值,3-最小值.
Expand Down
25 changes: 25 additions & 0 deletions docs/source/release.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
版本发布说明
=======================

2.1.0 - 2024年6月18日
-------------------------

1. 新增特性
Selector 支持 +-*/、AND、OR 操作,方便验证共振
2. 缺陷修复
- fixed 北交所92号段历史财务信息导入
- fixed 对 etf 缩股的复权处理错误
- fixed INSUM 在某些股票无数据时的报错
- fixed getSystemPartName/getSystemPartEnum 缺失 PF
- fixed PF 处理立即买入/延迟卖出的系统
- fixed analysis 在 k 线无数据时报错
- fixed get_current_hub 获取当前 hub 名称时错误
- fixed 通达信本地数据导入时导入历史财务数据的进度通知消息

3. 功能优化
- 优化 INSUM, BLOCKSETNUM 可直接输入 stock list, 可以忽略 query 参数
- 优化 HikyuuTDX,避免目录不存在时导入
- 优化 SE_MultiFactor 以更好的适应 PF
- 优化 performance 绘图,参考标的累积收益率使用等比后复权计算
- 优化程序退出:非内存泄漏检测模式下由OS系统快速释放内存资源
- 优化泄漏检测工程;清理优化clang、cppcheck编译告警;优化shared_ptr创建


2.0.9 - 2024年5月27日
-------------------------

Expand Down
19 changes: 17 additions & 2 deletions docs/source/trade_portfolio/selector.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. py:currentmodule:: hikyuu.trade_sys
.. highlight:: python

选择器策略
=============
选择器算法组件
================

实现标的、系统策略的评估和选取算法。

Expand All @@ -29,6 +29,21 @@
:param System sys: 系统策略原型
:return: SE选择器实例

.. py:function:: SE_MultiFactor(inds[, topn=10, ic_n=5, ic_rolling_n=120, ref_stk=None, mode="MF_ICIRWeight"])
创建基于多因子评分的选择器,两种创建方式:

- 直接指定 MF: SE_MultiFactor(mf, topn=10)
- 参数直接创建: SE_MultiFactor(inds, topn=10, ic_n=5, ic_rolling_n=120, ref_stk=None, mode="MF_ICIRWeight")

:param sequense(Indicator) inds: 原始因子列表
:param int topn: 只选取时间截面中前 topn 个系统, 小于等于0时代表不限制
:param int ic_n: 默认 IC 对应的 N 日收益率
:param int ic_rolling_n: IC 滚动周期
:param Stock ref_stk: 参考证券 (未指定时,默认为 sh000300 沪深300)
:param str mode: "MF_ICIRWeight" | "MF_ICWeight" | "MF_EqualWeight" 因子合成算法名称
:return: SE选择器实例


自定义选择器策略
--------------------
Expand Down
23 changes: 6 additions & 17 deletions hikyuu_cpp/hikyuu/trade_sys/selector/imp/OperatorSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ std::unordered_set<System*> OperatorSelector::findIntersection(const SelectorPtr
const auto& sys_list1 = se1->getProtoSystemList();
const auto& sys_list2 = se2->getProtoSystemList();
for (const auto& sys1 : sys_list1) {
for (const auto sys2 : sys_list2) {
for (const auto& sys2 : sys_list2) {
if (sys1 == sys2) {
ret.insert(sys1.get());
}
Expand Down Expand Up @@ -52,37 +52,26 @@ OperatorSelector::OperatorSelector(const string& name, const SelectorPtr& se1,
: SelectorBase(name), m_se1(se1), m_se2(se2) {
auto inter = findIntersection(se1, se2);
if (se1 && se2) {
// m_se1 = se1->clone();
// m_se1->removeAll();
// m_se2 = se2->clone();
// m_se2->removeAll();

std::map<System*, SYSPtr> tmpdict;
const auto& raw_sys_list1 = se1->getProtoSystemList();
for (const auto& sys : raw_sys_list1) {
// auto tmpsys = sys->clone();
const auto& tmpsys = sys;
m_pro_sys_list.emplace_back(tmpsys);
// m_se1->addSystem(tmpsys);
m_se1_set.insert(tmpsys);
m_pro_sys_list.emplace_back(sys);
m_se1_set.insert(sys);
if (inter.find(sys.get()) != inter.end()) {
tmpdict[sys.get()] = tmpsys;
tmpdict[sys.get()] = sys;
}
}

const auto& raw_sys_list2 = se2->getProtoSystemList();
for (size_t i = 0, total = raw_sys_list2.size(); i < total; i++) {
const auto& sys = raw_sys_list2[i];
// auto tmpsys = sys->clone();
const auto& tmpsys = sys;
auto iter = inter.find(sys.get());
if (iter == inter.end()) {
m_pro_sys_list.emplace_back(tmpsys);
m_se2_set.insert(tmpsys);
m_pro_sys_list.emplace_back(sys);
m_se2_set.insert(sys);
} else {
m_se2_set.insert(tmpdict[*iter]);
}
// m_se2->addSystem(tmpsys);
}

} else if (se1) {
Expand Down
2 changes: 1 addition & 1 deletion xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ set_project("hikyuu")
add_rules("mode.debug", "mode.release")

-- version
set_version("2.0.9", {build = "%Y%m%d%H%M"})
set_version("2.1.0", {build = "%Y%m%d%H%M"})

if get_config("leak_check") then
-- 需要 export LD_PRELOAD=libasan.so
Expand Down

0 comments on commit 4982fa1

Please sign in to comment.