Пример #1
0
            private void ProcessSecurityMarketData(Security security, MarketDataTypes dataType, Security subscriber)
            {
                var message = new MarketDataMessage
                {
                    DataType    = dataType,
                    IsSubscribe = true,
                    //SecurityId = _connector.GetSecurityId(subscriber),
                    TransactionId = _connector.TransactionIdGenerator.GetNextId()
                };

                switch (dataType)
                {
                case MarketDataTypes.Trades:
                    message.Arg = ExecutionTypes.Tick;
                    break;

                case MarketDataTypes.OrderLog:
                    message.Arg = ExecutionTypes.OrderLog;
                    break;
                }

                message.FillSecurityInfo(_connector, subscriber);

                if (security == null)
                {
                    message.Error = new ArgumentException(LocalizedStrings.Str692Params.Put(message.SecurityId, _connector.Name));
                    _connector.SendOutMessage(message);
                }
                else
                {
                    _connector.SendInMessage(message);
                }
            }
Пример #2
0
            private void ProcessSecurityMarketData(Security security, MarketDataMessage message /*, Security subscriber*/)
            {
                //var message = new MarketDataMessage
                //{
                //	DataType = dataType,
                //	IsSubscribe = true,
                //	//SecurityId = _connector.GetSecurityId(subscriber),
                //	TransactionId = _connector.TransactionIdGenerator.GetNextId()
                //};

                //switch (dataType)
                //{
                //	case MarketDataTypes.Trades:
                //		message.Arg = ExecutionTypes.Tick;
                //		break;
                //	case MarketDataTypes.OrderLog:
                //		message.Arg = ExecutionTypes.OrderLog;
                //		break;
                //}

                //message.FillSecurityInfo(_connector, subscriber);

                if (security == null)
                {
                    var reply = new MarketDataMessage
                    {
                        OriginalTransactionId = message.TransactionId,
                        Error = new ArgumentException(LocalizedStrings.Str692Params.Put(message.SecurityId, _connector.Name))
                    };
                    _connector.SendOutMessage(reply);
                }
                else
                {
                    _connector.SendInMessage(message);
                }
            }