Add spot trading

This commit is contained in:
2025-12-02 14:38:54 +07:00
parent 9f4aa16997
commit c932fef289
3 changed files with 724 additions and 2 deletions

View File

@@ -531,7 +531,14 @@ public class LiveTradingBotGrain : Grain, ILiveTradingBotGrain, IRemindable
using var scope = _scopeFactory.CreateScope();
var logger = scope.ServiceProvider.GetRequiredService<ILogger<TradingBotBase>>();
var streamProvider = this.GetStreamProvider("ManagingStreamProvider");
var tradingBot = new FuturesBot(logger, _scopeFactory, config, streamProvider);
// Create the trading bot instance based on TradingType
TradingBotBase tradingBot = config.TradingType switch
{
TradingType.Futures => new FuturesBot(logger, _scopeFactory, config, streamProvider),
TradingType.Spot => new SpotBot(logger, _scopeFactory, config, streamProvider),
_ => throw new InvalidOperationException($"Unsupported TradingType for live trading: {config.TradingType}")
};
// Load state into the trading bot instance
LoadStateIntoTradingBot(tradingBot);