Updated kraken fill leverage brackets and set_leverage
This commit is contained in:
parent
1344c9f7fc
commit
09418938fe
@ -146,6 +146,7 @@ class Kraken(Exchange):
|
|||||||
leverages = {}
|
leverages = {}
|
||||||
|
|
||||||
for pair, market in self.markets.items():
|
for pair, market in self.markets.items():
|
||||||
|
leverages[pair] = [1]
|
||||||
info = market['info']
|
info = market['info']
|
||||||
leverage_buy = info.get('leverage_buy', [])
|
leverage_buy = info.get('leverage_buy', [])
|
||||||
leverage_sell = info.get('leverage_sell', [])
|
leverage_sell = info.get('leverage_sell', [])
|
||||||
@ -155,12 +156,12 @@ class Kraken(Exchange):
|
|||||||
f"The buy({leverage_buy}) and sell({leverage_sell}) leverage are not equal"
|
f"The buy({leverage_buy}) and sell({leverage_sell}) leverage are not equal"
|
||||||
"for {pair}. Please notify freqtrade because this has never happened before"
|
"for {pair}. Please notify freqtrade because this has never happened before"
|
||||||
)
|
)
|
||||||
if max(leverage_buy) < max(leverage_sell):
|
if max(leverage_buy) <= max(leverage_sell):
|
||||||
leverages[pair] = leverage_buy
|
leverages[pair] += [int(lev) for lev in leverage_buy]
|
||||||
else:
|
else:
|
||||||
leverages[pair] = leverage_sell
|
leverages[pair] += [int(lev) for lev in leverage_sell]
|
||||||
else:
|
else:
|
||||||
leverages[pair] = leverage_buy
|
leverages[pair] += [int(lev) for lev in leverage_buy]
|
||||||
self._leverage_brackets = leverages
|
self._leverage_brackets = leverages
|
||||||
|
|
||||||
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:
|
||||||
@ -173,7 +174,7 @@ class Kraken(Exchange):
|
|||||||
|
|
||||||
def set_leverage(self, pair, leverage):
|
def set_leverage(self, pair, leverage):
|
||||||
"""
|
"""
|
||||||
Kraken set's the leverage as an option in the order object, so it doesn't do
|
Kraken set's the leverage as an option in the order object, so we need to
|
||||||
anything in this function
|
add it to params
|
||||||
"""
|
"""
|
||||||
return
|
self._params['leverage'] = leverage
|
||||||
|
@ -292,7 +292,16 @@ def test_fill_leverage_brackets_kraken(default_conf, mocker):
|
|||||||
exchange.fill_leverage_brackets()
|
exchange.fill_leverage_brackets()
|
||||||
|
|
||||||
assert exchange._leverage_brackets == {
|
assert exchange._leverage_brackets == {
|
||||||
'BLK/BTC': ['2', '3'],
|
'BLK/BTC': [1, 2, 3],
|
||||||
'TKN/BTC': ['2', '3', '4', '5'],
|
'TKN/BTC': [1, 2, 3, 4, 5],
|
||||||
'ETH/BTC': ['2']
|
'ETH/BTC': [1, 2],
|
||||||
|
'LTC/BTC': [1],
|
||||||
|
'XRP/BTC': [1],
|
||||||
|
'NEO/BTC': [1],
|
||||||
|
'BTT/BTC': [1],
|
||||||
|
'ETH/USDT': [1],
|
||||||
|
'LTC/USDT': [1],
|
||||||
|
'LTC/USD': [1],
|
||||||
|
'XLTCUSDT': [1],
|
||||||
|
'LTC/ETH': [1]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user