From 61e3023837a42c4abf05d01fa90ea4d2e59d5a14 Mon Sep 17 00:00:00 2001 From: OpenClaw Agent Date: Sun, 15 Mar 2026 13:14:22 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E7=9A=84=20StrategySignalResponse=20DTO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 StrategySignalResponse 类(策略信号响应) - 新增 SignalAction 类(信号行动建议) - 修正 PortfolioFacade 属性名为 PascalCase --- AssetManager.Models/DTOs/StrategyDTO.cs | 42 ++++++++++++++++++++++++ AssetManager.Services/PortfolioFacade.cs | 4 +-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/AssetManager.Models/DTOs/StrategyDTO.cs b/AssetManager.Models/DTOs/StrategyDTO.cs index bf72fd6..eaabcb0 100755 --- a/AssetManager.Models/DTOs/StrategyDTO.cs +++ b/AssetManager.Models/DTOs/StrategyDTO.cs @@ -130,3 +130,45 @@ public class StrategyListItemDto public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } } + +/// +/// 策略信号响应 +/// +public class StrategySignalResponse +{ + /// + /// 信号类型:buy / sell / hold / rebalance + /// + public string? Signal { get; set; } + + /// + /// 信号原因说明 + /// + public string? Reason { get; set; } + + /// + /// 建议操作(可选) + /// + public List? Actions { get; set; } +} + +/// +/// 信号行动建议 +/// +public class SignalAction +{ + /// + /// 股票代码 + /// + public string? Symbol { get; set; } + + /// + /// 行动类型:buy / sell + /// + public string? Action { get; set; } + + /// + /// 目标权重或数量 + /// + public double? Target { get; set; } +} diff --git a/AssetManager.Services/PortfolioFacade.cs b/AssetManager.Services/PortfolioFacade.cs index a0339df..0cfcad1 100644 --- a/AssetManager.Services/PortfolioFacade.cs +++ b/AssetManager.Services/PortfolioFacade.cs @@ -98,14 +98,14 @@ public class PortfolioFacade : IPortfolioFacade var portfolio = _databaseService.GetPortfolioById(portfolioId, userId); if (portfolio == null || string.IsNullOrEmpty(portfolio.StrategyId)) { - return new StrategySignalResponse { signal = "hold", reason = "未绑定策略" }; + return new StrategySignalResponse { Signal = "hold", Reason = "未绑定策略" }; } // 获取策略 var strategy = await _strategyService.GetStrategyByIdAsync(portfolio.StrategyId, userId); if (strategy == null) { - return new StrategySignalResponse { signal = "hold", reason = "策略不存在" }; + return new StrategySignalResponse { Signal = "hold", Reason = "策略不存在" }; } // 计算信号