mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-14 12:13:57 +00:00
tests: BT Detail tests should cover position switch
This commit is contained in:
parent
ae325ff124
commit
1b8fd63853
|
@ -1121,6 +1121,49 @@ tc53 = BTContainer(
|
||||||
trades=[BTrade(exit_reason=ExitType.STOP_LOSS, open_tick=1, close_tick=2, is_short=True)],
|
trades=[BTrade(exit_reason=ExitType.STOP_LOSS, open_tick=1, close_tick=2, is_short=True)],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Test 54: Switch position from long to short
|
||||||
|
tc54 = BTContainer(
|
||||||
|
data=[
|
||||||
|
# D O H L C V EL XL ES Xs BT
|
||||||
|
[0, 5000, 5050, 4950, 5000, 6172, 1, 0, 0, 0],
|
||||||
|
[1, 5000, 5000, 4951, 5000, 6172, 0, 0, 0, 0],
|
||||||
|
[2, 4910, 5150, 4910, 5100, 6172, 0, 0, 1, 0], # Enter short signal being ignored
|
||||||
|
[3, 5100, 5100, 4950, 4950, 6172, 0, 1, 1, 0], # exit - re-enter short
|
||||||
|
[4, 5000, 5100, 4950, 4950, 6172, 0, 0, 0, 1],
|
||||||
|
[5, 5000, 5100, 4950, 4950, 6172, 0, 0, 0, 0],
|
||||||
|
],
|
||||||
|
stop_loss=-0.10,
|
||||||
|
roi={"0": 0.10},
|
||||||
|
profit_perc=0.00,
|
||||||
|
use_exit_signal=True,
|
||||||
|
trades=[
|
||||||
|
BTrade(exit_reason=ExitType.EXIT_SIGNAL, open_tick=1, close_tick=4, is_short=False),
|
||||||
|
BTrade(exit_reason=ExitType.EXIT_SIGNAL, open_tick=4, close_tick=5, is_short=True),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
# Test 55: Switch position from short to long
|
||||||
|
tc55 = BTContainer(
|
||||||
|
data=[
|
||||||
|
# D O H L C V EL XL ES Xs BT
|
||||||
|
[0, 5000, 5050, 4950, 5000, 6172, 0, 0, 1, 0],
|
||||||
|
[1, 5000, 5000, 4951, 5000, 6172, 1, 0, 0, 0], # Enter long signal being ignored
|
||||||
|
[2, 4910, 5150, 4910, 5100, 6172, 1, 0, 0, 1], # Exit - reenter long
|
||||||
|
[3, 5100, 5100, 4950, 4950, 6172, 0, 0, 0, 0],
|
||||||
|
[4, 5000, 5100, 4950, 4950, 6172, 0, 1, 0, 0],
|
||||||
|
[5, 5000, 5100, 4950, 4950, 6172, 0, 0, 0, 0],
|
||||||
|
],
|
||||||
|
stop_loss=-0.10,
|
||||||
|
roi={"0": 0.10},
|
||||||
|
profit_perc=-0.04,
|
||||||
|
use_exit_signal=True,
|
||||||
|
trades=[
|
||||||
|
BTrade(exit_reason=ExitType.EXIT_SIGNAL, open_tick=1, close_tick=3, is_short=True),
|
||||||
|
BTrade(exit_reason=ExitType.EXIT_SIGNAL, open_tick=3, close_tick=5, is_short=False),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
TESTS = [
|
TESTS = [
|
||||||
tc0,
|
tc0,
|
||||||
tc1,
|
tc1,
|
||||||
|
@ -1176,6 +1219,8 @@ TESTS = [
|
||||||
tc51,
|
tc51,
|
||||||
tc52,
|
tc52,
|
||||||
tc53,
|
tc53,
|
||||||
|
tc54,
|
||||||
|
tc55,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user