-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #213 from fasiondog/feature/factor
add AF_MultiFactor/SE_MultiFactor//SG_Allways_buy
- Loading branch information
Showing
38 changed files
with
456 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
hikyuu_cpp/hikyuu/trade_sys/allocatefunds/crt/AF_MultiFactor.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright (c) 2024 hikyuu.org | ||
* | ||
* Created on: 2024-03-30 | ||
* Author: fasiondog | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "../AllocateFundsBase.h" | ||
|
||
namespace hku { | ||
|
||
/** | ||
* 创建 MultiFactor 评分权重的资产分配算法实例 | ||
* @return AFPtr | ||
* @ingroup AllocateFunds | ||
*/ | ||
AFPtr HKU_API AF_MultiFactor(); | ||
|
||
} // namespace hku |
25 changes: 25 additions & 0 deletions
25
hikyuu_cpp/hikyuu/trade_sys/allocatefunds/imp/MultiFactorAllocaterFunds.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (c) 2024 hikyuu.org | ||
* | ||
* Created on: 2024-03-30 | ||
* Author: fasiondog | ||
*/ | ||
|
||
#include "MultiFactorAllocaterFunds.h" | ||
|
||
namespace hku { | ||
|
||
MultiFactorAllocaterFunds::MultiFactorAllocaterFunds() : AllocateFundsBase("AF_Multi_factor") {} | ||
|
||
MultiFactorAllocaterFunds::~MultiFactorAllocaterFunds() {} | ||
|
||
SystemWeightList MultiFactorAllocaterFunds::_allocateWeight(const Datetime& date, | ||
const SystemWeightList& se_list) { | ||
return se_list; | ||
} | ||
|
||
AFPtr HKU_API AF_MultiFactor() { | ||
return make_shared<MultiFactorAllocaterFunds>(); | ||
} | ||
|
||
} // namespace hku |
23 changes: 23 additions & 0 deletions
23
hikyuu_cpp/hikyuu/trade_sys/allocatefunds/imp/MultiFactorAllocaterFunds.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) 2024 hikyuu.org | ||
* | ||
* Created on: 2024-03-30 | ||
* Author: fasiondog | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "../AllocateFundsBase.h" | ||
|
||
namespace hku { | ||
|
||
class MultiFactorAllocaterFunds : public AllocateFundsBase { | ||
ALLOCATEFUNDS_IMP(MultiFactorAllocaterFunds) | ||
ALLOCATEFUNDS_NO_PRIVATE_MEMBER_SERIALIZATION | ||
|
||
public: | ||
MultiFactorAllocaterFunds(); | ||
virtual ~MultiFactorAllocaterFunds(); | ||
}; | ||
|
||
} // namespace hku |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2024 hikyuu.org | ||
* | ||
* Created on: 2024-03-30 | ||
* Author: fasiondog | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "hikyuu/trade_sys/multifactor/MultiFactorBase.h" | ||
#include "../SelectorBase.h" | ||
|
||
namespace hku { | ||
|
||
/** | ||
* 基于 MultiFactor 选股算法 | ||
* @param mf MultiFactor 实例 | ||
* @param topn 只选取时间截面中前 topn 个系统 | ||
* @return SelectorPtr | ||
* @ingroup Selector | ||
*/ | ||
SelectorPtr HKU_API SE_MultiFactor(const MFPtr& mf, int topn = 10); | ||
|
||
/** | ||
* 基于 MultiFactor 选股算法 | ||
* @param src_inds 原始因子公式 | ||
* @param stks 证券列表 | ||
* @param query 查询条件 | ||
* @param topn 只选取时间截面中前 topn 个系统 | ||
* @param ic_n ic 对应的 ic_n 日收益率 | ||
* @param ic_rolling_n 计算滚动 IC (即 IC 的 n 日移动平均)周期 | ||
* @param ref_stk 参照对比证券,未指定时,默认使用 sh000300 沪深300指数 | ||
* @param mode "MF_ICIRWeight" | "MF_ICWeight" | "MF_EqualWeight" 因子合成算法名称 | ||
* @return SelectorPtr | ||
* @ingroup Selector | ||
*/ | ||
SelectorPtr HKU_API SE_MultiFactor(const IndicatorList& src_inds, const StockList& stks, | ||
const KQuery& query, int topn = 10, int ic_n = 5, | ||
int ic_rolling_n = 120, const Stock& ref_stk = Stock(), | ||
const string& mode = "MF_ICIRWeight"); | ||
|
||
} // namespace hku |
Oops, something went wrong.