Update the position count and initiator

This commit is contained in:
2025-08-15 08:47:48 +07:00
parent 7528405845
commit b4a4656b3b
21 changed files with 1617 additions and 42 deletions

View File

@@ -11,6 +11,7 @@ using Managing.Domain.MoneyManagements;
using Managing.Domain.Statistics;
using Managing.Domain.Trades;
using Managing.Domain.Users;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
@@ -300,12 +301,14 @@ namespace Managing.Infrastructure.Messengers.Discord
var exchangeService = (IExchangeService)_services.GetService(typeof(IExchangeService));
var accountService = (IAccountService)_services.GetService(typeof(IAccountService));
var tradingService = (ITradingService)_services.GetService(typeof(ITradingService));
var scopeFactory = (IServiceScopeFactory)_services.GetService(typeof(IServiceScopeFactory));
await component.RespondAsync("Alright, let met few seconds to close this position");
var position = await tradingService.GetPositionByIdentifierAsync(Guid.Parse(parameters[1]));
var command = new ClosePositionCommand(position);
var result =
await new ClosePositionCommandHandler(exchangeService, accountService, tradingService).Handle(command);
await new ClosePositionCommandHandler(exchangeService, accountService, tradingService, scopeFactory)
.Handle(command);
var fields = new List<EmbedFieldBuilder>()
{
new EmbedFieldBuilder