Merge pull request #6869 from freqtrade/update_levtiers

Update leveraged tiers
This commit is contained in:
Matthias 2022-05-22 08:35:02 +02:00 committed by GitHub
commit 1ff1e3b43d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8210 additions and 7757 deletions

View File

@ -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). 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). 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': '<apikey>',
'secret': '<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 ## Updating example notebooks
To keep the jupyter notebooks aligned with the documentation, the following should be ran after updating a example notebook. To keep the jupyter notebooks aligned with the documentation, the following should be ran after updating a example notebook.

File diff suppressed because it is too large Load Diff

View File

@ -490,11 +490,9 @@ def test_fill_leverage_tiers_binance_dryrun(default_conf, mocker, leverage_tiers
default_conf['margin_mode'] = MarginMode.ISOLATED default_conf['margin_mode'] = MarginMode.ISOLATED
exchange = get_patched_exchange(mocker, default_conf, api_mock, id="binance") exchange = get_patched_exchange(mocker, default_conf, api_mock, id="binance")
exchange.fill_leverage_tiers() exchange.fill_leverage_tiers()
assert len(exchange._leverage_tiers.keys()) > 100
leverage_tiers = leverage_tiers
for key, value in leverage_tiers.items(): for key, value in leverage_tiers.items():
assert exchange._leverage_tiers[key] == value assert isinstance(exchange._leverage_tiers[key], list)
def test__set_leverage_binance(mocker, default_conf): def test__set_leverage_binance(mocker, default_conf):