Example #1
0
        public static IList <PoloniexAPI.MarketTools.IMarketChartData> GetChartData(
            PoloniexAPI.CurrencyPair currencyPair,
            PoloniexAPI.MarketTools.MarketPeriod period,
            DateTime startTime, DateTime endTime)
        {
            int startTimestamp = (int)Utility.DateTimeHelper.DateTimeToUnixTimestamp(startTime);
            int endTimestamp   = (int)Utility.DateTimeHelper.DateTimeToUnixTimestamp(endTime);

            startTimestamp = (int)Utility.DateTimeHelper.GetServerTime(startTimestamp);
            endTimestamp   = (int)Utility.DateTimeHelper.GetServerTime(endTimestamp);

            string response = QueryGet("https://poloniex.com/public?command=returnChartData&currencyPair=" + currencyPair +
                                       "&start=" + startTimestamp +
                                       "&end=" + endTimestamp +
                                       "&period=" + (int)period);

            return(ParseChartData(response));
        }
Example #2
0
 public static IList <PoloniexAPI.MarketTools.IMarketChartData> RefreshChart(CurrencyPair pair, PoloniexAPI.MarketTools.MarketPeriod period)
 {
     try {
         DateTime startTime = DateTime.Now.Subtract(new TimeSpan(6, 0, 0));
         DateTime endTime   = DateTime.Now;
         return(client.Markets.GetChartDataAsync(pair, period, startTime, endTime).Result);
     }
     catch (Exception e) {
         ErrorLog.ReportError("Error refreshing chart data", e);
     }
     return(null);
 }