mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
rewrite fill_leverage_brackets
This commit is contained in:
parent
69a6223ca0
commit
bff53c52af
|
@ -135,17 +135,19 @@ class Binance(Exchange):
|
||||||
else:
|
else:
|
||||||
leverage_brackets = self._api.load_leverage_brackets()
|
leverage_brackets = self._api.load_leverage_brackets()
|
||||||
|
|
||||||
for pair, brackets in leverage_brackets.items():
|
for pair, brkts in leverage_brackets.items():
|
||||||
self._leverage_brackets[pair] = [
|
[amt, old_ratio] = [None, None]
|
||||||
[
|
brackets = []
|
||||||
min_amount,
|
for [notional_floor, mm_ratio] in brkts:
|
||||||
float(margin_req)
|
amt = ((float(notional_floor) * (mm_ratio - old_ratio)) +
|
||||||
] for [
|
amt) if old_ratio else 0
|
||||||
min_amount,
|
old_ratio = mm_ratio
|
||||||
margin_req
|
brackets.append([
|
||||||
] in brackets
|
float(notional_floor),
|
||||||
]
|
mm_ratio,
|
||||||
|
amt,
|
||||||
|
])
|
||||||
|
self._leverage_brackets[pair] = brackets
|
||||||
except ccxt.DDoSProtection as e:
|
except ccxt.DDoSProtection as e:
|
||||||
raise DDosProtection(e) from e
|
raise DDosProtection(e) from e
|
||||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user