kraken._apply_leverage_to_stake_amount
This commit is contained in:
parent
b0e05b92d3
commit
5b84298e03
@ -163,6 +163,15 @@ 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
|
||||||
|
@ -2974,9 +2974,9 @@ def test_calculate_backoff(retrycount, max_retries, expected):
|
|||||||
('binance', 20.0, 5.0, 4.0),
|
('binance', 20.0, 5.0, 4.0),
|
||||||
('binance', 100.0, 100.0, 1.0),
|
('binance', 100.0, 100.0, 1.0),
|
||||||
# Kraken
|
# Kraken
|
||||||
('kraken', 9.0, 3.0, 9.0),
|
('kraken', 9.0, 3.0, 3.0),
|
||||||
('kraken', 20.0, 5.0, 20.0),
|
('kraken', 20.0, 5.0, 4.0),
|
||||||
('kraken', 100.0, 100.0, 100.0),
|
('kraken', 100.0, 100.0, 1.0),
|
||||||
# FTX
|
# FTX
|
||||||
('ftx', 9.0, 3.0, 9.0),
|
('ftx', 9.0, 3.0, 9.0),
|
||||||
('ftx', 20.0, 5.0, 20.0),
|
('ftx', 20.0, 5.0, 20.0),
|
||||||
|
Loading…
Reference in New Issue
Block a user