Пример #1
0
        public async Task <IEnumerable <decimal> > CalculateTrAsync(string symbol)
        {
            var candles = await _dataProvider.FetchCandlesAsync(symbol, TimePeriod.InYears(5), TimePeriod.InWeeks(1));

            var calculator = new TrCalculator();

            return(calculator.Calculate(candles));
        }
Пример #2
0
        public async Task <decimal> MinLast20DaysAsync(string symbol)
        {
            var rootObject = await _dataProvider.FetchDataAsync(symbol, TimePeriod.InYears(1), TimePeriod.InWeeks(1));

            return(rootObject.chart.result[0].indicators.quote[0].low.Where(x => x.HasValue).Select(x => x.Value).Reverse().Take(4).Min());
        }
Пример #3
0
        public async Task <decimal> MaxLast10YearsAsync(string symbol)
        {
            var rootObject = await _dataProvider.FetchDataAsync(symbol, TimePeriod.InYears(10), TimePeriod.InMonths(1));

            return(rootObject.chart.result[0].indicators.quote[0].high.Where(x => x.HasValue).Select(x => x.Value).Max());
        }