Пример #1
0
    def test_does_ah_excercise_eth_atm_put_option(self):
        # now the ah will retrieve this order from the db an execute it.
        order_params = deepcopy(self.order_params)
        self.set_price(order_params["strike_price"], "priceprovider")
        new_order = DBCommunication.create_new_option(**order_params)
        orders = DBCommunication.get_options()
        self.assertEqual(len(orders), 1,
                         "Only 1 order expected as in testing!")
        self.assertTrue(self.await_order_status_code(OPEN, new_order))

        expiration_date = datetime.utcnow() + timedelta(seconds=10)
        DBCommunication.update_option(new_order["option_id"],
                                      {"expiration_date": expiration_date})
        self.assertTrue(self.await_order_status_code(4, new_order))
Пример #2
0
    def test_does_ah_expire_otm_btc_call_option(self):
        # now the ah will retrieve this order from the db an execute it.
        order_params = deepcopy(self.order_params)
        order_params["option_type"] = 2
        order_params["market"] = "BTC"
        self.set_price(int(order_params["strike_price"]), "btcpriceprovider")
        new_order = DBCommunication.create_new_option(**order_params)
        self.set_price(int(order_params["strike_price"] * 0.95),
                       "btcpriceprovider")
        orders = DBCommunication.get_options()
        self.assertEqual(len(orders), 1,
                         "Only 1 order expected as in testing!")
        self.assertTrue(self.await_order_status_code(OPEN, new_order))

        expiration_date = datetime.utcnow() + timedelta(seconds=10)
        DBCommunication.update_option(new_order["option_id"],
                                      {"expiration_date": expiration_date})
        self.assertTrue(self.await_order_status_code(EXPIRED, new_order))