public override List <OrderDone> GetMyOrdersHistoryEnd(string parameters, string ticker) { string response = DoKeyRequest(parameters); BMyOrdersHistory jdata = Newtonsoft.Json.JsonConvert.DeserializeObject <BMyOrdersHistory>(response); //lastRequestMsg = jdata.message; //lastRequestStatus = jdata.success; if (!jdata.success) { throw new MarketAPIException("Market API Error:" + jdata.message); } List <OrderDone> myOrdersHistory = new List <OrderDone>(); int n = 0; foreach (var item in jdata.result) { n++; OrderDone order = new OrderDone { uuid = item.OrderUuid, ticker = item.Exchange, doneDate = item.TimeStamp, orderType = item.OrderType, price = item.Limit, quantity = item.Quantity, quantityRemaining = item.QuantityRemaining, commission = item.Commission, totalSum = item.Price }; if (order.orderType == "LIMIT_SELL") { order.orderType = "S"; } if (order.orderType == "LIMIT_BUY") { order.orderType = "B"; } myOrdersHistory.Add(order); } myOrdersHistory = myOrdersHistory.OrderByDescending(o => o.doneDate).ToList(); return(myOrdersHistory); }
public override List <OrderDone> GetMyOrdersHistoryEnd(string parameters, string ticker) { string response = DoKeyRequest(parameters); string errmsg = ""; string errcaption = ""; BMyOrdersHistory jdata = null; try { jdata = Newtonsoft.Json.JsonConvert.DeserializeObject <BMyOrdersHistory>(response); if (!jdata.success) { errcaption = "Market API Error:"; errmsg = jdata.message; } if (jdata.result == null) { errcaption += "Market API Error:"; errmsg += "DataResult=Null >>> " + response; } } catch (Exception ex) { errcaption = "Parsing Response Error:"; errmsg = ex.Message + " >>> " + response; } if (errmsg != "") { throw new MarketAPIException(errcaption + " >> " + errmsg); } List <OrderDone> myOrdersHistory = new List <OrderDone>(); int n = 0; foreach (var item in jdata.result) { n++; OrderDone order = new OrderDone { uuid = item.OrderUuid, ticker = item.Exchange, doneDate = item.TimeStamp, orderType = item.OrderType, price = item.Limit, quantity = item.Quantity, quantityRemaining = item.QuantityRemaining, commission = item.Commission, totalSum = item.Price }; if (order.orderType == "LIMIT_SELL") { order.orderType = "S"; } if (order.orderType == "LIMIT_BUY") { order.orderType = "B"; } myOrdersHistory.Add(order); } myOrdersHistory = myOrdersHistory.OrderByDescending(o => o.doneDate).ToList(); return(myOrdersHistory); }