P0: 移除硬编码 API Key - MarketDataService Tiingo Key 改为强制环境变量 P1: 拆分 Entity 文件 - 从 Portfolio.cs 提取 Position.cs - 从 Portfolio.cs 提取 Transaction.cs - 每个实体独立文件,符合单一职责原则
71 lines
1.9 KiB
C#
Executable File
71 lines
1.9 KiB
C#
Executable File
using SqlSugar;
|
|
|
|
namespace AssetManager.Data;
|
|
|
|
/// <summary>
|
|
/// 投资组合表
|
|
/// </summary>
|
|
[SugarTable("portfolios")]
|
|
public class Portfolio
|
|
{
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
|
|
public string? Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// 所属用户ID
|
|
/// </summary>
|
|
[SugarColumn(ColumnName = "user_id", IndexGroupNameList = new string[] { "idx_user_id" })]
|
|
public string? UserId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 所用策略ID
|
|
/// </summary>
|
|
[SugarColumn(ColumnName = "strategy_id", IndexGroupNameList = new string[] { "idx_strategy_id" })]
|
|
public string? StrategyId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 组合名称
|
|
/// </summary>
|
|
[SugarColumn(ColumnName = "name", Length = 200)]
|
|
public string? Name { get; set; }
|
|
|
|
/// <summary>
|
|
/// 组合币种 (USD/CNY等)
|
|
/// </summary>
|
|
[SugarColumn(ColumnName = "currency", Length = 10)]
|
|
public string? Currency { get; set; }
|
|
|
|
/// <summary>
|
|
/// 当前总市值 (可冗余或实时计算)
|
|
/// </summary>
|
|
[SugarColumn(ColumnName = "total_value", ColumnDataType = "decimal(18,4)")]
|
|
public decimal TotalValue { get; set; }
|
|
|
|
/// <summary>
|
|
/// 累计收益率
|
|
/// </summary>
|
|
[SugarColumn(ColumnName = "return_rate", ColumnDataType = "decimal(18,4)")]
|
|
public decimal ReturnRate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 运行状态 (运行中/监控中)
|
|
/// </summary>
|
|
[SugarColumn(ColumnName = "status", Length = 50)]
|
|
public string? Status { get; set; }
|
|
|
|
/// <summary>
|
|
/// 创建时间
|
|
/// </summary>
|
|
[SugarColumn(ColumnName = "created_at")]
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// 更新时间
|
|
/// </summary>
|
|
[SugarColumn(ColumnName = "updated_at")]
|
|
public DateTime UpdatedAt { get; set; }
|
|
}
|