Beispiel #1
0
    def test_stop_order_prices(self, price, expected_limit_buy_or_stop_sell,
                               expected_limit_sell_or_stop_buy):
        """
        Test price getters for StopOrder class. Note that the expected rounding
        direction for stop prices is the reverse of that for limit prices.
        """
        style = StopOrder(price)

        self.assertEqual(None, style.get_limit_price(False))
        self.assertEqual(None, style.get_limit_price(True))

        self.assertEqual(expected_limit_buy_or_stop_sell,
                         style.get_stop_price(False))
        self.assertEqual(expected_limit_sell_or_stop_buy,
                         style.get_stop_price(True))
    def test_stop_order_prices(self, price, expected_limit_buy_or_stop_sell,
                               expected_limit_sell_or_stop_buy, asset):
        """
        Test price getters for StopOrder class. Note that the expected rounding
        direction for stop prices is the reverse of that for limit prices.
        """
        style = StopOrder(price, asset=self.asset_finder.retrieve_asset(asset))

        assert_equal(None, style.get_limit_price(_is_buy=False))
        assert_equal(None, style.get_limit_price(_is_buy=True))

        assert_equal(expected_limit_buy_or_stop_sell,
                     style.get_stop_price(is_buy=False))
        assert_equal(expected_limit_sell_or_stop_buy,
                     style.get_stop_price(is_buy=True))
    def test_stop_order_prices(self,
                               price,
                               expected_limit_buy_or_stop_sell,
                               expected_limit_sell_or_stop_buy):
        """
        Test price getters for StopOrder class. Note that the expected rounding
        direction for stop prices is the reverse of that for limit prices.
        """
        style = StopOrder(price)

        self.assertEqual(None, style.get_limit_price(False))
        self.assertEqual(None, style.get_limit_price(True))

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