Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            var user = await GetCurrentUserAsync();

            var swingTrades = await _db.SwingTrades.AsNoTracking()
                              .Where(c => c.UserId == user.Id)
                              .ToListAsync();

            var posicoesSwingTrade = swingTrades
                                     .Select(st => _swingTradePosFactory.ObterPosicaoConsolidada(st)).ToList();

            return(View(posicoesSwingTrade));
        }