Exemplo n.º 1
0
    def test_stop_limit_order_prices(
        self,
        price,
        expected_limit_buy_or_stop_sell,
        expected_limit_sell_or_stop_buy,
        asset,
    ):
        """
        Test price getters for StopLimitOrder class. Note that the expected
        rounding direction for stop prices is the reverse of that for limit
        prices.
        """

        style = StopLimitOrder(price,
                               price + 1,
                               asset=self.asset_finder.retrieve_asset(asset))

        assert_equal(expected_limit_buy_or_stop_sell,
                     style.get_limit_price(is_buy=True))
        assert_equal(expected_limit_sell_or_stop_buy,
                     style.get_limit_price(is_buy=False))

        assert_equal(expected_limit_buy_or_stop_sell + 1,
                     style.get_stop_price(is_buy=False))
        assert_equal(expected_limit_sell_or_stop_buy + 1,
                     style.get_stop_price(is_buy=True))
Exemplo n.º 2
0
    def test_stop_limit_order_prices(self, price,
                                     expected_limit_buy_or_stop_sell,
                                     expected_limit_sell_or_stop_buy):
        """
        Test price getters for StopLimitOrder class. Note that the expected
        rounding direction for stop prices is the reverse of that for limit
        prices.
        """

        style = StopLimitOrder(price, price + 1)

        self.assertEqual(expected_limit_buy_or_stop_sell,
                         style.get_limit_price(True))
        self.assertEqual(expected_limit_sell_or_stop_buy,
                         style.get_limit_price(False))

        self.assertEqual(expected_limit_buy_or_stop_sell + 1,
                         style.get_stop_price(False))
        self.assertEqual(expected_limit_sell_or_stop_buy + 1,
                         style.get_stop_price(True))
Exemplo n.º 3
0
    def test_stop_limit_order_prices(self,
                                     price,
                                     expected_limit_buy_or_stop_sell,
                                     expected_limit_sell_or_stop_buy):
        """
        Test price getters for StopLimitOrder class. Note that the expected
        rounding direction for stop prices is the reverse of that for limit
        prices.
        """

        style = StopLimitOrder(price, price + 1)

        self.assertEqual(expected_limit_buy_or_stop_sell,
                         style.get_limit_price(True))
        self.assertEqual(expected_limit_sell_or_stop_buy,
                         style.get_limit_price(False))

        self.assertEqual(expected_limit_buy_or_stop_sell + 1,
                         style.get_stop_price(False))
        self.assertEqual(expected_limit_sell_or_stop_buy + 1,
                         style.get_stop_price(True))