Unittest base_stake_amount_ratio
This commit is contained in:
parent
76e7bf6cd2
commit
da2e07b7fe
@ -121,19 +121,19 @@ def test_get_trade_stake_amount_no_stake_amount(default_conf, mocker) -> None:
|
||||
freqtrade.wallets.get_trade_stake_amount('ETH/BTC')
|
||||
|
||||
|
||||
@pytest.mark.parametrize("balance_ratio,capital,result1,result2", [
|
||||
(1, None, 50, 66.66666),
|
||||
(0.99, None, 49.5, 66.0),
|
||||
(0.50, None, 25, 33.3333),
|
||||
@pytest.mark.parametrize("balance_ratio,capital,result1,result2,result3", [
|
||||
(1, None, 50, 66.66666, 250),
|
||||
(0.99, None, 49.5, 66.0, 247.5),
|
||||
(0.50, None, 25, 33.3333, 125),
|
||||
# Tests with capital ignore balance_ratio
|
||||
(1, 100, 50, 0.0),
|
||||
(0.99, 200, 50, 66.66666),
|
||||
(0.99, 150, 50, 50),
|
||||
(0.50, 50, 25, 0.0),
|
||||
(0.50, 10, 5, 0.0),
|
||||
(1, 100, 50, 0.0, 0.0),
|
||||
(0.99, 200, 50, 66.66666, 50),
|
||||
(0.99, 150, 50, 50, 37.5),
|
||||
(0.50, 50, 25, 0.0, 0.0),
|
||||
(0.50, 10, 5, 0.0, 0.0),
|
||||
])
|
||||
def test_get_trade_stake_amount_unlimited_amount(default_conf, ticker, balance_ratio, capital,
|
||||
result1, result2, limit_buy_order_open,
|
||||
result1, result2, result3, limit_buy_order_open,
|
||||
fee, mocker) -> None:
|
||||
mocker.patch.multiple(
|
||||
'freqtrade.exchange.Exchange',
|
||||
@ -179,6 +179,14 @@ def test_get_trade_stake_amount_unlimited_amount(default_conf, ticker, balance_r
|
||||
result = freqtrade.wallets.get_trade_stake_amount('NEO/USDT')
|
||||
assert result == 0
|
||||
|
||||
freqtrade.config['max_open_trades'] = 2
|
||||
freqtrade.config['dry_run_wallet'] = 1000
|
||||
freqtrade.wallets.start_cap = 1000
|
||||
freqtrade.config['position_adjustment_enable'] = True
|
||||
freqtrade.config['base_stake_amount_ratio'] = 0.5
|
||||
result = freqtrade.wallets.get_trade_stake_amount('LTC/USDT')
|
||||
assert result == result3
|
||||
|
||||
|
||||
@pytest.mark.parametrize('stake_amount,min_stake_amount,max_stake_amount,expected', [
|
||||
(22, 11, 50, 22),
|
||||
|
Loading…
Reference in New Issue
Block a user