新增web界面管理策略

This commit is contained in:
2025-11-21 16:08:03 +08:00
parent 4b7ec4e564
commit 218ca5f533
11 changed files with 747 additions and 124 deletions

View File

@@ -6,8 +6,8 @@
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2025-11-19T07:13:51.818890Z",
"start_time": "2025-11-19T07:13:50.827090Z"
"end_time": "2025-11-21T01:54:34.434731Z",
"start_time": "2025-11-21T01:54:31.509589Z"
}
},
"source": [
@@ -44,8 +44,8 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-11-19T07:13:51.840183Z",
"start_time": "2025-11-19T07:13:51.822905Z"
"end_time": "2025-11-21T01:54:34.537950Z",
"start_time": "2025-11-21T01:54:34.445969Z"
}
},
"cell_type": "code",
@@ -79,8 +79,8 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-11-19T07:14:58.236155Z",
"start_time": "2025-11-19T07:13:51.846812Z"
"end_time": "2025-11-21T01:55:38.643534Z",
"start_time": "2025-11-21T01:54:34.551413Z"
}
},
"cell_type": "code",
@@ -148,7 +148,7 @@
"\n",
"初始化回测引擎...\n",
"模拟器初始化:初始资金=100000.00, 滑点率=0.0, 佣金率=0.0001\n",
"内存仓储已初始化管理ID: 'futures_trading_strategies.SA.Spectral.SpectralTrendStrategy.SpectralTrendStrategy_228362dc13ea83accde90203f5f5434e'\n",
"内存仓储已初始化管理ID: 'futures_trading_strategies.SA.Spectral.SpectralTrendStrategy.SpectralTrendStrategy_f774488b98ac53758169305e51fd8595'\n",
"\n",
"--- 回测引擎初始化完成 ---\n",
" 策略: SpectralTrendStrategy\n",
@@ -196,8 +196,8 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-11-19T07:15:05.968736Z",
"start_time": "2025-11-19T07:14:58.277441Z"
"end_time": "2025-11-21T01:55:46.179638Z",
"start_time": "2025-11-21T01:55:38.675521Z"
}
},
"cell_type": "code",

View File

@@ -123,10 +123,11 @@ class SpectralTrendStrategy(Strategy):
return
# 核心逻辑:相变入场/退出
if position_volume == 0:
self.evaluate_entry_signal(open_price, trend_strength, dominant_freq)
else:
self.manage_open_position(position_volume, trend_strength, dominant_freq)
if self.trading:
if position_volume == 0:
self.evaluate_entry_signal(open_price, trend_strength, dominant_freq)
else:
self.manage_open_position(position_volume, trend_strength, dominant_freq)
def calculate_trend_strength(self, prices: np.array) -> (float, float):
"""