AssetManager.API/AssetManager.Data/MarketPriceCache.cs
OpenClaw Agent 1977dd609d fix: 请求收益曲线时自动回填历史数据
- GetNavHistoryAsync现在会自动检查是否有历史数据
- 无历史数据时自动调用BackfillNavHistoryInternalAsync
- 拆分内部回填方法,避免重复验证权限
2026-03-13 16:21:31 +00:00

59 lines
1.5 KiB
C#
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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; }
}