AssetManager.API/AssetManager.Models/DTOs/StrategyDTO.cs
OpenClaw Agent 9b576de069 fix: 策略相关修复
1. GetPortfolioDetailAsync: 移除硬编码逻辑模型信息
   - 根据策略ID从数据库读取真实策略信息
   - 无策略时返回 null,前端显示'未绑定策略'

2. GetStrategies: 修复返回格式
   - 改为返回 { items: [...] } 格式,匹配前端期望
   - 修复 StrategyListResponse.Items 类型为 StrategyListItemDto
2026-03-25 07:52:13 +00:00

175 lines
4.2 KiB
C#
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace AssetManager.Models.DTOs;
/// <summary>
/// 策略列表响应
/// </summary>
public class StrategyListResponse
{
public List<StrategyListItemDto>? Items { get; set; }
}
/// <summary>
/// 策略项
/// </summary>
public class StrategyItem
{
public string? Id { get; set; }
public string? IconChar { get; set; }
public string? Title { get; set; }
public string? Tag { get; set; }
public string? Desc { get; set; }
public string? BgClass { get; set; }
public string? TagClass { get; set; }
public string? BtnText { get; set; }
public string? BtnClass { get; set; }
public string[]? Tags { get; set; }
}
/// <summary>
/// 策略详情
/// </summary>
public class StrategyDetail
{
public string? Id { get; set; }
public string? IconChar { get; set; }
public string? Title { get; set; }
public string? Tag { get; set; }
public string? Desc { get; set; }
public string? BgClass { get; set; }
public string? TagClass { get; set; }
public string[]? Tags { get; set; }
public string? BtnText { get; set; }
public string? BtnClass { get; set; }
public object? Parameters { get; set; }
public object? Backtest { get; set; }
}
/// <summary>
/// 策略详情响应
/// </summary>
public class StrategyDetailResponse
{
public string? Id { get; set; }
public string? IconChar { get; set; }
public string? Title { get; set; }
public string? RiskLevel { get; set; }
public string? Description { get; set; }
public List<string>? Tags { get; set; }
public List<ParameterItem>? Parameters { get; set; }
}
/// <summary>
/// 参数项
/// </summary>
public class ParameterItem
{
public string? Name { get; set; }
public string? DisplayName { get; set; }
public string? Type { get; set; }
public string? Value { get; set; }
}
/// <summary>
/// 创建策略请求
/// </summary>
public class CreateStrategyRequest
{
public string? Name { get; set; }
public string? Type { get; set; }
public string? Description { get; set; }
public string? RiskLevel { get; set; }
public List<string>? Tags { get; set; }
public object? Parameters { get; set; }
}
/// <summary>
/// 策略响应
/// </summary>
public class StrategyResponse
{
public string? Id { get; set; }
public string? Title { get; set; }
public string? Status { get; set; }
}
/// <summary>
/// 更新策略请求
/// </summary>
public class UpdateStrategyRequest
{
public string? Name { get; set; }
public string? Type { get; set; }
public string? Description { get; set; }
public string? RiskLevel { get; set; }
public List<string>? Tags { get; set; }
public object? Parameters { get; set; }
}
/// <summary>
/// 删除策略响应
/// </summary>
public class DeleteStrategyResponse
{
public string? Id { get; set; }
public string? Status { get; set; }
}
/// <summary>
/// 策略列表项 DTO
/// </summary>
public class StrategyListItemDto
{
public string? Id { get; set; }
public string? UserId { get; set; }
public string? Name { get; set; }
public string? Type { get; set; }
public string? Description { get; set; }
public List<string>? Tags { get; set; }
public string? RiskLevel { get; set; }
public string? Config { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
/// <summary>
/// 策略信号响应
/// </summary>
public class StrategySignalResponse
{
/// <summary>
/// 信号类型buy / sell / hold / rebalance
/// </summary>
public string? Signal { get; set; }
/// <summary>
/// 信号原因说明
/// </summary>
public string? Reason { get; set; }
/// <summary>
/// 建议操作(可选)
/// </summary>
public List<SignalAction>? Actions { get; set; }
}
/// <summary>
/// 信号行动建议
/// </summary>
public class SignalAction
{
/// <summary>
/// 股票代码
/// </summary>
public string? Symbol { get; set; }
/// <summary>
/// 行动类型buy / sell
/// </summary>
public string? Action { get; set; }
/// <summary>
/// 目标权重或数量
/// </summary>
public double? Target { get; set; }
}