Add filters and sorting for backtests
This commit is contained in:
@@ -36,6 +36,28 @@ public class BacktestEntity
|
||||
[Column(TypeName = "jsonb")]
|
||||
public string ConfigJson { get; set; } = string.Empty;
|
||||
|
||||
// Denormalized bot/backtest name (e.g., "MyBundleTest #3") for sorting/filtering
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
// Denormalized ticker string for fast filtering/sorting
|
||||
[Required]
|
||||
[MaxLength(32)]
|
||||
public string Ticker { get; set; } = string.Empty;
|
||||
|
||||
// Stored timeframe as enum numeric value for direct sorting/filtering
|
||||
[Required]
|
||||
public int Timeframe { get; set; }
|
||||
|
||||
// Comma-separated indicator types for filtering, e.g., "EMA_CROSS,MACD_CROSS"
|
||||
[Column(TypeName = "text")]
|
||||
public string IndicatorsCsv { get; set; } = string.Empty;
|
||||
|
||||
// Number of indicators used in the scenario for sorting/filtering
|
||||
[Required]
|
||||
public int IndicatorsCount { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column(TypeName = "jsonb")]
|
||||
public string PositionsJson { get; set; } = string.Empty;
|
||||
@@ -50,6 +72,10 @@ public class BacktestEntity
|
||||
[Required]
|
||||
public DateTime EndDate { get; set; }
|
||||
|
||||
// Precomputed for filtering: EndDate - StartDate
|
||||
[Required]
|
||||
public TimeSpan Duration { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column(TypeName = "jsonb")]
|
||||
public string MoneyManagementJson { get; set; } = string.Empty;
|
||||
@@ -63,6 +89,19 @@ public class BacktestEntity
|
||||
[Column(TypeName = "jsonb")]
|
||||
public string? StatisticsJson { get; set; }
|
||||
|
||||
// Extracted metrics for efficient querying/indexing
|
||||
[Required]
|
||||
[Column(TypeName = "decimal(18,8)")]
|
||||
public decimal SharpeRatio { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column(TypeName = "decimal(18,8)")]
|
||||
public decimal MaxDrawdown { get; set; }
|
||||
|
||||
// PostgreSQL maps TimeSpan to interval
|
||||
[Required]
|
||||
public TimeSpan MaxDrawdownRecoveryTime { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column(TypeName = "decimal(18,8)")]
|
||||
public decimal Fees { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user