Example #1
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));
        }