public BusinessEntities.Order GetLocalOrder(OEC.API.Version version, bool create = true)
            {
                if (_versionOrderSet.ContainsKey(version))
                {
                    return(_versionOrderSet[version]);
                }

                _connector.AddWarningLog("GetLocalOrder({0}): заявка не найдена", version.ToString());

                if (!create || version.ID <= 0)
                {
                    return(null);
                }

                try
                {
                    var portfolio = _connector.FindPortfolioByAccount(version.Order.Account, null);
                    var security  = _connector.FindSecurityByContract(version.Order.Contract);
                    var vercopy   = version;
                    var orderType = version.Type.ToStockSharp();
                    var order     = _connector.GetOrder(security, orderType, version.ID, id =>
                    {
                        var ord = _connector.EntityFactory.CreateOrder(security, orderType, vercopy.ID);
                        ord.Id  = id;
                        // TODO
                        //_connector.InitNewOrder(ord);
                        return(ord);
                    }, ord =>
                    {
                        ord.Portfolio = portfolio;
                        ord.Security  = security;
                        ord.CopyFromOECOrderVersion(vercopy);

                        return(true);
                    });

                    BindOrderToOecOrderVersion(order, version);

                    return(order);
                }
                catch (Exception ex)
                {
                    var msg = "Ошибка создания заявки S# по OEC версии '{0}': {1}".Put(version.ToString(), ex);
                    _connector.AddWarningLog(msg);
                    _connector.TransactionAdapter.SendOutMessage(new ErrorMessage {
                        Error = ex
                    });

                    return(null);
                }
            }
            public void BindOrderToOecOrderVersion(BusinessEntities.Order order, OEC.API.Version ver)
            {
                if (ver.ID > 0)
                {
                    order.Id = ver.ID;
                }

                if (_versionOrderSet.ContainsKey(ver))
                {
                    if (_versionOrderSet[ver] != order)
                    {
                        _connector.AddWarningLog("Старая версия заявки не была удалена из коллекции.");
                        _versionOrderSet.Remove(ver);
                        _versionOrderSet[ver] = order;
                    }
                }
                else
                {
                    _versionOrderSet[ver] = order;
                }
            }