Beispiel #1
0
 def test_value_two_holdings(self):
   holdings = [
     Holding('IL', 'Illuminati', 'BY', 120, 10, 'USD'),
     Holding('FM', 'Freemasons', 'US', 250, 25, 'USD')
   ]
   portfolio = Portfolio(holdings, self.CONVERTER)
   self.assertEqual(7450, portfolio.value())
Beispiel #2
0
 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())
Beispiel #3
0
 def test_value_one_holding(self):
   holding = Holding('IL', 'Illuminati', 'BY', 120, 10, 'USD')
   portfolio = Portfolio([holding], self.CONVERTER)
   self.assertEqual(1200, portfolio.value())