Remove candle from backtest

This commit is contained in:
2025-07-08 23:36:21 +07:00
parent 3439f13156
commit 9c01dce461
13 changed files with 367 additions and 68 deletions

View File

@@ -16,13 +16,15 @@ namespace Managing.Application.Abstractions.Services
/// <param name="endDate">The end date for the backtest</param>
/// <param name="user">The user running the backtest (optional)</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>
/// <returns>The backtest results</returns>
Task<Backtest> RunTradingBotBacktest(
TradingBotConfig config,
DateTime startDate,
DateTime endDate,
User user = null,
bool save = false);
bool save = false,
bool withCandles = false);
/// <summary>
/// Runs a trading bot backtest with pre-loaded candles.
@@ -31,11 +33,13 @@ namespace Managing.Application.Abstractions.Services
/// <param name="config">The trading bot configuration (must include Scenario object or ScenarioName)</param>
/// <param name="candles">The candles to use for backtesting</param>
/// <param name="user">The user running the backtest (optional)</param>
/// <param name="withCandles">Whether to include candles and indicators values in the response</param>
/// <returns>The backtest results</returns>
Task<Backtest> RunTradingBotBacktest(
TradingBotConfig config,
List<Candle> candles,
User user = null);
User user = null,
bool withCandles = false);
// Additional methods for backtest management
bool DeleteBacktest(string id);

View File

@@ -1,8 +1,10 @@
using Managing.Domain.Accounts;
using Managing.Domain.Bots;
using Managing.Domain.Candles;
using Managing.Domain.Scenarios;
using Managing.Domain.Statistics;
using Managing.Domain.Strategies;
using Managing.Domain.Strategies.Base;
using Managing.Domain.Synth.Models;
using Managing.Domain.Trades;
using Managing.Infrastructure.Evm.Models.Privy;
@@ -50,4 +52,14 @@ public interface ITradingService
Task<SynthRiskResult> MonitorSynthPositionRiskAsync(Ticker ticker, TradeDirection direction, decimal currentPrice,
decimal liquidationPrice, string positionIdentifier, TradingBotConfig botConfig);
/// <summary>
/// Calculates indicators values for a given scenario and candles.
/// </summary>
/// <param name="scenario">The scenario containing indicators.</param>
/// <param name="candles">The candles to calculate indicators for.</param>
/// <returns>A dictionary of indicator types to their calculated values.</returns>
Task<Dictionary<IndicatorType, IndicatorsResultBase>> CalculateIndicatorsValuesAsync(
Scenario scenario,
List<Candle> candles);
}