Exemple #1
0
 private static IEnumerable <Candle> MapInternal(CandleData candleData)
 {
     for (int i = 0; i < candleData.Close.Count; i++)
     {
         yield return(new Candle
         {
             High = candleData.High[i],
             Low = candleData.Low[i],
             Open = candleData.Open[i],
             Close = candleData.Close[i],
             Volume = candleData.Volume?[i] ?? 0,
             Timestamp = candleData.Timestamp[i]
         });
     }
 }
Exemple #2
0
        public static Candle[] Map(this CandleData candleData)
        {
            try
            {
                if ((candleData?.Status ?? NoData) == NoData)
                {
                    return(new Candle[0]);
                }

                return(MapInternal(candleData).ToArray());
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("Failed to Map Candle Data", ex);
            }
        }