// Todo: consider changing maxSequenceNo to member variable for this class instead of out param?
        public Bet[] ListBootstrapOrders(out long maxSequenceNo)
        {
            ListBootstrapOrdersRequest request = new ListBootstrapOrdersRequest();
            ListBootstrapOrdersResponse response;
            long lastSeqNoReceived = -1;
            Bet[] betsToReturn = null;

            // Keep calling until:
            //  receive an order with a squence number equal to the MaximumSequenceNumber,
            //  or stop receiving any orders (this one is unfortunate since it requires an extra wasted call),
            //  may be worth looking into whether reliable enough to assume reached limit when number
            //  returned is less than the max that can be returned with each call (usually 500).
            do
            {
                request.SequenceNumber = lastSeqNoReceived;
                response = _proxy.ListBootstrapOrders(request);
                if (response.ReturnStatus.Code != 0)
                    throw new Exception(response.ReturnStatus.Description);

                // This is an important check for breaking out of the loop
                //  in situations where the orders never reach the MaximumSequenceNumber.
                if (response.Orders == null || response.Orders.Length == 0)
                    break;

                Bet[] bets = OrderConverter.ConvertOrderCollection(response.Orders);
                betsToReturn = OrderConverter.CombineTwoBetArrays(betsToReturn, bets);

                lastSeqNoReceived = response.Orders[response.Orders.Length - 1].SequenceNumber;
            }
            while (lastSeqNoReceived < response.MaximumSequenceNumber);

            maxSequenceNo = response.MaximumSequenceNumber;
            return betsToReturn;
        }
Exemple #2
0
 /// <remarks/>
 public void ListBootstrapOrdersAsync(ListBootstrapOrdersRequest listBootstrapOrdersRequest, object userState) {
     if ((this.ListBootstrapOrdersOperationCompleted == null)) {
         this.ListBootstrapOrdersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnListBootstrapOrdersOperationCompleted);
     }
     this.InvokeAsync("ListBootstrapOrders", new object[] {
                 listBootstrapOrdersRequest}, this.ListBootstrapOrdersOperationCompleted, userState);
 }
Exemple #3
0
 /// <remarks/>
 public void ListBootstrapOrdersAsync(ListBootstrapOrdersRequest listBootstrapOrdersRequest) {
     this.ListBootstrapOrdersAsync(listBootstrapOrdersRequest, null);
 }
Exemple #4
0
 /// <remarks/>
 public System.IAsyncResult BeginListBootstrapOrders(ListBootstrapOrdersRequest listBootstrapOrdersRequest, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("ListBootstrapOrders", new object[] {
                 listBootstrapOrdersRequest}, callback, asyncState);
 }
Exemple #5
0
 public ListBootstrapOrdersResponse ListBootstrapOrders(ListBootstrapOrdersRequest listBootstrapOrdersRequest) {
     object[] results = this.Invoke("ListBootstrapOrders", new object[] {
                 listBootstrapOrdersRequest});
     return ((ListBootstrapOrdersResponse)(results[0]));
 }