mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Added test templated
This commit is contained in:
parent
a0264f0651
commit
3ebda1d29d
|
@ -628,3 +628,12 @@ def test_get_maintenance_ratio_and_amt_binance(
|
|||
exchange._leverage_tiers = leverage_tiers
|
||||
(result_ratio, result_amt) = exchange.get_maintenance_ratio_and_amt(pair, nominal_value)
|
||||
assert (round(result_ratio, 8), round(result_amt, 8)) == (mm_ratio, amt)
|
||||
|
||||
|
||||
def test_load_leverage_tiers_binance(mocker, default_conf, leverage_tiers):
|
||||
# TODO-lev
|
||||
api_mock = MagicMock()
|
||||
default_conf['trading_mode'] = 'futures'
|
||||
default_conf['margin_mode'] = 'isolated'
|
||||
exchange = get_patched_exchange(mocker, default_conf, api_mock)
|
||||
assert exchange
|
||||
|
|
|
@ -341,6 +341,7 @@ class TestCCXTExchange():
|
|||
|
||||
def test_get_max_leverage_futures(self, exchange_futures):
|
||||
futures, futures_name = exchange_futures
|
||||
# TODO-lev: binance, gateio, and okex test
|
||||
if futures:
|
||||
leverage_in_market_futures = EXCHANGES[futures_name]['leverage_in_market']['futures']
|
||||
if leverage_in_market_futures:
|
||||
|
@ -362,3 +363,18 @@ class TestCCXTExchange():
|
|||
contract_size = futures._get_contract_size(futures_pair)
|
||||
assert (isinstance(contract_size, float) or isinstance(contract_size, int))
|
||||
assert contract_size >= 0.0
|
||||
|
||||
def test_get_liquidation_price_compat():
|
||||
return # TODO-lev
|
||||
|
||||
def test_liquidation_price_compat():
|
||||
return # TODO-lev
|
||||
|
||||
def test_get_max_pair_stake_amount_compat():
|
||||
return # TODO-lev
|
||||
|
||||
def test_load_leverage_tiers_compat():
|
||||
return # TODO-lev
|
||||
|
||||
def test_get_maintenance_ratio_and_amt_compat():
|
||||
return # TODO-lev
|
||||
|
|
|
@ -3561,6 +3561,7 @@ def test__ccxt_config(
|
|||
("TKN/USDT", 210.30, 1.0),
|
||||
])
|
||||
def test_get_max_leverage(default_conf, mocker, pair, nominal_value, max_lev):
|
||||
# TODO-lev: Branch coverage
|
||||
default_conf['trading_mode'] = 'futures'
|
||||
default_conf['margin_mode'] = 'isolated'
|
||||
exchange = get_patched_exchange(mocker, default_conf, id="gateio")
|
||||
|
@ -4222,3 +4223,39 @@ def test_get_max_pair_stake_amount(
|
|||
mocker.patch('freqtrade.exchange.Exchange.markets', markets)
|
||||
assert exchange.get_max_pair_stake_amount('BTC/USDT', 2.0) == 20000
|
||||
assert exchange.get_max_pair_stake_amount('ADA/USDT', 2.0) == 500
|
||||
|
||||
|
||||
def test_load_leverage_tiers(mocker, default_conf, leverage_tiers):
|
||||
# TODO-lev
|
||||
api_mock = MagicMock()
|
||||
default_conf['trading_mode'] = 'futures'
|
||||
default_conf['margin_mode'] = 'isolated'
|
||||
exchange = get_patched_exchange(mocker, default_conf, api_mock)
|
||||
assert exchange
|
||||
|
||||
|
||||
def test_parse_leverage_tier(mocker, default_conf, leverage_tiers):
|
||||
# TODO-lev
|
||||
api_mock = MagicMock()
|
||||
default_conf['trading_mode'] = 'futures'
|
||||
default_conf['margin_mode'] = 'isolated'
|
||||
exchange = get_patched_exchange(mocker, default_conf, api_mock)
|
||||
assert exchange
|
||||
|
||||
|
||||
def test_get_leverage_tiers_for_pair(mocker, default_conf, leverage_tiers):
|
||||
# TODO-lev
|
||||
api_mock = MagicMock()
|
||||
default_conf['trading_mode'] = 'futures'
|
||||
default_conf['margin_mode'] = 'isolated'
|
||||
exchange = get_patched_exchange(mocker, default_conf, api_mock)
|
||||
assert exchange
|
||||
|
||||
|
||||
def test_get_maintenance_ratio_and_amt(mocker, default_conf, leverage_tiers):
|
||||
# TODO-lev
|
||||
api_mock = MagicMock()
|
||||
default_conf['trading_mode'] = 'futures'
|
||||
default_conf['margin_mode'] = 'isolated'
|
||||
exchange = get_patched_exchange(mocker, default_conf, api_mock)
|
||||
assert exchange
|
||||
|
|
Loading…
Reference in New Issue
Block a user