Exemplo n.º 1
0
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="storage">Storage.</param>
        public override void Load(SettingsStorage storage)
        {
            Rules.Clear();
            Rules.AddRange(storage.GetValue <SettingsStorage[]>(nameof(Rules)).Select(s => s.LoadEntire <IRiskRule>()));

            base.Load(storage);
        }
Exemplo n.º 2
0
 /// <summary>
 /// To reset the state.
 /// </summary>
 private void Reset()
 {
     _orderStatusIds.Clear();
     _cancellationTransactions.Clear();
     _replaceTransactions.Clear();
     _replaceTransactionsByTransId.Clear();
 }
        /// <inheritdoc />
        protected override void OnSendInMessage(Message message)
        {
            switch (message.Type)
            {
            case MessageTypes.Reset:
                _subscriptions.Clear();
                break;

            case MessageTypes.MarketData:
            {
                var mdMsg = (MarketDataMessage)message;

                if (mdMsg.IsSubscribe)
                {
                    _subscriptions.Add(mdMsg.TransactionId);
                }

                break;
            }

            case ExtendedMessageTypes.EmulationState:
                SendOutMessage(message);
                return;
            }

            base.OnSendInMessage(message);
        }
Exemplo n.º 4
0
 /// <summary>
 /// To reset the state.
 /// </summary>
 private void Reset()
 {
     _cancellationTransactions.Clear();
     _orderIds.Clear();
     _orderStringIds.Clear();
     _orderStatusIds.Clear();
 }
