Ejemplo n.º 1
0
        private void ProcessRisk(Message message)
        {
            foreach (var rule in RiskManager.ProcessRules(message))
            {
                _innerAdapter.AddWarningLog(LocalizedStrings.Str855Params,
                                            rule.GetType().GetDisplayName(), rule.Title, rule.Action);

                switch (rule.Action)
                {
                case RiskActions.ClosePositions:
                {
                    break;
                }

                case RiskActions.StopTrading:
                    _innerAdapter.SendInMessage(new DisconnectMessage());
                    break;

                case RiskActions.CancelOrders:
                    _innerAdapter.SendInMessage(new OrderGroupCancelMessage {
                        TransactionId = _innerAdapter.TransactionIdGenerator.GetNextId()
                    });
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }