Skip to content

Commit

Permalink
[Tests] update exchange leverage tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Jan 6, 2025
1 parent e620514 commit e83fb53
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class AbstractAuthenticatedFutureExchangeTester(
INVERSE_SYMBOL = None
MIN_PORTFOLIO_SIZE = 2 # ensure fetching currency for linear and inverse
SUPPORTS_GET_LEVERAGE = True
SUPPORTS_SET_LEVERAGE = True
SUPPORTS_EMPTY_POSITION_SET_MARGIN_TYPE = True

async def test_get_empty_linear_and_inverse_positions(self):
Expand Down Expand Up @@ -85,9 +84,12 @@ async def inner_test_get_and_set_leverage(self):
assert origin_leverage != trading_constants.ZERO
if self.SUPPORTS_GET_LEVERAGE:
assert origin_leverage == await self.get_leverage()
if not self.SUPPORTS_SET_LEVERAGE:
return
new_leverage = origin_leverage + 1
if not self.exchange_manager.exchange.UPDATE_LEVERAGE_FROM_API:
# can't set from api: make sure of that
with pytest.raises(trading_errors.NotSupported):
await self.exchange_manager.exchange.connector.set_symbol_leverage(self.SYMBOL, float(new_leverage))
return
await self.set_leverage(new_leverage)
await self._check_margin_type_and_leverage(origin_margin_type, new_leverage) # did not change margin type
# change leverage back to origin value
Expand Down
1 change: 0 additions & 1 deletion additional_tests/exchanges_tests/test_kucoin_futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class TestKucoinFuturesAuthenticatedExchange(
INVERSE_SYMBOL = f"{ORDER_CURRENCY}/USD:{ORDER_CURRENCY}"
ORDER_SIZE = 5 # % of portfolio to include in test orders
SUPPORTS_GET_LEVERAGE = False
SUPPORTS_SET_LEVERAGE = False
USE_ORDER_OPERATION_TO_CHECK_API_KEY_RIGHTS = True
VALID_ORDER_ID = "6617e84c5c1e0000083c71f7"
EXPECT_MISSING_FEE_IN_CANCELLED_ORDERS = False
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Drakkar-Software requirements
OctoBot-Commons==1.9.70
OctoBot-Trading==2.4.140
OctoBot-Trading==2.4.141
OctoBot-Evaluators==1.9.7
OctoBot-Tentacles-Manager==2.9.16
OctoBot-Services==1.6.21
Expand Down

0 comments on commit e83fb53

Please sign in to comment.