Exemplo n.º 5
0
        private void DrawTimerOnElapsed()
        {
            try
            {
                RaiseChangedCommand();

                var elements = _changedElements.CopyAndClear();

                var candleElement = elements.OfType <ChartCandleElement>().FirstOrDefault();

                if (candleElement == null)
                {
                    foreach (var indicatorElement in elements.OfType <ChartIndicatorElement>())
                    {
                        AddIndicator(indicatorElement);
                    }
                }
                else
                {
                    _candlesCount = 0;

                    _bufferedChart.IsAutoRange = true;
                    GuiDispatcher.GlobalDispatcher.AddAction(() => IsStarted = true);

                    _skipElements.Clear();
                    _candleManager.Start((CandleSeries)_bufferedChart.GetSource(candleElement));
                }
            }
            catch (Exception ex)
            {
                ex.LogError();
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="storage">Settings storage.</param>
        public override void Load(SettingsStorage storage)
        {
            _conditionTypes.Clear();
            _conditionTypes.AddRange(storage.GetValue <IEnumerable <string> >("ConditionTypes").Select(s => s.To <Type>()));

            _conditionTypes.ForEach(AddColumns);

            base.Load(storage);
        }
Exemplo n.º 7
0
        /// <inheritdoc />
        protected override void OnSendInMessage(Message message)
        {
            switch (message.Type)
            {
            case MessageTypes.Reset:
            {
                _subscriptions.Clear();
                break;
            }

            case MessageTypes.SecurityLookup:
            {
                if (_securityProvider != null)
                {
                    var lookupMsg = (SecurityLookupMessage)message;

                    var securities = lookupMsg.SecurityId == default
                                                        ? _securityProvider.LookupAll()
                                                        : _securityProvider.Lookup(lookupMsg);

                    foreach (var security in securities)
                    {
                        SendOutMessage(security.Board.ToMessage());
                        SendOutMessage(security.ToMessage(originalTransactionId: lookupMsg.TransactionId));
                    }

                    SendOutMessage(new SecurityLookupResultMessage {
                            OriginalTransactionId = lookupMsg.TransactionId
                        });
                    return;
                }

                break;
            }

            case MessageTypes.MarketData:
            {
                var mdMsg = (MarketDataMessage)message;

                if (mdMsg.IsSubscribe)
                {
                    _subscriptions.Add(mdMsg.TransactionId);
                }

                break;
            }

            case ExtendedMessageTypes.EmulationState:
                SendOutMessage(message);
                return;
            }

            base.OnSendInMessage(message);
        }
Exemplo n.º 8
0
        private void Reset()
        {
            _transactionLogSubscriptions.Clear();
            _orderStatusIds.Clear();

            _orders.Clear();
            _secIds.Clear();

            _orderIds.Clear();
            _orderStringIds.Clear();

            lock (_nonAssociatedLock)
            {
                _nonAssociatedOrderIds.Clear();
                _nonAssociatedStringOrderIds.Clear();
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// To reset the state.
        /// </summary>
        public void Reset()
        {
            lock (_subscriptionsLock)
            {
                _subscriptions.Clear();
                _subscriptionsById.Clear();
            }

            _ticksBuffer.Clear();
            _level1Buffer.Clear();
            _candleBuffer.Clear();
            _orderLogBuffer.Clear();
            _orderBooksBuffer.Clear();
            _transactionsBuffer.Clear();
            _newsBuffer.Clear();
            _positionChangesBuffer.Clear();
        }
        private void Reset()
        {
            _transactionLogSubscriptions.Clear();
            _orderStatusIds.Clear();

            _orders.Clear();
            _secIds.Clear();

            _orderIds.Clear();
            _orderStringIds.Clear();

            _nonAssociatedByIdMyTrades.Clear();
            _nonAssociatedByStringIdMyTrades.Clear();
            _nonAssociatedByTransactionIdMyTrades.Clear();

            _nonAssociatedOrderIds.Clear();
            _nonAssociatedStringOrderIds.Clear();
        }
Exemplo n.º 11
0
        public override void Load(SettingsStorage storage)
        {
            if (storage == null)
            {
                throw new ArgumentNullException(nameof(storage));
            }

            _documents.Clear();
            _anchorables.Clear();
            _changedControls.Clear();
            _dockingControlSettings.Clear();

            CultureInfo.InvariantCulture.DoInCulture(() =>
            {
                var controls = storage.GetValue <SettingsStorage[]>("Controls");

                foreach (var settings in controls)
                {
                    try
                    {
                        var control = LoadDockingControl(settings);

                        _dockingControlSettings.Add(control, settings);
                        OpenDocumentWindow(control);
                    }
                    catch (Exception excp)
                    {
                        this.AddErrorLog(excp);
                    }
                }

                _layout = storage.GetValue <string>("Layout");

                if (!_layout.IsEmpty())
                {
                    LoadLayout(_layout);
                }
            });
        }
Exemplo n.º 12
0
 /// <summary>
 /// To reset the state.
 /// </summary>
 public void Reset()
 {
     _fullyProcessedSubscriptions.Clear();
 }
Exemplo n.º 13
0
        /// <inheritdoc />
        protected override bool OnSendInMessage(Message message)
        {
            switch (message.Type)
            {
            case MessageTypes.OrderRegister:
            {
                var regMsg = (OrderRegisterMessage)message;
                ProcessOrderMessage(regMsg.PortfolioName, regMsg);
                return(true);
            }

            case MessageTypes.OrderReplace:
            case MessageTypes.OrderCancel:
            {
                ProcessOrderMessage(((OrderMessage)message).OriginalTransactionId, message);
                return(true);
            }

            case MessageTypes.OrderPairReplace:
            {
                var ordMsg = (OrderPairReplaceMessage)message;
                ProcessOrderMessage(ordMsg.Message1.OriginalTransactionId, message);
                return(true);
            }

            case MessageTypes.OrderGroupCancel:
            {
                SendToEmulator(message);
                return(true);
            }

            case MessageTypes.Reset:
            case MessageTypes.Connect:
            case MessageTypes.Disconnect:
            {
                SendToEmulator(message);

                if (message.Type == MessageTypes.Reset)
                {
                    _subscriptionIds.Clear();
                    _emuOrderIds.Clear();
                }

                if (OwnInnerAdapter)
                {
                    return(base.OnSendInMessage(message));
                }
                else
                {
                    return(true);
                }
            }

            case MessageTypes.PortfolioLookup:
            case MessageTypes.Portfolio:
            case MessageTypes.OrderStatus:
            {
                if (OwnInnerAdapter)
                {
                    base.OnSendInMessage(message);
                }

                SendToEmulator(message);
                return(true);
            }

            case MessageTypes.SecurityLookup:
            case MessageTypes.TimeFrameLookup:
            case MessageTypes.BoardLookup:
            case MessageTypes.MarketData:
            {
                _subscriptionIds.Add(((ISubscriptionMessage)message).TransactionId);

                // sends to emu for init subscription ids
                SendToEmulator(message);

                return(base.OnSendInMessage(message));
            }

            case MessageTypes.Level1Change:
            case ExtendedMessageTypes.CommissionRule:
            {
                SendToEmulator(message);
                return(true);
            }

            default:
            {
                if (OwnInnerAdapter)
                {
                    return(base.OnSendInMessage(message));
                }

                return(true);
            }
            }
        }
Exemplo n.º 14
0
 /// <summary>
 /// Remove all subscriptions.
 /// </summary>
 public void ClearSubscriptions()
 {
     _subscriptions.Clear();
 }
Exemplo n.º 15
0
        /// <summary>
        /// Process message.
        /// </summary>
        /// <param name="message">Message.</param>
        public void SendInMessage(Message message)
        {
            if (message is null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            if (message.OfflineMode != MessageOfflineModes.None)
            {
                return;
            }

            switch (message.Type)
            {
            case MessageTypes.Reset:
            {
                _subscriptionsById.Clear();

                _ticksBuffer.Clear();
                _level1Buffer.Clear();
                _candleBuffer.Clear();
                _orderLogBuffer.Clear();
                _orderBooksBuffer.Clear();
                _transactionsBuffer.Clear();
                _newsBuffer.Clear();
                _positionChangesBuffer.Clear();

                //SendOutMessage(new ResetMessage());
                break;
            }

            case MessageTypes.OrderRegister:
            {
                var regMsg = (OrderRegisterMessage)message;

                //if (!CanStore<ExecutionMessage>(regMsg.SecurityId, ExecutionTypes.Transaction))
                //	break;

                // try - cause looped back messages from offline adapter
                _securityIds.TryAdd(regMsg.TransactionId, regMsg.SecurityId);

                _transactionsBuffer.Add(regMsg.SecurityId, new ExecutionMessage
                    {
                        ServerTime     = DateTimeOffset.Now,
                        ExecutionType  = ExecutionTypes.Transaction,
                        SecurityId     = regMsg.SecurityId,
                        TransactionId  = regMsg.TransactionId,
                        HasOrderInfo   = true,
                        OrderPrice     = regMsg.Price,
                        OrderVolume    = regMsg.Volume,
                        Currency       = regMsg.Currency,
                        PortfolioName  = regMsg.PortfolioName,
                        ClientCode     = regMsg.ClientCode,
                        BrokerCode     = regMsg.BrokerCode,
                        Comment        = regMsg.Comment,
                        Side           = regMsg.Side,
                        TimeInForce    = regMsg.TimeInForce,
                        ExpiryDate     = regMsg.TillDate,
                        Balance        = regMsg.Volume,
                        VisibleVolume  = regMsg.VisibleVolume,
                        LocalTime      = regMsg.LocalTime,
                        IsMarketMaker  = regMsg.IsMarketMaker,
                        IsMargin       = regMsg.IsMargin,
                        Slippage       = regMsg.Slippage,
                        IsManual       = regMsg.IsManual,
                        OrderType      = regMsg.OrderType,
                        UserOrderId    = regMsg.UserOrderId,
                        OrderState     = OrderStates.Pending,
                        Condition      = regMsg.Condition?.Clone(),
                        MinVolume      = regMsg.MinOrderVolume,
                        PositionEffect = regMsg.PositionEffect,
                        PostOnly       = regMsg.PostOnly,
                    });

                break;
            }

            case MessageTypes.OrderCancel:
            {
                var cancelMsg = (OrderCancelMessage)message;

                //if (!CanStore<ExecutionMessage>(cancelMsg.SecurityId, ExecutionTypes.Transaction))
                //	break;

                // try - cause looped back messages from offline adapter
                _securityIds.TryAdd(cancelMsg.TransactionId, cancelMsg.SecurityId);

                _transactionsBuffer.Add(cancelMsg.SecurityId, new ExecutionMessage
                    {
                        ServerTime            = DateTimeOffset.Now,
                        ExecutionType         = ExecutionTypes.Transaction,
                        SecurityId            = cancelMsg.SecurityId,
                        HasOrderInfo          = true,
                        TransactionId         = cancelMsg.TransactionId,
                        IsCancellation        = true,
                        OrderId               = cancelMsg.OrderId,
                        OrderStringId         = cancelMsg.OrderStringId,
                        OriginalTransactionId = cancelMsg.OriginalTransactionId,
                        OrderVolume           = cancelMsg.Volume,
                        //Side = cancelMsg.Side,
                    });

                break;
            }

            case MessageTypes.MarketData:
            {
                var mdMsg = (MarketDataMessage)message;

                if (Enabled)
                {
                    if (mdMsg.IsSubscribe)
                    {
                        _subscriptionsById.Add(mdMsg.TransactionId);
                    }
                    else
                    {
                        _subscriptionsById.Remove(mdMsg.OriginalTransactionId);
                    }
                }

                break;
            }
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Send message.
        /// </summary>
        /// <param name="message">Message.</param>
        public override void SendInMessage(Message message)
        {
            switch (message.Type)
            {
            case MessageTypes.Reset:
            {
                _subscriptions.Clear();
                _ticksBuffer.Clear();
                _level1Buffer.Clear();
                _candleBuffer.Clear();
                _orderLogBuffer.Clear();
                _orderBooksBuffer.Clear();
                _transactionsBuffer.Clear();
                _newsBuffer.Clear();
                //SendOutMessage(new ResetMessage());
                break;
            }

            case MessageTypes.OrderRegister:
                var regMsg = (OrderRegisterMessage)message;

                if (!CanStore(regMsg.SecurityId, typeof(ExecutionMessage), ExecutionTypes.Transaction))
                {
                    break;
                }

                _transactionsBuffer.Add(regMsg.SecurityId, new ExecutionMessage
                {
                    ServerTime    = DateTimeOffset.Now,
                    ExecutionType = ExecutionTypes.Transaction,
                    SecurityId    = regMsg.SecurityId,
                    HasOrderInfo  = true,
                    OrderPrice    = regMsg.Price,
                    OrderVolume   = regMsg.Volume,
                    Currency      = regMsg.Currency,
                    PortfolioName = regMsg.PortfolioName,
                    ClientCode    = regMsg.ClientCode,
                    BrokerCode    = regMsg.BrokerCode,
                    Comment       = regMsg.Comment,
                    Side          = regMsg.Side,
                    TimeInForce   = regMsg.TimeInForce,
                    ExpiryDate    = regMsg.TillDate,
                    VisibleVolume = regMsg.VisibleVolume,
                    LocalTime     = regMsg.LocalTime,
                    TransactionId = regMsg.TransactionId,
                    //RepoInfo = regMsg.RepoInfo?.Clone(),
                    //RpsInfo = regMsg.RpsInfo?.Clone(),
                });
                break;

            case MessageTypes.OrderCancel:
                var cancelMsg = (OrderCancelMessage)message;

                if (!CanStore(cancelMsg.SecurityId, typeof(ExecutionMessage), ExecutionTypes.Transaction))
                {
                    break;
                }

                _transactionsBuffer.Add(cancelMsg.SecurityId, new ExecutionMessage
                {
                    ServerTime            = DateTimeOffset.Now,
                    ExecutionType         = ExecutionTypes.Transaction,
                    SecurityId            = cancelMsg.SecurityId,
                    HasOrderInfo          = true,
                    IsCancelled           = true,
                    OrderId               = cancelMsg.OrderId,
                    OrderStringId         = cancelMsg.OrderStringId,
                    OriginalTransactionId = cancelMsg.OrderTransactionId,
                    OrderVolume           = cancelMsg.Volume,
                    //Side = cancelMsg.Side,
                });
                break;
            }

            base.SendInMessage(message);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Process message.
        /// </summary>
        /// <param name="message">Message.</param>
        public void ProcessMessage(Message message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            if (message.OfflineMode != MessageOfflineModes.None)
            {
                return;
            }

            switch (message.Type)
            {
            // in message
            case MessageTypes.Reset:
            {
                _subscriptionsById.Clear();

                _ticksBuffer.Clear();
                _level1Buffer.Clear();
                _candleBuffer.Clear();
                _orderLogBuffer.Clear();
                _orderBooksBuffer.Clear();
                _transactionsBuffer.Clear();
                _newsBuffer.Clear();
                _positionChangesBuffer.Clear();

                //SendOutMessage(new ResetMessage());
                break;
            }

            case MessageTypes.OrderRegister:
            {
                var regMsg = (OrderRegisterMessage)message;

                //if (!CanStore<ExecutionMessage>(regMsg.SecurityId, ExecutionTypes.Transaction))
                //	break;

                // try - cause looped back messages from offline adapter
                _securityIds.TryAdd(regMsg.TransactionId, regMsg.SecurityId);

                _transactionsBuffer.Add(regMsg.SecurityId, new ExecutionMessage
                    {
                        ServerTime    = DateTimeOffset.Now,
                        ExecutionType = ExecutionTypes.Transaction,
                        SecurityId    = regMsg.SecurityId,
                        TransactionId = regMsg.TransactionId,
                        HasOrderInfo  = true,
                        OrderPrice    = regMsg.Price,
                        OrderVolume   = regMsg.Volume,
                        Currency      = regMsg.Currency,
                        PortfolioName = regMsg.PortfolioName,
                        ClientCode    = regMsg.ClientCode,
                        BrokerCode    = regMsg.BrokerCode,
                        Comment       = regMsg.Comment,
                        Side          = regMsg.Side,
                        TimeInForce   = regMsg.TimeInForce,
                        ExpiryDate    = regMsg.TillDate,
                        Balance       = regMsg.Volume,
                        VisibleVolume = regMsg.VisibleVolume,
                        LocalTime     = regMsg.LocalTime,
                        IsMarketMaker = regMsg.IsMarketMaker,
                        IsMargin      = regMsg.IsMargin,
                        Slippage      = regMsg.Slippage,
                        IsManual      = regMsg.IsManual,
                        OrderType     = regMsg.OrderType,
                        UserOrderId   = regMsg.UserOrderId,
                        OrderState    = OrderStates.Pending,
                        Condition     = regMsg.Condition?.Clone(),
                    });

                break;
            }

            case MessageTypes.OrderCancel:
            {
                var cancelMsg = (OrderCancelMessage)message;

                //if (!CanStore<ExecutionMessage>(cancelMsg.SecurityId, ExecutionTypes.Transaction))
                //	break;

                // try - cause looped back messages from offline adapter
                _securityIds.TryAdd(cancelMsg.TransactionId, cancelMsg.SecurityId);

                _transactionsBuffer.Add(cancelMsg.SecurityId, new ExecutionMessage
                    {
                        ServerTime            = DateTimeOffset.Now,
                        ExecutionType         = ExecutionTypes.Transaction,
                        SecurityId            = cancelMsg.SecurityId,
                        HasOrderInfo          = true,
                        TransactionId         = cancelMsg.TransactionId,
                        IsCancellation        = true,
                        OrderId               = cancelMsg.OrderId,
                        OrderStringId         = cancelMsg.OrderStringId,
                        OriginalTransactionId = cancelMsg.OriginalTransactionId,
                        OrderVolume           = cancelMsg.Volume,
                        //Side = cancelMsg.Side,
                    });

                break;
            }

            case MessageTypes.MarketData:
            {
                var mdMsg = (MarketDataMessage)message;

                if (Enabled)
                {
                    if (mdMsg.IsSubscribe)
                    {
                        _subscriptionsById.Add(mdMsg.TransactionId);
                    }
                    else
                    {
                        _subscriptionsById.Remove(mdMsg.OriginalTransactionId);
                    }
                }

                break;
            }

            // out messages
            case MessageTypes.Level1Change:
            {
                var level1Msg = (Level1ChangeMessage)message;

                if (CanStore(level1Msg))
                {
                    _level1Buffer.Add(level1Msg.SecurityId, level1Msg.TypedClone());
                }

                break;
            }

            case MessageTypes.QuoteChange:
            {
                var quotesMsg = (QuoteChangeMessage)message;

                if (CanStore(quotesMsg))
                {
                    _orderBooksBuffer.Add(quotesMsg.SecurityId, quotesMsg.TypedClone());
                }

                break;
            }

            case MessageTypes.Execution:
            {
                var execMsg = (ExecutionMessage)message;

                DataBuffer <SecurityId, ExecutionMessage> buffer;

                var secId    = execMsg.SecurityId;
                var execType = execMsg.ExecutionType;

                switch (execType)
                {
                case ExecutionTypes.Tick:
                    buffer = _ticksBuffer;
                    break;

                case ExecutionTypes.Transaction:
                {
                    // some responses do not contains sec id
                    if (secId.IsDefault() && !_securityIds.TryGetValue(execMsg.OriginalTransactionId, out secId))
                    {
                        return;
                    }

                    buffer = _transactionsBuffer;
                    break;
                }

                case ExecutionTypes.OrderLog:
                    buffer = _orderLogBuffer;
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(message), execType, LocalizedStrings.Str1695Params.Put(message));
                }

                //if (execType == ExecutionTypes.Transaction && execMsg.TransactionId == 0)
                //	break;

                if (execType == ExecutionTypes.Transaction || CanStore(execMsg))
                {
                    buffer.Add(secId, execMsg.TypedClone());
                }

                break;
            }

            case MessageTypes.News:
            {
                var newsMsg = (NewsMessage)message;

                if (CanStore(newsMsg))
                {
                    _newsBuffer.Add(newsMsg.TypedClone());
                }

                break;
            }

            case MessageTypes.PositionChange:
            {
                var posMsg = (PositionChangeMessage)message;
                var secId  = posMsg.SecurityId;

                //if (CanStore<PositionChangeMessage>(secId))
                _positionChangesBuffer.Add(secId, posMsg.TypedClone());

                break;
            }

            default:
            {
                if (message is CandleMessage candleMsg && candleMsg.State == CandleStates.Finished)
                {
                    if (CanStore(candleMsg))
                    {
                        _candleBuffer.Add(Tuple.Create(candleMsg.SecurityId, candleMsg.GetType(), candleMsg.Arg), candleMsg.TypedClone());
                    }
                }

                break;
            }
            }
        }
Exemplo n.º 18
0
 public void Clear() => set.Clear();
Exemplo n.º 19
0
		/// <inheritdoc />
		protected override void OnSendInMessage(Message message)
		{
			switch (message.Type)
			{
				case MessageTypes.Reset:
				{
					ClearSubscriptions();

					_ticksBuffer.Clear();
					_level1Buffer.Clear();
					_candleBuffer.Clear();
					_orderLogBuffer.Clear();
					_orderBooksBuffer.Clear();
					_transactionsBuffer.Clear();
					_newsBuffer.Clear();
					_positionChangesBuffer.Clear();
					//SendOutMessage(new ResetMessage());
					break;
				}

				case MessageTypes.OrderRegister:
					var regMsg = (OrderRegisterMessage)message;

					//if (!CanStore<ExecutionMessage>(regMsg.SecurityId, ExecutionTypes.Transaction))
					//	break;

					// try - cause looped back messages from offline adapter
					_securityIds.TryAdd(regMsg.TransactionId, regMsg.SecurityId);

					_transactionsBuffer.Add(regMsg.SecurityId, new ExecutionMessage
					{
						ServerTime = DateTimeOffset.Now,
						ExecutionType = ExecutionTypes.Transaction,
						SecurityId = regMsg.SecurityId,
						TransactionId = regMsg.TransactionId,
						HasOrderInfo = true,
						OrderPrice = regMsg.Price,
						OrderVolume = regMsg.Volume,
						Currency = regMsg.Currency,
						PortfolioName = regMsg.PortfolioName,
						ClientCode = regMsg.ClientCode,
						BrokerCode = regMsg.BrokerCode,
						Comment = regMsg.Comment,
						Side = regMsg.Side,
						TimeInForce = regMsg.TimeInForce,
						ExpiryDate = regMsg.TillDate,
						Balance = regMsg.Volume,
						VisibleVolume = regMsg.VisibleVolume,
						LocalTime = regMsg.LocalTime,
						IsMarketMaker = regMsg.IsMarketMaker,
						IsMargin = regMsg.IsMargin,
						Slippage = regMsg.Slippage,
						IsManual = regMsg.IsManual,
						OrderType = regMsg.OrderType,
						UserOrderId = regMsg.UserOrderId,
						OrderState = OrderStates.Pending,
						Condition = regMsg.Condition?.Clone(),
					});
					break;
				case MessageTypes.OrderCancel:
					var cancelMsg = (OrderCancelMessage)message;

					//if (!CanStore<ExecutionMessage>(cancelMsg.SecurityId, ExecutionTypes.Transaction))
					//	break;

					// try - cause looped back messages from offline adapter
					_securityIds.TryAdd(cancelMsg.TransactionId, cancelMsg.SecurityId);

					_transactionsBuffer.Add(cancelMsg.SecurityId, new ExecutionMessage
					{
						ServerTime = DateTimeOffset.Now,
						ExecutionType = ExecutionTypes.Transaction,
						SecurityId = cancelMsg.SecurityId,
						HasOrderInfo = true,
						TransactionId = cancelMsg.TransactionId,
						IsCancellation = true,
						OrderId = cancelMsg.OrderId,
						OrderStringId = cancelMsg.OrderStringId,
						OriginalTransactionId = cancelMsg.OriginalTransactionId,
						OrderVolume = cancelMsg.Volume,
						//Side = cancelMsg.Side,
					});
					break;
			}

			base.OnSendInMessage(message);
		}