using SqlSugar; namespace AssetManager.Data; /// /// 实时价格缓存表 /// [SugarTable("market_price_cache")] public class MarketPriceCache { /// /// 主键:md5(symbol + asset_type) /// [SugarColumn(IsPrimaryKey = true, Length = 32)] public string Id { get; set; } = string.Empty; /// /// 标的代码(如 AAPL、BTC-USDT) /// [SugarColumn(Length = 32, IsNullable = false)] public string Symbol { get; set; } = string.Empty; /// /// 资产类型:Stock/Crypto /// [SugarColumn(Length = 16, IsNullable = false, DefaultValue = "Stock")] public string AssetType { get; set; } = "Stock"; /// /// 最新价格 /// [SugarColumn(DecimalDigits = 8, Length = 18, IsNullable = false)] public decimal Price { get; set; } /// /// 前收盘价(计算当日涨跌幅用) /// [SugarColumn(DecimalDigits = 8, Length = 18, IsNullable = true)] public decimal? PreviousClose { get; set; } /// /// 数据源:Tiingo/OKX/Mock /// [SugarColumn(Length = 32, IsNullable = false)] public string Source { get; set; } = string.Empty; /// /// 数据获取时间 /// [SugarColumn(IsNullable = false)] public DateTime FetchedAt { get; set; } /// /// 过期时间 /// [SugarColumn(IsNullable = false)] public DateTime ExpiredAt { get; set; } }