Update some tests for balance updates
This commit is contained in:
@@ -548,7 +548,7 @@ def test_rpc_balance_handle(default_conf, mocker, tickers):
|
|||||||
'used': 2.0,
|
'used': 2.0,
|
||||||
'bot_owned': 9.9, # available stake - reducing by reserved amount
|
'bot_owned': 9.9, # available stake - reducing by reserved amount
|
||||||
'est_stake': 10.0, # In futures mode, "free" is used here.
|
'est_stake': 10.0, # In futures mode, "free" is used here.
|
||||||
'est_stake_bot': 10,
|
'est_stake_bot': 9.9,
|
||||||
'stake': 'BTC',
|
'stake': 'BTC',
|
||||||
'is_position': False,
|
'is_position': False,
|
||||||
'leverage': 1.0,
|
'leverage': 1.0,
|
||||||
@@ -591,6 +591,7 @@ def test_rpc_balance_handle(default_conf, mocker, tickers):
|
|||||||
'balance': 0.0,
|
'balance': 0.0,
|
||||||
'currency': 'ETH/USDT:USDT',
|
'currency': 'ETH/USDT:USDT',
|
||||||
'est_stake': 20,
|
'est_stake': 20,
|
||||||
|
'est_stake_bot': 20,
|
||||||
'used': 0,
|
'used': 0,
|
||||||
'stake': 'BTC',
|
'stake': 'BTC',
|
||||||
'is_position': True,
|
'is_position': True,
|
||||||
@@ -600,10 +601,12 @@ def test_rpc_balance_handle(default_conf, mocker, tickers):
|
|||||||
'is_bot_managed': True,
|
'is_bot_managed': True,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
assert pytest.approx(result['total_bot']) == 10
|
assert pytest.approx(result['total_bot']) == 29.9
|
||||||
assert pytest.approx(result['total']) == 30.309096
|
assert pytest.approx(result['total']) == 30.309096
|
||||||
assert result['starting_capital'] == 10
|
assert result['starting_capital'] == 10
|
||||||
assert result['starting_capital_ratio'] == 0.0
|
# Very high starting capital ratio, because the futures position really has the wrong unit.
|
||||||
|
# TODO: improve this test (see comment above)
|
||||||
|
assert result['starting_capital_ratio'] == pytest.approx(1.98999999)
|
||||||
|
|
||||||
|
|
||||||
def test_rpc_start(mocker, default_conf) -> None:
|
def test_rpc_start(mocker, default_conf) -> None:
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ def test_api_balance(botclient, mocker, rpc_balance, tickers):
|
|||||||
'used': 0.0,
|
'used': 0.0,
|
||||||
'bot_owned': pytest.approx(11.879999),
|
'bot_owned': pytest.approx(11.879999),
|
||||||
'est_stake': 12.0,
|
'est_stake': 12.0,
|
||||||
'est_stake_bot': 12.0,
|
'est_stake_bot': pytest.approx(11.879999),
|
||||||
'stake': 'BTC',
|
'stake': 'BTC',
|
||||||
'is_position': False,
|
'is_position': False,
|
||||||
'leverage': 1.0,
|
'leverage': 1.0,
|
||||||
@@ -491,7 +491,7 @@ def test_api_balance(botclient, mocker, rpc_balance, tickers):
|
|||||||
'is_bot_managed': True,
|
'is_bot_managed': True,
|
||||||
}
|
}
|
||||||
assert response['total'] == 12.159513094
|
assert response['total'] == 12.159513094
|
||||||
assert response['total_bot'] == 12.0
|
assert response['total_bot'] == pytest.approx(11.879999)
|
||||||
assert 'starting_capital' in response
|
assert 'starting_capital' in response
|
||||||
assert 'starting_capital_fiat' in response
|
assert 'starting_capital_fiat' in response
|
||||||
assert 'starting_capital_pct' in response
|
assert 'starting_capital_pct' in response
|
||||||
|
|||||||
@@ -799,7 +799,8 @@ def test_telegram_balance_handle(default_conf, update, mocker, rpc_balance, tick
|
|||||||
assert '*XRP:*' not in result
|
assert '*XRP:*' not in result
|
||||||
assert 'Balance:' in result
|
assert 'Balance:' in result
|
||||||
assert 'Est. BTC:' in result
|
assert 'Est. BTC:' in result
|
||||||
assert 'BTC: 12' in result
|
assert 'BTC: 11' in result
|
||||||
|
assert 'BTC: 12' in result_full
|
||||||
assert "*3 Other Currencies (< 0.0001 BTC):*" in result
|
assert "*3 Other Currencies (< 0.0001 BTC):*" in result
|
||||||
assert 'BTC: 0.00000309' in result
|
assert 'BTC: 0.00000309' in result
|
||||||
assert '*Estimated Value*:' in result_full
|
assert '*Estimated Value*:' in result_full
|
||||||
|
|||||||
Reference in New Issue
Block a user