protected override void OnInnerAdapterNewMessage(IMessageAdapter innerAdapter, Message message) { switch (message.Type) { case MessageTypes.Connect: case MessageTypes.Disconnect: base.OnInnerAdapterNewMessage(innerAdapter, message); break; case MessageTypes.Execution: { var execMsg = (ExecutionMessage)message; if (execMsg.ExecutionType != ExecutionTypes.Order && execMsg.ExecutionType != ExecutionTypes.Trade) { if (innerAdapter != InnerAdapters.LastOrDefault()) return; } base.OnInnerAdapterNewMessage(innerAdapter, message); break; } default: { // на выход данные идут только из одного адаптера if (innerAdapter != InnerAdapters.LastOrDefault()) return; base.OnInnerAdapterNewMessage(innerAdapter, message); break; } } }
protected override void OnInnerAdapterNewOutMessage(IMessageAdapter innerAdapter, Message message) { switch (message.Type) { case MessageTypes.Connect: case MessageTypes.Disconnect: break; case MessageTypes.Security: case MessageTypes.Board: case MessageTypes.Level1Change: case MessageTypes.QuoteChange: case MessageTypes.Time: { if (message.Adapter == _parent.MarketDataAdapter) { SendMessageToEmulationAdapters(message); } break; } case MessageTypes.Execution: { if (message.Adapter != _parent.MarketDataAdapter) { var execMsg = (ExecutionMessage)message; if (execMsg.ExecutionType != ExecutionTypes.Transaction) { if (innerAdapter != InnerAdapters.LastOrDefault()) { return; } } } else { SendMessageToEmulationAdapters(message); } break; } default: { if (message is CandleMessage) { if (message.Adapter != _parent.MarketDataAdapter) { break; } SendMessageToEmulationAdapters(message); return; } break; } } base.OnInnerAdapterNewOutMessage(innerAdapter, message); }