freqtrade_origin/build_helpers/binance_update_lev_tiers.py

24 lines
614 B
Python
Raw Normal View History

2024-03-31 07:04:39 +00:00
#!/usr/bin/env python3
import json
import os
from pathlib import Path
import ccxt
2024-05-12 14:18:15 +00:00
key = os.environ.get("FREQTRADE__EXCHANGE__KEY")
secret = os.environ.get("FREQTRADE__EXCHANGE__SECRET")
2024-03-31 07:04:39 +00:00
2024-05-12 14:18:15 +00:00
proxy = os.environ.get("CI_WEB_PROXY")
2024-03-31 07:04:39 +00:00
2024-05-12 14:18:15 +00:00
exchange = ccxt.binance(
{"apiKey": key, "secret": secret, "httpsProxy": proxy, "options": {"defaultType": "swap"}}
)
2024-03-31 07:04:39 +00:00
_ = exchange.load_markets()
lev_tiers = exchange.fetch_leverage_tiers()
# Assumes this is running in the root of the repository.
2024-05-12 14:18:15 +00:00
file = Path("freqtrade/exchange/binance_leverage_tiers.json")
json.dump(dict(sorted(lev_tiers.items())), file.open("w"), indent=2)