From 27554affb4d509b7526002e51e35a0677d22914f Mon Sep 17 00:00:00 2001 From: huhu5 <58477+huhu5@user.noreply.gitee.com> Date: Mon, 11 Aug 2025 06:06:54 +0000 Subject: [PATCH 1/6] sdfdsf sdfdf --- ZfAbsMean.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 ZfAbsMean.py diff --git a/ZfAbsMean.py b/ZfAbsMean.py new file mode 100644 index 00000000..77b654bc --- /dev/null +++ b/ZfAbsMean.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +""" +中性策略框架 | 邢不行 | 2024分享会 +author: 邢不行 +微信: xbx6660 +""" +import numpy as np + +""" +波动因子 +""" +def signal(*args): + df = args[0] + n = args[1] + factor_name = args[2] + + df['均价'] = (df['close'] + df['high'] + df['low']) / 3 + + df['涨跌幅'] = df['均价'].pct_change() + df['振幅'] = (df['high'] - df['low']) / df['open'] + df['振幅'] = np.where(df['涨跌幅'] > 0, df['振幅'], 0) + df['振幅均值'] = df['振幅'].rolling(n, min_periods=1).mean() + + df[factor_name] = df['振幅均值'].rolling(n, min_periods=1).rank(ascending=True, pct=True) + + return df -- Gitee From cbd17b7e09dc04ab312f0ca3662588040b4665a0 Mon Sep 17 00:00:00 2001 From: huhu5 <58477+huhu5@user.noreply.gitee.com> Date: Mon, 11 Aug 2025 06:07:14 +0000 Subject: [PATCH 2/6] Create /dist --- dist/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 dist/.keep diff --git a/dist/.keep b/dist/.keep new file mode 100644 index 00000000..e69de29b -- Gitee From 5f462d387e708ae6540a8ab9d5bbf4803f82db73 Mon Sep 17 00:00:00 2001 From: huhu5 <58477+huhu5@user.noreply.gitee.com> Date: Mon, 11 Aug 2025 06:07:35 +0000 Subject: [PATCH 3/6] dfgfd sdf --- dist/Shift_ILLQStd.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 dist/Shift_ILLQStd.py diff --git a/dist/Shift_ILLQStd.py b/dist/Shift_ILLQStd.py new file mode 100644 index 00000000..4b91dfa2 --- /dev/null +++ b/dist/Shift_ILLQStd.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +""" +轮动策略框架 | 邢不行 | 2024分享会 +author: 邢不行 +微信: xbx6660 +""" +import os +import program.Config as Cfg +import program.Functions as Func + +# 取出策略文件名中_后的部分 +stg_name = os.path.basename(__file__).split('.')[0].split('_')[1] + +# 配置子策略文件 +# key为子策略文件名,value为一个列表,可以从 多空资金曲线、多头资金曲线、空头资金曲线 选择N个 +# 各个Strategy之间需要保证 hold_period和offset 保持一致 +base_strategy_dict = { + # 'Strategy_QuoteVolumeMean': ['多空资金曲线', '多头资金曲线'], + 'Strategy_ILLQStd': ['多空资金曲线', '多头资金曲线'], +} + +# 因子信息列表 +factor_list = [('MaBias', False, 168, 1)] # 指定因子列表,可以配置多因子,和选币时的用法一致 + +# 选策略的数量 +select_num = 1 # 指定选择策略的数量;指定的数量大于1时,不会生成第二张资金曲线图 + +# 获取指定策略的hold_period、offset和资金曲线文件equity_file +hold_period, offset, if_use_spots, all_equity_file = Func.get_equity_path(base_strategy_dict, Cfg.base_config_path) -- Gitee From e311da6b069523915aca5aaca8ee47d23b975a5d Mon Sep 17 00:00:00 2001 From: huhu5 <58477+huhu5@user.noreply.gitee.com> Date: Mon, 11 Aug 2025 06:44:06 +0000 Subject: [PATCH 4/6] Create dist/ttt --- dist/ttt/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 dist/ttt/.keep diff --git a/dist/ttt/.keep b/dist/ttt/.keep new file mode 100644 index 00000000..e69de29b -- Gitee From 21405a3bfccbbee993c7aee8df093d12b0fd2af1 Mon Sep 17 00:00:00 2001 From: huhu5 <58477+huhu5@user.noreply.gitee.com> Date: Mon, 11 Aug 2025 06:44:39 +0000 Subject: [PATCH 5/6] bbn --- dist/ttt/BbiBiasTradeNumStd.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 dist/ttt/BbiBiasTradeNumStd.py diff --git a/dist/ttt/BbiBiasTradeNumStd.py b/dist/ttt/BbiBiasTradeNumStd.py new file mode 100644 index 00000000..b7b5beb9 --- /dev/null +++ b/dist/ttt/BbiBiasTradeNumStd.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +""" +中性策略框架 | 邢不行 | 2024分享会 +author: 邢不行 +微信: xbx6660 +""" + + +def signal(*args): + df = args[0] + n = args[1] + factor_name = args[2] + + ma1 = df['close'].rolling(n, min_periods=1).mean() + ma2 = df['close'].rolling(2 * n, min_periods=1).mean() + ma3 = df['close'].rolling(4 * n, min_periods=1).mean() + ma4 = df['close'].rolling(8 * n, min_periods=1).mean() + df['bbi'] = (ma1 + ma2 + ma3 + ma4) / 4 + df['bbi_bias'] = df['close'] / df['bbi'] + + df['振幅'] = (df['high'] - df['low']) / df['open'] + df['factor'] = df['trade_num'] / df['振幅'] + df[factor_name] = df['factor'].rolling(n, min_periods=1).std() * df['bbi_bias'] + + return df -- Gitee From 9989c4e35b3906d9798aab89fc78d8cebca6fc46 Mon Sep 17 00:00:00 2001 From: huhu5 <58477+huhu5@user.noreply.gitee.com> Date: Mon, 11 Aug 2025 06:52:56 +0000 Subject: [PATCH 6/6] Renamed dist to faster --- {dist => faster}/.keep | 0 {dist => faster}/Shift_ILLQStd.py | 0 {dist => faster}/ttt/.keep | 0 {dist => faster}/ttt/BbiBiasTradeNumStd.py | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename {dist => faster}/.keep (100%) rename {dist => faster}/Shift_ILLQStd.py (100%) rename {dist => faster}/ttt/.keep (100%) rename {dist => faster}/ttt/BbiBiasTradeNumStd.py (100%) diff --git a/dist/.keep b/faster/.keep similarity index 100% rename from dist/.keep rename to faster/.keep diff --git a/dist/Shift_ILLQStd.py b/faster/Shift_ILLQStd.py similarity index 100% rename from dist/Shift_ILLQStd.py rename to faster/Shift_ILLQStd.py diff --git a/dist/ttt/.keep b/faster/ttt/.keep similarity index 100% rename from dist/ttt/.keep rename to faster/ttt/.keep diff --git a/dist/ttt/BbiBiasTradeNumStd.py b/faster/ttt/BbiBiasTradeNumStd.py similarity index 100% rename from dist/ttt/BbiBiasTradeNumStd.py rename to faster/ttt/BbiBiasTradeNumStd.py -- Gitee