using SqlSugar;
namespace AssetManager.Data;
///
/// 历史K线缓存表(永久存储)
///
[SugarTable("market_kline_cache")]
public class MarketKlineCache
{
///
/// 主键:md5(symbol + asset_type + timeframe + timestamp)
///
[SugarColumn(IsPrimaryKey = true, Length = 64)]
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";
///
/// 时间周期:1min/5min/1h/1d/1w等
///
[SugarColumn(Length = 16, IsNullable = false)]
public string Timeframe { get; set; } = string.Empty;
///
/// K线时间
///
[SugarColumn(IsNullable = false)]
public DateTime Timestamp { get; set; }
///
/// 开盘价
///
[SugarColumn(DecimalDigits = 8, IsNullable = false)]
public decimal Open { get; set; }
///
/// 最高价
///
[SugarColumn(DecimalDigits = 8, IsNullable = false)]
public decimal High { get; set; }
///
/// 最低价
///
[SugarColumn(DecimalDigits = 8, IsNullable = false)]
public decimal Low { get; set; }
///
/// 收盘价
///
[SugarColumn(DecimalDigits = 8, IsNullable = false)]
public decimal Close { get; set; }
///
/// 成交量
///
[SugarColumn(DecimalDigits = 8, IsNullable = true)]
public decimal? Volume { 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; }
}