Skip to content

Commit

Permalink
HitBTC: Update test amounts based on current prices
Browse files Browse the repository at this point in the history
  • Loading branch information
TheHolyRoger committed Apr 6, 2021
1 parent 29ec54d commit d83cd37
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/connector/exchange/hitbtc/test_hitbtc_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def test_estimate_fee(self):
def test_buy_and_sell(self):
price = self.connector.get_price(self.trading_pair, True) * Decimal("1.02")
price = self.connector.quantize_order_price(self.trading_pair, price)
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0001"))
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0002"))
quote_bal = self.connector.get_available_balance(self.quote_token)
base_bal = self.connector.get_available_balance(self.base_token)

Expand Down Expand Up @@ -178,7 +178,7 @@ def test_buy_and_sell(self):
# Try to sell back the same amount to the exchange, and watch for completion event.
price = self.connector.get_price(self.trading_pair, True) * Decimal("0.98")
price = self.connector.quantize_order_price(self.trading_pair, price)
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0001"))
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0002"))
order_id = self._place_order(False, amount, OrderType.LIMIT, price, 2)
order_completed_event = self.ev_loop.run_until_complete(self.event_logger.wait_for(SellOrderCompletedEvent))
trade_events = [t for t in self.event_logger.event_log if isinstance(t, OrderFilledEvent)]
Expand Down Expand Up @@ -206,7 +206,7 @@ def test_buy_and_sell(self):
def test_limit_makers_unfilled(self):
price = self.connector.get_price(self.trading_pair, True) * Decimal("0.8")
price = self.connector.quantize_order_price(self.trading_pair, price)
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0001"))
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0002"))
self.ev_loop.run_until_complete(asyncio.sleep(1))
self.ev_loop.run_until_complete(self.connector._update_balances())
self.ev_loop.run_until_complete(asyncio.sleep(2))
Expand All @@ -231,7 +231,7 @@ def test_limit_makers_unfilled(self):

price = self.connector.get_price(self.trading_pair, True) * Decimal("1.2")
price = self.connector.quantize_order_price(self.trading_pair, price)
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0001"))
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0002"))

cl_order_id = self._place_order(False, amount, OrderType.LIMIT_MAKER, price, 2)
order_created_event = self.ev_loop.run_until_complete(self.event_logger.wait_for(SellOrderCreatedEvent))
Expand Down Expand Up @@ -261,7 +261,7 @@ def test_cancel_all(self):
ask_price = self.connector.get_price(self.trading_pair, False)
bid_price = self.connector.quantize_order_price(self.trading_pair, bid_price * Decimal("0.9"))
ask_price = self.connector.quantize_order_price(self.trading_pair, ask_price * Decimal("1.1"))
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0001"))
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0002"))

buy_id = self._place_order(True, amount, OrderType.LIMIT, bid_price, 1)
sell_id = self._place_order(False, amount, OrderType.LIMIT, ask_price, 2)
Expand All @@ -287,7 +287,7 @@ def test_order_quantized_values(self):
# get filled during the test.
bid_price = self.connector.quantize_order_price(self.trading_pair, mid_price * Decimal("0.9333192292111341"))
ask_price = self.connector.quantize_order_price(self.trading_pair, mid_price * Decimal("1.1492431474884933"))
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.000123456"))
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.000223456"))

# Test bid order
cl_order_id_1 = self._place_order(True, amount, OrderType.LIMIT, bid_price, 1)
Expand Down Expand Up @@ -321,7 +321,7 @@ def test_orders_saving_and_restoration(self):
price: Decimal = current_bid_price * Decimal("0.8")
price = self.connector.quantize_order_price(self.trading_pair, price)

amount: Decimal = Decimal("0.0001")
amount: Decimal = Decimal("0.0002")
amount = self.connector.quantize_order_amount(self.trading_pair, amount)

cl_order_id = self._place_order(True, amount, OrderType.LIMIT_MAKER, price, 1)
Expand Down Expand Up @@ -402,7 +402,7 @@ def test_filled_orders_recorded(self):
# Try to buy some token from the exchange, and watch for completion event.
price = self.connector.get_price(self.trading_pair, True) * Decimal("1.05")
price = self.connector.quantize_order_price(self.trading_pair, price)
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0001"))
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0002"))

order_id = self._place_order(True, amount, OrderType.LIMIT, price, 1)
self.ev_loop.run_until_complete(self.event_logger.wait_for(BuyOrderCompletedEvent))
Expand All @@ -414,7 +414,7 @@ def test_filled_orders_recorded(self):
# Try to sell back the same amount to the exchange, and watch for completion event.
price = self.connector.get_price(self.trading_pair, True) * Decimal("0.95")
price = self.connector.quantize_order_price(self.trading_pair, price)
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0001"))
amount = self.connector.quantize_order_amount(self.trading_pair, Decimal("0.0002"))
order_id = self._place_order(False, amount, OrderType.LIMIT, price, 2)
self.ev_loop.run_until_complete(self.event_logger.wait_for(SellOrderCompletedEvent))
self.ev_loop.run_until_complete(asyncio.sleep(1))
Expand Down

0 comments on commit d83cd37

Please sign in to comment.