Example #1
0
        public async Task ProcessAccountStopout(AccountStopoutBackendContract stopout)
        {
            var queueName = QueueHelper.BuildQueueName(_settings.MarginTradingFront.RabbitMqQueues.AccountStopout.ExchangeName, _settings.MarginTradingFront.Env);

            _consoleWriter.WriteLine($"Get account stopout from {queueName} queue for clientId = {stopout.ClientId}");

            var notificationId = await _clientNotificationService.GetNotificationId(stopout.ClientId);

            var userTopic = _realm.Services.GetSubject <NotifyResponse <AccountStopoutClientContract> >($"user.{notificationId}");

            var response = new NotifyResponse <AccountStopoutClientContract>
            {
                Entity = stopout.ToClientContract(),
                Type   = NotifyEntityType.AccountStopout
            };

            userTopic.OnNext(response);

            _operationsLog.AddLog($"topic user.{notificationId} (account stopout)", stopout.ClientId, response.Entity.AccountId, null, response.ToJson());
            _consoleWriter.WriteLine($"topic user.{notificationId} (account stopout) for clientId = {stopout.ClientId}");

            var userUpdateTopic         = _realm.Services.GetSubject <NotifyResponse>($"user.updates.{notificationId}");
            var userUpdateTopicResponse = new NotifyResponse {
                Account = null, Order = null, AccountStopout = response.Entity
            };

            userUpdateTopic.OnNext(userUpdateTopicResponse);

            _operationsLog.AddLog($"topic user.updates.{notificationId} (account stopout)", stopout.ClientId, response.Entity.AccountId, null, userUpdateTopicResponse.ToJson());
            _consoleWriter.WriteLine($"topic user.updates.{notificationId} (account stopout) for clientId = {stopout.ClientId}");
        }
Example #2
0
 public static AccountStopoutClientContract ToClientContract(this AccountStopoutBackendContract src)
 {
     return(new AccountStopoutClientContract
     {
         AccountId = src.AccountId,
         PositionsCount = src.PositionsCount,
         TotalPnl = src.TotalPnl
     });
 }