def test_amend_futures_trade_with_fields(self): if self.trade_class == FuturesTrade: ft = FuturesTrade.get_trade_example() self.database.add_trade(ft) amend_dict = {"price": 1234.56, "num_contracts": 654321} self.database.amend_trade_with_fields(1, amend_dict) amended_trade_from_db = self.database.select_trade_from_id(1) self.assertTrue(amended_trade_from_db.price == 1234.56 and amended_trade_from_db.num_contracts == 654321)
def test_amend_trade_with_incorrect_type(self): with self.assertRaises(TypeError): ft = FuturesTrade.get_trade_example() self.database.add_trade(ft) spotfxt = SpotFXTrade.get_trade_example() self.database.amend_trade_with_trade(1, spotfxt)
def test_amend_futures_trade_with_incorrect_maturity(self): if self.trade_class == FuturesTrade: with self.assertRaises(ValueError): futures_trade = FuturesTrade.get_trade_example() self.database.add_trade(futures_trade) self.database.amend_trade_with_field(1, "year", 1999)