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

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