- GetNavHistoryAsync现在会自动检查是否有历史数据 - 无历史数据时自动调用BackfillNavHistoryInternalAsync - 拆分内部回填方法,避免重复验证权限
83 lines
2.2 KiB
C#
Executable File
83 lines
2.2 KiB
C#
Executable File
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; }
|
||
}
|