Exemplo n.º 1
0
        private void OnClosed(OrderUpdateBaseEventArgs ea)
        {
            var order = ea.Order;

            _threadSwitcher.SwitchThread(async() =>
            {
                _clientNotifyService.NotifyOrderChanged(order);

                var totalFpl = order.GetTotalFpl();
                var account  = _accountsCacheService.Get(order.ClientId, order.AccountId);
                await _accountManager.UpdateBalanceAsync(account, totalFpl, AccountHistoryType.OrderClosed,
                                                         $"Balance changed on order close (id = {order.Id})", order.Id);

                await SendOrderChangedNotification(order.ClientId, order);
            });
        }