public override List <OpenOrder> GetOpenOrdersEnd(string parameters, string ticker) { string response = DoKeyRequest(parameters); CheckResponseAndThrow(response); YActiveOrders jdata = null; try { jdata = Newtonsoft.Json.JsonConvert.DeserializeObject <YActiveOrders>(response); } catch (Exception ex) { throw new MarketAPIException("Parsing Response Error" + " >>>> " + ex.Message + " ## Response: ## " + response); } if (jdata.@return == null) { throw new MarketAPIException("Market API error: Data=null , Response: " + response); } List <OpenOrder> openOrders = new List <OpenOrder>(); // foreach (var item in [email protected]) foreach (var pair in jdata.@return) { YActiveOrder item = pair.Value; OpenOrder order = new OpenOrder { uuid = pair.Key, openUuid = pair.Key, orderType = item.type, ticker = ToUITicker(item.pair), quantity = item.amount, quantityRemaining = 0, price = item.rate, openedDate = Helper.UnixToDateTime(item.timestamp_created) }; if (order.orderType == "sell") { order.orderType = "SELL LIMIT"; } if (order.orderType == "buy") { order.orderType = "BUY LIMIT"; } openOrders.Add(order); } openOrders = openOrders.OrderByDescending(o => o.openedDate).ToList(); return(openOrders); }
public override List <OpenOrder> GetOpenOrdersEnd(string parameters, string ticker) { string response = DoKeyRequest(parameters); BOpenOrders jdata = Newtonsoft.Json.JsonConvert.DeserializeObject <BOpenOrders>(response); //lastRequestMsg = jdata.message; //lastRequestStatus = jdata.success; if (!jdata.success) { throw new MarketAPIException("Market API Error:" + jdata.message); } List <OpenOrder> openOrders = new List <OpenOrder>(); int n = 0; foreach (var item in jdata.result) { n++; OpenOrder order = new OpenOrder { uuid = item.OrderUuid, openUuid = item.OrderUuid, orderType = item.OrderType, ticker = item.Exchange, quantity = item.Quantity, quantityRemaining = item.QuantityRemaining, price = item.Limit, openedDate = item.Opened }; if (order.orderType == "LIMIT_SELL") { order.orderType = "SELL LIMIT"; } if (order.orderType == "LIMIT_BUY") { order.orderType = "BUY LIMIT"; } openOrders.Add(order); } openOrders = openOrders.OrderByDescending(o => o.openedDate).ToList(); return(openOrders); }
public override List <OpenOrder> GetOpenOrdersEnd(string parameters, string ticker) { string response = DoKeyRequest(parameters); CheckResponseAndThrow(response); List <POpenOrders> jdata = null; try{ jdata = Newtonsoft.Json.JsonConvert.DeserializeObject <List <POpenOrders> >(response); } catch (Exception ex) { throw new MarketAPIException("Parsing Response Error" + " >>>> " + ex.Message + " ## Response: ## " + response); } List <OpenOrder> openOrders = new List <OpenOrder>(); foreach (POpenOrders item in jdata) { OpenOrder order = new OpenOrder { uuid = item.orderNumber, openUuid = item.orderNumber, orderType = item.type, ticker = ticker, quantity = Helper.ToDouble(item.amount), quantityRemaining = 0, price = Helper.ToDouble(item.rate), openedDate = DateTime.Now }; if (order.orderType == "sell") { order.orderType = "SELL LIMIT"; } if (order.orderType == "buy") { order.orderType = "BUY LIMIT"; } openOrders.Add(order); } openOrders = openOrders.OrderByDescending(o => o.openedDate).ToList(); return(openOrders); }
public override List <OpenOrder> GetOpenOrdersEnd(string parameters, string ticker) { string response = DoKeyRequest(parameters); // BOpenOrders jdata = Newtonsoft.Json.JsonConvert.DeserializeObject<BOpenOrders>(response); //lastRequestMsg = jdata.message; //lastRequestStatus = jdata.success; // if (!jdata.success) // throw new MarketAPIException("Market API Error:" + jdata.message); string errmsg = ""; string errcaption = ""; BOpenOrders jdata = null; try { jdata = Newtonsoft.Json.JsonConvert.DeserializeObject <BOpenOrders>(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 <OpenOrder> openOrders = new List <OpenOrder>(); int n = 0; foreach (var item in jdata.result) { n++; OpenOrder order = new OpenOrder { uuid = item.OrderUuid, openUuid = item.OrderUuid, orderType = item.OrderType, ticker = item.Exchange, quantity = item.Quantity, quantityRemaining = item.QuantityRemaining, price = item.Limit, openedDate = item.Opened }; if (order.orderType == "LIMIT_SELL") { order.orderType = "SELL LIMIT"; } if (order.orderType == "LIMIT_BUY") { order.orderType = "BUY LIMIT"; } openOrders.Add(order); } openOrders = openOrders.OrderByDescending(o => o.openedDate).ToList(); return(openOrders); }
public virtual void CancellMyOrder(OpenOrder order, Action <RequestItemGroup> ProcessResultUIAction) { SendRequestToQueue(market.OrderCancelBegin(order.openUuid), tradeHandlers.OrderCancel_RequestHandler, ProcessResultUIAction); }