Esempio n. 1
0
 def test_short_position_is_allowed(self):
     #This is expected to fail IO Error
     profile = run(transaction_history=tran_history)
     new_transaction = [
         Transaction(15, "Sell", 300, "27/10/2018", "Stock A")
     ]
     profile.execute_new_transaction_on_portfolio(new_transaction)
Esempio n. 2
0
 def test_allowed_to_trade_on_legal_limit(self):
     profile = run(transaction_history=tran_history)
     new_transaction = [
         Transaction(15, "Sell", 100, "27/10/2018", "Stock A")
     ]
     profile.execute_new_transaction_on_portfolio(new_transaction)
Esempio n. 3
0
 def test_portfolio_value(self):
     profile = run(transaction_history=tran_history)
     # with the above data - portfolio value calculates to be 10400
     self.assertEquals(profile.Value, 10500)
Esempio n. 4
0
 def test_portfolio_PnL_when_portfolio_created(self):
     profile = run(transaction_history=tran_history)
     self.assertEquals(profile.portfolio_pnl, 0)
Esempio n. 5
0
 def test_create_portfolio(self):
     profile = run(transaction_history=tran_history)
     assert type(profile) == Portfolio