- GetNavHistoryAsync现在会自动检查是否有历史数据 - 无历史数据时自动调用BackfillNavHistoryInternalAsync - 拆分内部回填方法,避免重复验证权限
59 lines
1.5 KiB
C#
Executable File
59 lines
1.5 KiB
C#
Executable File
using SqlSugar;
|
||
|
||
namespace AssetManager.Data;
|
||
|
||
/// <summary>
|
||
/// 实时价格缓存表
|
||
/// </summary>
|
||
[SugarTable("market_price_cache")]
|
||
public class MarketPriceCache
|
||
{
|
||
/// <summary>
|
||
/// 主键:md5(symbol + asset_type)
|
||
/// </summary>
|
||
[SugarColumn(IsPrimaryKey = true, Length = 32)]
|
||
public string Id { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 标的代码(如 AAPL、BTC-USDT)
|
||
/// </summary>
|
||
[SugarColumn(Length = 32, IsNullable = false)]
|
||
public string Symbol { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 资产类型:Stock/Crypto
|
||
/// </summary>
|
||
[SugarColumn(Length = 16, IsNullable = false, DefaultValue = "Stock")]
|
||
public string AssetType { get; set; } = "Stock";
|
||
|
||
/// <summary>
|
||
/// 最新价格
|
||
/// </summary>
|
||
[SugarColumn(DecimalDigits = 8, Length = 18, IsNullable = false)]
|
||
public decimal Price { get; set; }
|
||
|
||
/// <summary>
|
||
/// 前收盘价(计算当日涨跌幅用)
|
||
/// </summary>
|
||
[SugarColumn(DecimalDigits = 8, Length = 18, IsNullable = true)]
|
||
public decimal? PreviousClose { get; set; }
|
||
|
||
/// <summary>
|
||
/// 数据源:Tiingo/OKX/Mock
|
||
/// </summary>
|
||
[SugarColumn(Length = 32, IsNullable = false)]
|
||
public string Source { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 数据获取时间
|
||
/// </summary>
|
||
[SugarColumn(IsNullable = false)]
|
||
public DateTime FetchedAt { get; set; }
|
||
|
||
/// <summary>
|
||
/// 过期时间
|
||
/// </summary>
|
||
[SugarColumn(IsNullable = false)]
|
||
public DateTime ExpiredAt { get; set; }
|
||
}
|