public static string ToString(this CandleResolution resolution) { string res = resolution.ToString(); char first = res[0]; return(res.Substring(1) + first); }
/*/// <summary> * /// Get all candles with specif resolution for selected currencyPair. * /// </summary> * /// <param name="currencyPair">Currency pair code string, example BTC-USD.</param> * /// <param name="resolution">Select candle resolution.</param> * /// <returns>Candles data object.</returns> * public Candles GetCandlesData(string currencyPair, CandleResolution resolution) * { * Candles candles = SendCandleChartDataRequest(currencyPair + "/" + resolution.GetSecond()); * candles.Resoluton = resolution; * * return candles; * }*/ /// <summary> /// Get all candles with specif resolution for selected currencyPair, start result "fromTimeUnix" and end in "toTimeUnix". /// For get one candle time from and time to must be the same. /// </summary> /// <param name="currencyPair">Currency pair code string, example BTC-USD.</param> /// <param name="resolution">Select candle resolution.</param> /// <param name="fromTimeUnix">Unix timestamp from start geting candles.</param> /// <param name="toTimeUnix">Unix timestamp to end geting candles.</param> /// <returns>Candles data object.</returns> /// <exception cref="ArgumentException">Throw if "fromTimeUnix" is great than "toTimeUnix". From time must be before to time.</exception> public Candles GetCandlesData(string currencyPair, CandleResolution resolution, long fromTimeUnix, long toTimeUnix) { if (fromTimeUnix > toTimeUnix) { throw new ArgumentException("Date to must be leter(not equal) than date from!"); } Dictionary <string, string> query = CreateCandleQuery(fromTimeUnix, toTimeUnix, resolution.GetSecond()); Candles candles = SendCandleChartDataRequest(currencyPair + "/" + resolution.GetSecond(), query); candles.Resoluton = resolution; return(candles); }
public override JObject GetKLine(SecurityInfo si, CandleResolution resolution, string from, string to) { string res = Query("GET", string.Format("/market/candles/{0}/{1}", resolution.ToString(), si.Code), null, false); try { JObject jo = (JObject)JsonConvert.DeserializeObject(res); if (jo["status"].ToString() == "0") { return(jo); } return(null); } catch { return(null); } }
public static int GetSecond(this CandleResolution resolution) { return((int)resolution); }
public abstract JObject GetKLine(SecurityInfo si, CandleResolution resolution, string from, string to);