_apply_leverage_to_min_stake_amount
This commit is contained in:
parent
5b84298e03
commit
1344c9f7fc
@ -112,9 +112,6 @@ class Binance(Exchange):
|
|||||||
except ccxt.BaseError as e:
|
except ccxt.BaseError as e:
|
||||||
raise OperationalException(e) from e
|
raise OperationalException(e) from e
|
||||||
|
|
||||||
def _apply_leverage_to_stake_amount(self, stake_amount: float, leverage: float):
|
|
||||||
return stake_amount / leverage
|
|
||||||
|
|
||||||
@retrier
|
@retrier
|
||||||
def fill_leverage_brackets(self):
|
def fill_leverage_brackets(self):
|
||||||
"""
|
"""
|
||||||
|
@ -630,7 +630,7 @@ class Exchange:
|
|||||||
:param stake_amount: The stake amount for a pair before leverage is considered
|
:param stake_amount: The stake amount for a pair before leverage is considered
|
||||||
:param leverage: The amount of leverage being used on the current trade
|
:param leverage: The amount of leverage being used on the current trade
|
||||||
"""
|
"""
|
||||||
return stake_amount
|
return stake_amount / leverage
|
||||||
|
|
||||||
# Dry-run methods
|
# Dry-run methods
|
||||||
|
|
||||||
|
@ -163,15 +163,6 @@ class Kraken(Exchange):
|
|||||||
leverages[pair] = leverage_buy
|
leverages[pair] = leverage_buy
|
||||||
self._leverage_brackets = leverages
|
self._leverage_brackets = leverages
|
||||||
|
|
||||||
def _apply_leverage_to_stake_amount(self, stake_amount: float, leverage: float):
|
|
||||||
"""
|
|
||||||
Takes the minimum stake amount for a pair with no leverage and returns the minimum
|
|
||||||
stake amount when leverage is considered
|
|
||||||
:param stake_amount: The stake amount for a pair before leverage is considered
|
|
||||||
:param leverage: The amount of leverage being used on the current trade
|
|
||||||
"""
|
|
||||||
return stake_amount / leverage
|
|
||||||
|
|
||||||
def get_max_leverage(self, pair: Optional[str], nominal_value: Optional[float]) -> float:
|
def get_max_leverage(self, pair: Optional[str], nominal_value: Optional[float]) -> float:
|
||||||
"""
|
"""
|
||||||
Returns the maximum leverage that a pair can be traded at
|
Returns the maximum leverage that a pair can be traded at
|
||||||
|
@ -2969,18 +2969,11 @@ def test_calculate_backoff(retrycount, max_retries, expected):
|
|||||||
assert calculate_backoff(retrycount, max_retries) == expected
|
assert calculate_backoff(retrycount, max_retries) == expected
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('exchange', ['binance', 'kraken', 'ftx'])
|
||||||
@pytest.mark.parametrize('exchange,stake_amount,leverage,min_stake_with_lev', [
|
@pytest.mark.parametrize('exchange,stake_amount,leverage,min_stake_with_lev', [
|
||||||
('binance', 9.0, 3.0, 3.0),
|
(9.0, 3.0, 3.0),
|
||||||
('binance', 20.0, 5.0, 4.0),
|
(20.0, 5.0, 4.0),
|
||||||
('binance', 100.0, 100.0, 1.0),
|
(100.0, 100.0, 1.0)
|
||||||
# Kraken
|
|
||||||
('kraken', 9.0, 3.0, 3.0),
|
|
||||||
('kraken', 20.0, 5.0, 4.0),
|
|
||||||
('kraken', 100.0, 100.0, 1.0),
|
|
||||||
# FTX
|
|
||||||
('ftx', 9.0, 3.0, 9.0),
|
|
||||||
('ftx', 20.0, 5.0, 20.0),
|
|
||||||
('ftx', 100.0, 100.0, 100.0)
|
|
||||||
])
|
])
|
||||||
def test_apply_leverage_to_stake_amount(
|
def test_apply_leverage_to_stake_amount(
|
||||||
exchange,
|
exchange,
|
||||||
|
Loading…
Reference in New Issue
Block a user