* Start building with orlean * Add missing file * Serialize grain state * Remove grain and proxies * update and add plan * Update a bit * Fix backtest grain * Fix backtest grain * Clean a bit
45 lines
1.9 KiB
C#
45 lines
1.9 KiB
C#
using Managing.Domain.Backtests;
|
|
using Managing.Domain.Bots;
|
|
using Managing.Domain.Candles;
|
|
using Managing.Domain.Users;
|
|
using Orleans;
|
|
|
|
namespace Managing.Application.Abstractions.Grains;
|
|
|
|
/// <summary>
|
|
/// Orleans grain interface for Backtest TradingBot operations.
|
|
/// This interface extends ITradingBotGrain with backtest-specific functionality.
|
|
/// </summary>
|
|
public interface IBacktestTradingBotGrain : IGrainWithGuidKey
|
|
{
|
|
/// <summary>
|
|
/// Runs a complete backtest following the exact pattern of GetBacktestingResult from Backtester.cs
|
|
/// </summary>
|
|
/// <param name="config">The trading bot configuration for this backtest</param>
|
|
/// <param name="candles">The candles to use for backtesting</param>
|
|
/// <param name="user">The user running the backtest (optional, required for saving)</param>
|
|
/// <param name="save">Whether to save the backtest results</param>
|
|
/// <param name="withCandles">Whether to include candles and indicators values in the response</param>
|
|
/// <param name="requestId">The request ID to associate with this backtest</param>
|
|
/// <param name="metadata">Additional metadata to associate with this backtest</param>
|
|
/// <returns>The complete backtest result</returns>
|
|
Task<LightBacktest> RunBacktestAsync(TradingBotConfig config, List<Candle> candles, User user = null, bool save = false, bool withCandles = false, string requestId = null, object metadata = null);
|
|
|
|
/// <summary>
|
|
/// Gets the current backtest progress
|
|
/// </summary>
|
|
/// <returns>Backtest progress information</returns>
|
|
Task<BacktestProgress> GetBacktestProgressAsync();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents the progress of a backtest
|
|
/// </summary>
|
|
public class BacktestProgress
|
|
{
|
|
public bool IsInitialized { get; set; }
|
|
public int TotalCandles { get; set; }
|
|
public int ProcessedCandles { get; set; }
|
|
public double ProgressPercentage { get; set; }
|
|
public bool IsComplete { get; set; }
|
|
} |