Merge branch 'leverage-tiers' of https://github.com/samgermain/freqtrade into leverage-tiers

This commit is contained in:
Sam Germain 2022-02-14 17:36:47 -06:00
commit ae249a0f97
4 changed files with 15 additions and 9 deletions

View File

@ -77,11 +77,17 @@ class Okx(Exchange):
tiers: Dict[str, List[Dict]] = {} tiers: Dict[str, List[Dict]] = {}
# Be verbose here, as this delays startup by ~1 minute.
logger.info(
f"Initializing leverage_tiers for {len(symbols)} markets. "
"This will take about a minute.")
for symbol in symbols: for symbol in symbols:
res = self._api.fetchLeverageTiers(symbol) res = self._api.fetchLeverageTiers(symbol)
tiers[symbol] = [] tiers[symbol] = []
for tier in res[symbol]: for tier in res[symbol]:
tiers[symbol].append(self.parse_leverage_tier(tier)) tiers[symbol].append(self.parse_leverage_tier(tier))
logger.info(f"Done initializing {len(symbols)} markets.")
return tiers return tiers
else: else:

View File

@ -2,7 +2,7 @@ numpy==1.22.2
pandas==1.4.0 pandas==1.4.0
pandas-ta==0.3.14b pandas-ta==0.3.14b
ccxt==1.72.36 ccxt==1.73.3
# Pin cryptography for now due to rust build errors with piwheels # Pin cryptography for now due to rust build errors with piwheels
cryptography==36.0.1 cryptography==36.0.1
aiohttp==3.8.1 aiohttp==3.8.1

View File

@ -42,7 +42,7 @@ setup(
], ],
install_requires=[ install_requires=[
# from requirements.txt # from requirements.txt
'ccxt>=1.72.29', 'ccxt>=1.73.1',
'SQLAlchemy', 'SQLAlchemy',
'python-telegram-bot>=13.4', 'python-telegram-bot>=13.4',
'arrow>=0.17.0', 'arrow>=0.17.0',

View File

@ -329,7 +329,7 @@ class TestCCXTExchange():
assert 0 < exchange.get_fee(pair, 'market', 'buy') < threshold assert 0 < exchange.get_fee(pair, 'market', 'buy') < threshold
assert 0 < exchange.get_fee(pair, 'market', 'sell') < threshold assert 0 < exchange.get_fee(pair, 'market', 'sell') < threshold
def test_get_max_leverage_spot(self, exchange): def test_ccxt_get_max_leverage_spot(self, exchange):
spot, spot_name = exchange spot, spot_name = exchange
if spot: if spot:
leverage_in_market_spot = EXCHANGES[spot_name]['leverage_in_market']['spot'] leverage_in_market_spot = EXCHANGES[spot_name]['leverage_in_market']['spot']
@ -339,7 +339,7 @@ class TestCCXTExchange():
assert (isinstance(spot_leverage, float) or isinstance(spot_leverage, int)) assert (isinstance(spot_leverage, float) or isinstance(spot_leverage, int))
assert spot_leverage >= 1.0 assert spot_leverage >= 1.0
def test_get_max_leverage_futures(self, exchange_futures): def test_ccxt_get_max_leverage_futures(self, exchange_futures):
futures, futures_name = exchange_futures futures, futures_name = exchange_futures
# TODO-lev: binance, gateio, and okx test # TODO-lev: binance, gateio, and okx test
if futures: if futures:
@ -364,17 +364,17 @@ class TestCCXTExchange():
assert (isinstance(contract_size, float) or isinstance(contract_size, int)) assert (isinstance(contract_size, float) or isinstance(contract_size, int))
assert contract_size >= 0.0 assert contract_size >= 0.0
# def test_get_liquidation_price_compat(): # def test_ccxt_get_liquidation_price():
# return # TODO-lev # return # TODO-lev
# def test_liquidation_price_compat(): # def test_ccxt_liquidation_price():
# return # TODO-lev # return # TODO-lev
# def test_get_max_pair_stake_amount_compat(): # def test_ccxt_get_max_pair_stake_amount():
# return # TODO-lev # return # TODO-lev
# def test_load_leverage_tiers_compat(): # def test_ccxt_load_leverage_tiers():
# return # TODO-lev # return # TODO-lev
# def test_get_maintenance_ratio_and_amt_compat(): # def test_ccxt_get_maintenance_ratio_and_amt():
# return # TODO-lev # return # TODO-lev