def test_value_two_holdings_with_cash(self): holdings = [ Holding('IL', 'Illuminati', 'BY', 120, 10, 'USD'), Holding('FM', 'Freemasons', 'US', 250, 25, 'USD') ] portfolio = Portfolio(holdings, self.CONVERTER) portfolio.cash_value = 550 self.assertEqual(8000, portfolio.value())
def test_value_another_currency(self): holdings = [ Holding('IL', 'Illuminati', 'BY', 120, 10, 'CAD'), Holding('FM', 'Freemasons', 'US', 250, 25, 'USD') ] portfolio = Portfolio(holdings, self.CONVERTER) portfolio.cash_value = 550 share_price = 10 * self.CONVERTER.CONVERSION_TABLE[('CAD', 'USD')] self.assertEqual(120*share_price + 250*25 + 550, portfolio.value())