예제 #1
0
        public static string GetDisplayLabel(this CandlestickSize size)
        {
            switch (size)
            {
            case _1Minute:      return("1 minute");

            case _3Minutes:     return("3 minutes");

            case _5Minutes:     return("5 minutes");

            case _15Minutes:    return("15 minutes");

            case _30Minutes:    return("30 minutes");

            case _1Hour:        return("1 hour");

            case _2Hours:       return("2 hours");

            case _4Hours:       return("4 hours");

            case _12Hours:      return("12 hours");

            case _1Day:         return("1 day");

            case _3Days:        return("3 days");

            case _1Week:        return("1 week");

            case _1Month:       return("1 month");

            case _3Months:      return("3 months");

            default: throw new Exception($"unrecognized CandlestickSize: {size}");
            }
        }
예제 #2
0
        public static double GetSizeInMilliseconds(this CandlestickSize size)
        {
            switch (size)
            {
            case _1Minute:      return(_1minute);

            case _3Minutes:     return(_3minutes);

            case _5Minutes:     return(_5minutes);

            case _15Minutes:    return(_15minutes);

            case _30Minutes:    return(_30minutes);

            case _1Hour:        return(_1hour);

            case _2Hours:       return(_2hours);

            case _4Hours:       return(_4hours);

            case _12Hours:      return(_12hours);

            case _1Day:         return(_1day);

            case _3Days:        return(_3days);

            case _1Week:        return(_1week);

            case _1Month:       return(_1month);

            case _3Months:      return(_3months);

            default: throw new Exception($"unrecognized CandlestickSize: {size}");
            }
        }
예제 #3
0
 public TimerState(CandlestickSize size)
 {
     this.candleLengthInMinutes = (int)size.GetSizeInMilliseconds() / 60000;
     CandlestickSize            = size;
 }
예제 #4
0
        public Task <List <MarketChartData> > GetChartData(CurrencyPair currencyPair, CandlestickSize candlestickSize, DateTime startTime, DateTime endTime)
        {
            string[] parameters =
            {
                "currencyPair=" + currencyPair,
                "start=" + DateTimeToUnixTimeStamp(startTime),
                "end=" + DateTimeToUnixTimeStamp(endTime),
                "period=" + ((int)candlestickSize).ToString()
            };

            return(ApiHttpClient.GetData <List <MarketChartData> >("returnChartData", ApiUrlHttpsRelativeTrading, parameters));
        }
예제 #5
0
 public IReadOnlyDictionary <string, CandlestickState> GetCandles(CandlestickSize size)
 {
     return(CandlestickStates[(int)size]);
 }
예제 #6
0
 public CandlestickState GetCandle(CandlestickSize size, string currencyPair)
 {
     return(GetCandles(size).TryGetValue(currencyPair, out var candle) ? candle : null);
 }