Beispiel #1
0
        public ActionResult GetIndicatorCategories(int geoAreaId, int[] years)
        {
            var calculatedVals = db.CalculatedValues.Where(x => years.Contains(x.EquationYear.Year) && x.GeoAreaID == geoAreaId)
                                 .Include(x => x.EquationYear.Equation.Indicator)
                                 .Include(x => x.EquationYear.Equation.Indicator.Bundle)
                                 .ToList();
            Dictionary <int, IndicatorValues> result = new Dictionary <int, IndicatorValues>();

            foreach (var cv in calculatedVals)
            {
                if (!result.ContainsKey(cv.EquationYear.Equation.IndicatorID))
                {
                    IndicatorValues indicatorValues = new IndicatorValues()
                    {
                        BundleID      = cv.EquationYear.Equation.Indicator.BundleID,
                        BundleName    = cv.EquationYear.Equation.Indicator.Bundle.Name,
                        IndicatorID   = cv.EquationYear.Equation.IndicatorID,
                        IndicatorName = cv.EquationYear.Equation.Indicator.Name,
                        Values        = new Dictionary <int, double>()
                    };
                    result.Add(cv.EquationYear.Equation.IndicatorID, indicatorValues);
                }
                if (!result[cv.EquationYear.Equation.IndicatorID].Values.ContainsKey(cv.EquationYear.Year))
                {
                    result[cv.EquationYear.Equation.IndicatorID].Values.Add(cv.EquationYear.Year, cv.Value);
                }
            }
            ViewBag.Years = years.OrderBy(x => x);
            return(View(result));
        }
Beispiel #2
0
        /// <summary>
        /// Clear Agent
        /// </summary>
        /// <param name="agent"></param>
        public void ClearAgent(DeepRLAgentParameters agent)
        {
            Entry(agent).Reference(a => a.StockExchange).Load();
            var stockId = agent.StockExchange.Id;

            AverageTrueRanges.RemoveRange(AverageTrueRanges.Where(a => a.StockExchangeId == stockId));
            BollingerBandsPercentBs.RemoveRange(BollingerBandsPercentBs.Where(a => a.StockExchangeId == stockId));
            DMIs.RemoveRange(DMIs.Where(a => a.StockExchangeId == stockId));
            ExponentialMovingAverages.RemoveRange(ExponentialMovingAverages.Where(a => a.StockExchangeId == stockId));
            MACDs.RemoveRange(MACDs.Where(a => a.StockExchangeId == stockId));
            RSIs.RemoveRange(RSIs.Where(a => a.StockExchangeId == stockId));
            SimpleMovingAverages.RemoveRange(SimpleMovingAverages.Where(a => a.StockExchangeId == stockId));

            var periodsToDelete    = Periods.Where(p => p.StockExchangeId == stockId);
            var indicatorsToDelete = periodsToDelete.SelectMany(p => p.InternalIndicators).Distinct();

            IndicatorValues.RemoveRange(indicatorsToDelete);
            Periods.RemoveRange(periodsToDelete);

            States.RemoveRange(States.Where(e => e.StockExchangeId == stockId));
            OnDaysCompletes.RemoveRange(OnDaysCompletes.Where(e => e.Agent.Id == agent.Id));
        }
 public StrategyBuyWithIndicator()
 {
     SetMarkets("UP");
     SetTimeframes(Timeframe.H1);
     _ema = EMA("UP", Timeframe.H1, 3);
 }