From 97abcf4b320d9ee514f99392e52187b155437a61 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 21 May 2022 16:10:00 +0200 Subject: [PATCH] Add documentation for leverage_tiers update --- docs/developer.md | 26 +++++++++++++++++++ .../exchange/binance_leverage_tiers.json | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/developer.md b/docs/developer.md index 185bfc92e..ce7fb37e1 100644 --- a/docs/developer.md +++ b/docs/developer.md @@ -314,6 +314,32 @@ The output will show the last entry from the Exchange as well as the current UTC If the day shows the same day, then the last candle can be assumed as incomplete and should be dropped (leave the setting `"ohlcv_partial_candle"` from the exchange-class untouched / True). Otherwise, set `"ohlcv_partial_candle"` to `False` to not drop Candles (shown in the example above). Another way is to run this command multiple times in a row and observe if the volume is changing (while the date remains the same). +### Update binance cached leverage tiers + +Updating leveraged tiers should be done regularly - and requires an authenticated account with futures enabled. + +``` python +import ccxt +import json +from pathlib import Path + +exchange = ccxt.binance({ + 'apiKey': '', + 'secret': '' + 'options': {'defaultType': 'future'} + }) +_ = exchange.load_markets() + +lev_tiers = exchange.fetch_leverage_tiers() + +# Assumes this is running in the root of the repository. +file = Path('freqtrade/exchange/binance_leverage_tiers.json') +json.dump(lev_tiers, file.open('w'), indent=2) + +``` + +This file should then be contributed upstream, so others can benefit from this, too. + ## Updating example notebooks To keep the jupyter notebooks aligned with the documentation, the following should be ran after updating a example notebook. diff --git a/freqtrade/exchange/binance_leverage_tiers.json b/freqtrade/exchange/binance_leverage_tiers.json index 9292509bf..126b3b62f 100644 --- a/freqtrade/exchange/binance_leverage_tiers.json +++ b/freqtrade/exchange/binance_leverage_tiers.json @@ -16907,4 +16907,4 @@ } } ] -} +} \ No newline at end of file