public override Dictionary <int, PriceCandle> GetPriceHistoryByPeriodEnd(string parameters) { PUBLIC_API = "https://bittrex.com/api/v2.0/"; string response = DoPublicRequest(parameters); PUBLIC_API = "https://bittrex.com/api/v1.1/"; BTicksPriceHistory jdata = Newtonsoft.Json.JsonConvert.DeserializeObject <BTicksPriceHistory>(response); //lastRequestMsg = jdata.message; //lastRequestStatus = jdata.success; if (!jdata.success) { throw new MarketAPIException("Market API Error:" + jdata.message); } int n = 0; Dictionary <int, PriceCandle> priceHistory = new Dictionary <int, PriceCandle>(); foreach (BTicksPriceHistoryResult item in jdata.result) { n++; int idate = Helper.ToUnixTimeStamp(item.T); priceHistory.Add(idate, new PriceCandle { date = idate, open = item.O, high = item.H, low = item.L, close = item.C, volume = item.V }); } return(priceHistory); }
public override Dictionary <int, PriceCandle> GetPriceHistoryByPeriodEnd(string parameters) { PUBLIC_API = "https://bittrex.com/api/v2.0/"; string response = DoPublicRequest(parameters); PUBLIC_API = "https://bittrex.com/api/v1.1/"; string errmsg = ""; string errcaption = ""; BTicksPriceHistory jdata = null; try { jdata = Newtonsoft.Json.JsonConvert.DeserializeObject <BTicksPriceHistory>(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); } int n = 0; Dictionary <int, PriceCandle> priceHistory = new Dictionary <int, PriceCandle>(); foreach (BTicksPriceHistoryResult item in jdata.result) { n++; int idate = Helper.ToUnixTimeStamp(item.T); priceHistory.Add(idate, new PriceCandle { date = idate, open = item.O, high = item.H, low = item.L, close = item.C, volume = item.V }); } return(priceHistory); }