Merge pull request #6869 from freqtrade/update_levtiers
Update leveraged tiers
This commit is contained in:
commit
1ff1e3b43d
@ -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': '<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
|
||||
|
||||
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
@ -490,11 +490,9 @@ def test_fill_leverage_tiers_binance_dryrun(default_conf, mocker, leverage_tiers
|
||||
default_conf['margin_mode'] = MarginMode.ISOLATED
|
||||
exchange = get_patched_exchange(mocker, default_conf, api_mock, id="binance")
|
||||
exchange.fill_leverage_tiers()
|
||||
|
||||
leverage_tiers = leverage_tiers
|
||||
|
||||
assert len(exchange._leverage_tiers.keys()) > 100
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user