using SqlSugar;
namespace AssetManager.Data;
///
/// 组合净值历史表 - 记录每日净值和收益
///
[SugarTable("portfolio_nav_history")]
public class PortfolioNavHistory
{
///
/// 主键
///
[SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
public string? Id { get; set; }
///
/// 所属组合ID
///
[SugarColumn(ColumnName = "portfolio_id", IndexGroupNameList = new string[] { "idx_portfolio_date" })]
public string? PortfolioId { get; set; }
///
/// 净值日期
///
[SugarColumn(ColumnName = "nav_date", IndexGroupNameList = new string[] { "idx_portfolio_date" })]
public DateTime NavDate { get; set; }
///
/// 总资产价值(组合本位币)
///
[SugarColumn(ColumnName = "total_value", ColumnDataType = "decimal(18,4)")]
public decimal TotalValue { get; set; }
///
/// 总投入成本(组合本位币)
///
[SugarColumn(ColumnName = "total_cost", ColumnDataType = "decimal(18,4)")]
public decimal TotalCost { get; set; }
///
/// 单位净值(初始=1.0)
///
[SugarColumn(ColumnName = "nav", ColumnDataType = "decimal(18,8)")]
public decimal Nav { get; set; }
///
/// 日收益率(%)
///
[SugarColumn(ColumnName = "daily_return", ColumnDataType = "decimal(10,4)")]
public decimal DailyReturn { get; set; }
///
/// 累计收益率(%)
///
[SugarColumn(ColumnName = "cumulative_return", ColumnDataType = "decimal(10,4)")]
public decimal CumulativeReturn { get; set; }
///
/// 本位币
///
[SugarColumn(ColumnName = "currency", Length = 10)]
public string? Currency { get; set; }
///
/// 持仓数量
///
[SugarColumn(ColumnName = "position_count")]
public int PositionCount { get; set; }
///
/// 数据来源(calculated/backfill/estimated)
///
[SugarColumn(ColumnName = "source", Length = 20)]
public string? Source { get; set; }
///
/// 创建时间
///
[SugarColumn(ColumnName = "created_at")]
public DateTime CreatedAt { get; set; }
}