public static BarbellWallet Open(float selicAllocation, float ipcaAllocation, float stocksAllocation, float dolarAllocation, float startingAmount = 0) { var wallet = new BarbellWallet(selicAllocation, ipcaAllocation, stocksAllocation, dolarAllocation); wallet.AllocateDeposit(startingAmount); return(wallet); }
static void PrintEndResult(BarbellWallet wallet) { Console.WriteLine(); Console.WriteLine($"Invested:\t{wallet.InvestedAmount:C0}"); Console.WriteLine($"Balance:\t{wallet.Balance:C0}"); Console.WriteLine($"Profit/Loss:\t{wallet.ProfitOrLoss:C0}"); }
static void Run(BarbellWallet wallet, float monthlyDeposit) { Variation variation = null; foreach (var position in Market.ListBarbellPositions()) { variation = variation == null ? Variation.BeginTracking(position) : variation.ComparingTo(position); wallet.UpdateFundsAndMakeDeposit( variation.Selic, variation.Ipca, variation.Stocks, variation.Dolar, monthlyDeposit); PrintMonth(position.Month, wallet); } PrintEndResult(wallet); }
static void PrintMonth(MonthDate month, BarbellWallet wallet) { Console.WriteLine($"{month}: {wallet.Balance:C0}"); }