public Ativos( User user, PosicaoConsolidadaCDBComCDIFactory cdbFactory, PosicaoConsolidadaSwingTradeFactory swingTradeFactory, PosicaoConsolidadaCryptoCurrencyFactory cryptoCurrencyFactory ) { PosicoesConsolidadasCDBComCDI = user.CDBsComCDI.Select(cdb => cdbFactory.ObterPosicaoConsolidada(cdb)).ToList(); PosicoesConsolidadasSwingTrade = user.SwingTrades.Select(st => swingTradeFactory.ObterPosicaoConsolidada(st)).ToList(); PosicoesConsolidadasCryptoWallet = user.CryptoWallets.Select(c => cryptoCurrencyFactory.ObterPosicaoConsolidada(c)).ToList(); TotalCDIeSELIC = PosicoesConsolidadasCDBComCDI.Sum(cdb => cdb.ValorLiquido); TotalRendaVariavel = PosicoesConsolidadasSwingTrade.Sum(x => x.ValorBruto); TotalCryptoCurrency = PosicoesConsolidadasCryptoWallet.Sum(b => b.ValorBruto); TotalCDIeSELICPorcent = TotalCDIeSELIC / ValorBruto(); TotalRendaVariavelPorcent = TotalRendaVariavel / ValorBruto(); TotalCryptoCurrencyPorcent = TotalCryptoCurrency / ValorBruto(); }
public CDBsComCDIController(FinanceiroDbContext context, UserManager <User> userManager, PosicaoConsolidadaCDBComCDIFactory factory) { _db = context; _userManager = userManager; _factory = factory; }
public ResumoController(FinanceiroDbContext context, PosicaoConsolidadaCDBComCDIFactory cdbFactory, PosicaoConsolidadaSwingTradeFactory swingTradeFactory, PosicaoConsolidadaCryptoCurrencyFactory cryptoCurrencyFactory) { _db = context; _cdbFactory = cdbFactory; _swingTradeFactory = swingTradeFactory; _cryptoCurrencyFactory = cryptoCurrencyFactory; }