haha
This commit is contained in:
22
.gitignore
vendored
Normal file
22
.gitignore
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# IDE - IntelliJ IDEA / PyCharm
|
||||
.idea/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
.Python
|
||||
*.egg-info/
|
||||
.eggs/
|
||||
dist/
|
||||
build/
|
||||
venv/
|
||||
.env
|
||||
.env.local
|
||||
|
||||
# 可选:数据库文件(若不想提交到仓库可取消下一行注释)
|
||||
# models/database.db
|
||||
10
.idea/.gitignore
generated
vendored
10
.idea/.gitignore
generated
vendored
@@ -1,10 +0,0 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 已忽略包含查询文件的默认文件夹
|
||||
/queries/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
6
.idea/inspectionProfiles/profiles_settings.xml
generated
6
.idea/inspectionProfiles/profiles_settings.xml
generated
@@ -1,6 +0,0 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
8
.idea/jyx_code.iml
generated
8
.idea/jyx_code.iml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="jdk" jdkName="jyx_code4" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
7
.idea/misc.xml
generated
7
.idea/misc.xml
generated
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="jyx_code" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="jyx_code4" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/jyx_code.iml" filepath="$PROJECT_DIR$/.idea/jyx_code.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,31 +1,31 @@
|
||||
{
|
||||
"bb_period": 20,
|
||||
"bb_period": 14,
|
||||
"bb_std": 2.0,
|
||||
"keltner_period": 20,
|
||||
"keltner_period": 14,
|
||||
"keltner_atr_mult": 2.0,
|
||||
"donchian_period": 20,
|
||||
"stoch_k_period": 14,
|
||||
"stoch_d_period": 3,
|
||||
"cci_period": 20,
|
||||
"donchian_period": 30,
|
||||
"stoch_k_period": 20,
|
||||
"stoch_d_period": 5,
|
||||
"cci_period": 14,
|
||||
"willr_period": 14,
|
||||
"rsi_period": 14,
|
||||
"rsi_period": 21,
|
||||
"atr_band_period": 20,
|
||||
"atr_band_mult": 2.0,
|
||||
"zscore_period": 20,
|
||||
"lr_period": 20,
|
||||
"lr_std_mult": 2.0,
|
||||
"median_band_period": 20,
|
||||
"pct_rank_period": 20,
|
||||
"chandelier_period": 22,
|
||||
"chandelier_mult": 3.0,
|
||||
"pct_rank_period": 30,
|
||||
"chandelier_period": 14,
|
||||
"chandelier_mult": 2.5,
|
||||
"std_band_period": 14,
|
||||
"std_band_mult": 2.0,
|
||||
"elder_period": 13,
|
||||
"forward_bars": 10,
|
||||
"elder_period": 10,
|
||||
"forward_bars": 15,
|
||||
"label_threshold": 0.002,
|
||||
"prob_threshold": 0.45,
|
||||
"sl_pct": 0.004,
|
||||
"tp_pct": 0.006,
|
||||
"prob_threshold": 0.52,
|
||||
"sl_pct": 0.003,
|
||||
"tp_pct": 0.005,
|
||||
"min_hold_seconds": 180,
|
||||
"max_hold_seconds": 1800,
|
||||
"margin_per_trade": 100.0,
|
||||
@@ -34,7 +34,7 @@
|
||||
"rebate_rate": 0.9,
|
||||
"train_period": "2020-01-01 ~ 2021-01-01",
|
||||
"test_period": "2021-01-01 ~ 2022-01-01",
|
||||
"kline_period": "5m",
|
||||
"kline_period": "1h",
|
||||
"initial_balance": 10000.0,
|
||||
"max_dd_target": 500.0
|
||||
}
|
||||
@@ -41,7 +41,7 @@ NET_FEE_PER_TRADE = FULL_FEE_PER_TRADE - REBATE_PER_TRADE # 净手续费
|
||||
|
||||
# 本金与风控目标
|
||||
INITIAL_BALANCE = 10000.0 # 本金 10000 USDT
|
||||
MAX_DD_TARGET = 500.0 # 目标:可用资金最大回撤 ≤ 500 USDT
|
||||
MAX_DD_TARGET = 300.0 # 目标:可用资金最大回撤 ≤ 300 USDT
|
||||
|
||||
# 训练 / 真实回测 时间范围(左闭右开)
|
||||
TRAIN_START = '2020-01-01'
|
||||
@@ -722,18 +722,18 @@ def _grid_indicator_and_strategy(max_configs: int = 220, seed: int = 42):
|
||||
chandelier_opts = [(22, 3.0), (14, 2.5), (30, 3.5)]
|
||||
std_band_opts = [(14, 2.0), (20, 2.0), (14, 2.5)]
|
||||
elder_opts = [10, 13, 20]
|
||||
# 策略:更保守选项压低回撤(紧止损、高置信、风控参数)
|
||||
# 策略:严格风控压低回撤至300U以内(紧止损、高置信、严风控)
|
||||
label_opts = [(8, 0.0015), (10, 0.002), (10, 0.003), (15, 0.002), (20, 0.003)]
|
||||
sl_tp_opts = [
|
||||
(0.0015, 0.003), (0.002, 0.004), (0.0025, 0.005), (0.003, 0.005),
|
||||
(0.003, 0.006), (0.004, 0.006), (0.004, 0.008),
|
||||
(0.0015, 0.003), (0.002, 0.004), (0.002, 0.005), (0.0025, 0.005),
|
||||
(0.003, 0.005), (0.003, 0.006), (0.003, 0.008),
|
||||
]
|
||||
prob_opts = [0.48, 0.50, 0.52, 0.55]
|
||||
meta_th_opts = [0.50, 0.55, 0.60, 0.65]
|
||||
daily_loss_opts = [50.0, 80.0, 120.0]
|
||||
dd_breaker_opts = [300.0, 400.0, 500.0]
|
||||
cooldown_opts = [20, 30, 50]
|
||||
consec_loss_opts = [3, 5, 7]
|
||||
prob_opts = [0.50, 0.52, 0.55, 0.58]
|
||||
meta_th_opts = [0.55, 0.60, 0.65, 0.70]
|
||||
daily_loss_opts = [30.0, 40.0, 50.0, 60.0]
|
||||
dd_breaker_opts = [150.0, 200.0, 250.0, 280.0]
|
||||
cooldown_opts = [30, 50, 80]
|
||||
consec_loss_opts = [2, 3, 4]
|
||||
out = []
|
||||
for _ in range(max_configs):
|
||||
bb_p, bb_s = bb_opts[rng.integers(0, len(bb_opts))]
|
||||
@@ -819,10 +819,10 @@ def run_cycle_compare(periods: list, do_save_best: bool = True):
|
||||
trades, model, feature_cols = run_single(
|
||||
df_2020, df_2021, ind,
|
||||
forward_bars=10, label_threshold=0.002,
|
||||
prob_threshold=0.50, sl_pct=0.003, tp_pct=0.006,
|
||||
prob_threshold=0.52, sl_pct=0.003, tp_pct=0.006,
|
||||
min_hold=180, max_hold=1800,
|
||||
meta_threshold=0.55, daily_loss_limit=80.0,
|
||||
dd_circuit_breaker=400.0, cooldown_bars=30, max_consec_losses=5,
|
||||
meta_threshold=0.60, daily_loss_limit=40.0,
|
||||
dd_circuit_breaker=200.0, cooldown_bars=50, max_consec_losses=3,
|
||||
use_ensemble=True,
|
||||
)
|
||||
if not trades or model is None:
|
||||
|
||||
Reference in New Issue
Block a user