Minor fix and enhancement for TC51.

This commit is contained in:
eSeR1805 2022-05-07 17:31:56 +03:00
parent 108903f7f0
commit eca8d16c61
No known key found for this signature in database
GPG Key ID: BA53686259B46936

View File

@ -786,9 +786,9 @@ tc49 = BTContainer(data=[
# Test 50: Custom-entry-price below all candles - readjust order cancels order
tc50 = BTContainer(data=[
# D O H L C V EL XL ES Xs BT
[0, 5000, 5050, 4950, 5000, 6172, 1, 0],
[1, 5000, 5500, 4951, 5000, 6172, 0, 0], # timeout
[2, 4900, 5250, 4500, 5100, 6172, 0, 0], # Order readjust - cancel order
[0, 5000, 5050, 4950, 5000, 6172, 1, 0], # Enter long - place order
[1, 5000, 5500, 4951, 5000, 6172, 0, 0], # Order readjust - cancel order
[2, 4900, 5250, 4500, 5100, 6172, 0, 0],
[3, 5100, 5100, 4650, 4750, 6172, 0, 0],
[4, 4750, 4950, 4350, 4750, 6172, 0, 0]],
stop_loss=-0.01, roi={"0": 0.10}, profit_perc=0.0,
@ -800,14 +800,14 @@ tc50 = BTContainer(data=[
# Test 51: Custom-entry-price below all candles - readjust order leaves order in place and timeout.
tc51 = BTContainer(data=[
# D O H L C V EL XL ES Xs BT
[0, 5000, 5050, 4950, 5000, 6172, 1, 0],
[1, 5000, 5500, 4951, 5000, 6172, 0, 0], # timeout
[2, 4900, 5250, 4500, 5100, 6172, 0, 0], # Order readjust - cancel order
[3, 5100, 5100, 4650, 4750, 6172, 0, 0],
[0, 5000, 5050, 4950, 5000, 6172, 1, 0], # Enter long - place order
[1, 5000, 5500, 4951, 5000, 6172, 0, 0], # Order readjust - replace order
[2, 4900, 5250, 4500, 5100, 6172, 0, 0], # Order readjust - maintain order
[3, 5100, 5100, 4650, 4750, 6172, 0, 0], # Timeout
[4, 4750, 4950, 4350, 4750, 6172, 0, 0]],
stop_loss=-0.01, roi={"0": 0.10}, profit_perc=0.0,
use_exit_signal=True, timeout=1000,
custom_entry_price=4200, adjust_entry_price=4200,
use_exit_signal=True, timeout=60,
custom_entry_price=4200, adjust_entry_price=4100,
trades=[]
)
@ -905,7 +905,6 @@ def test_backtest_results(default_conf, fee, mocker, caplog, data: BTContainer)
backtesting.strategy.custom_entry_price = MagicMock(return_value=data.custom_entry_price)
if data.custom_exit_price:
backtesting.strategy.custom_exit_price = MagicMock(return_value=data.custom_exit_price)
if data.adjust_entry_price:
backtesting.strategy.adjust_entry_price = MagicMock(return_value=data.adjust_entry_price)
backtesting.strategy.use_custom_stoploss = data.use_custom_stoploss