Exemplo n.º 1
0
        private async Task ProcessAccountsSetChange(string clientId, IReadOnlyList <MarginTradingAccount> allClientsAccounts = null)
        {
            if (allClientsAccounts == null)
            {
                allClientsAccounts = (await _repository.GetAllAsync(clientId)).Select(MarginTradingAccount.Create).ToList();
            }

            _accountsCacheService.UpdateAccountsCache(clientId, allClientsAccounts);
            await _rabbitMqNotifyService.UserUpdates(false, true, new[] { clientId });
        }
Exemplo n.º 2
0
        public async Task NotifyTradingConditionsChanged(string tradingConditionId = null, string accountId = null)
        {
            if (!string.IsNullOrEmpty(tradingConditionId))
            {
                var clientIds = _accountsCacheService
                                .GetClientIdsByTradingConditionId(tradingConditionId, accountId).ToArray();

                if (clientIds.Length > 0)
                {
                    await _rabbitMqNotifyService.UserUpdates(true, false, clientIds);

                    _consoleWriter.WriteLine(
                        $"send user updates to queue {QueueHelper.BuildQueueName(_marginSettings.RabbitMqQueues.UserUpdates.ExchangeName, _marginSettings.Env)}");
                }
            }
        }