protected override ETradeResponse ExecuteNextPartInternal(ETradeApi api)
        {
            Exception ex;

            var result = PerformApiRequest(() => api.ProductLookup(_criteria), out ex);

            return(ETradeResponse.Create(this, result, ex));
        }
Esempio n. 2
0
        protected override ETradeResponse ExecuteNextPartInternal(ETradeApi api)
        {
            Exception ex;

            var result = PerformApiRequest(() => api.GetRateLimitStatus(_moduleName), out ex);

            return(ETradeResponse.Create(this, result, ex));
        }
Esempio n. 3
0
        protected override ETradeResponse ExecuteNextPartInternal(ETradeApi api)
        {
            Exception ex;

            var result = PerformApiRequest(() => api.CancelOrder(_orderId, _portfolioName), out ex);

            return(ETradeResponse.Create(this, result, ex));
        }
Esempio n. 4
0
        protected override ETradeResponse ExecuteNextPartInternal(ETradeApi api)
        {
            Exception ex;

            var result = PerformApiRequest(() => api.SendOrderChange(_oldOrderId, _newOrder), out ex);

            return(ETradeResponse.Create(this, result, ex));
        }
        protected override ETradeResponse ExecuteNextPartInternal(ETradeApi api)
        {
            Exception ex;

            var result = PerformApiRequest(api.GetAccounts, out ex);

            return(ETradeResponse.Create(this, result, ex));
        }
        protected override ETradeResponse ExecuteNextPartInternal(ETradeApi api)
        {
            Exception ex;

            var result = PerformApiRequest(() => api.GetPositions(PortfolioName, ref _marker), out ex);

            if (result == null)
            {
                result = new List <PositionInfo>();
            }

            return(ETradeResponse.Create(this, result, ex));
        }
Esempio n. 7
0
        protected override ETradeResponse ExecuteNextPartInternal(ETradeApi api)
        {
            Exception ex;

            var result = PerformApiRequest(() =>
                                           api.GetOrderList(PortfolioName, _orderCounter == 0 ? _firstRequestCount : MaxAllowedOrderCount, ref _marker),
                                           out ex);

            if (_marker.IsEmpty())
            {
                _done = true;
            }

            if (ex == null)
            {
                for (var i = 0; i < result.Count; ++i)
                {
                    var nativeOrder = result[i];
                    if (nativeOrder == null)
                    {
                        continue;
                    }

                    if (!ETradeUtil.IsOrderInFinalState(nativeOrder))
                    {
                        FoundOldestIncompleteOrderPosition = _orderCounter + i;
                        FoundOldestIncompleteOrderId       = nativeOrder.orderId;
                    }

                    if (nativeOrder.orderId == _oldestIncompleteOrderId)
                    {
                        _done = true;
                        break;
                    }
                }

                _orderCounter += result.Count;
            }

            if (result != null)
            {
                result.RemoveAll(o => o == null);
            }
            else
            {
                result = new List <Order>();
            }

            return(ETradeResponse.Create(this, result, ex));
        }