private void LoadCandleSticksPerTicker(DateTime from, DateTime dt) { //kdb c = new kdb("localhost", 5000); var candlesticks = new Dictionary <string, List <Candlestick> >(); foreach (var ticker in _request.TradingPairs) { candlesticks.Add(ticker, BinanceClient.GetCandleSticks(ticker, _request.Interval, from, dt).Result.ToList()); } int count = candlesticks.First().Value.Count(); for (int i = 0; i < count; i++) { var CandleSticksByTime = new Dictionary <string, Candlestick>(); foreach (var kvp in candlesticks) { if (kvp.Value.Count == 0) { continue; } CandleSticksByTime.Add(kvp.Key, kvp.Value[i]); //Prices - Opentime,open,high,low,close,volume,closetime //time format "Z"$ "2007-08-09T07:08:09.101" //c.k($"insert[`Prices](`{kvp.Key};\"Z\"$ \"{kvp.Value[i].OpenDateTime.ToString("yyyy-MM-ddTHH:mm:ss:fffff")}\"; {kvp.Value[i].Open}; {kvp.Value[i].High}; {kvp.Value[i].Low}; {kvp.Value[i].Close}; {kvp.Value[i].Volume}; \"Z\"$ \"{kvp.Value[i].CloseDateTime.ToString("yyyy-MM-ddTHH:mm:ss:fffff")}\")"); } CandleSticks.Enqueue(CandleSticksByTime); } }
private DateTime LoadNextCandleSticks() { var candlesticks = new Dictionary <string, List <Candlestick> >(); foreach (var ticker in _request.TradingPairs) { candlesticks.Add(ticker, BinanceClient.GetCandleSticks(ticker, _request.Interval, null, null, 1).Result.ToList()); } int count = candlesticks.First().Value.Count(); var lastCandle = candlesticks.First().Value[0].CloseDateTime; for (int i = 0; i < count; i++) { var CandleSticksByTime = new Dictionary <string, Candlestick>(); foreach (var kvp in candlesticks) { CandleSticksByTime.Add(kvp.Key, kvp.Value[i]); } CandleSticks.Enqueue(CandleSticksByTime); } return(lastCandle); }