コード例 #1
0
        public async Task <ForexRuleDTO> GetRule(string rule, string pair, int window, string endDate)
        {
            DateTime max = DateTime.ParseExact(endDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
            DateTime min = max.AddDays(-window);

            string startDate = min.ToString("yyyy-MM-dd");
            var    prices    = await _dailyPriceMap.GetPriceRangeInternal(pair, startDate, endDate);

            var ind = await _indicatorMap.GetIndicator(pair, new RSIOverbought70().Indicator(), endDate, window);

            var ruleResult = new ForexRuleDTO()
            {
                IsMet     = new RSIOverbought70().IsMet(prices),
                window    = prices.Count,
                RuleName  = "RSIOverbought",
                indicator = ind.Indicator
            };

            return(ruleResult);
        }
コード例 #2
0
        private async Task <ForexIndicator> GetIndicator(string pair, string indicator, DateTime latestDate)
        {
            string currentDate = latestDate.ToString("yyyy-MM-dd");

            return(await _indicatorMap.GetIndicator(pair, indicator, currentDate, 14));
        }