make should_short and go_short optional
This commit is contained in:
@@ -383,7 +383,6 @@ class Strategy(ABC):
|
||||
def go_long(self) -> None:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def go_short(self) -> None:
|
||||
pass
|
||||
|
||||
@@ -432,13 +431,10 @@ class Strategy(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def should_long(self) -> bool:
|
||||
"""are all filters good to execute buy"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def should_short(self) -> bool:
|
||||
"""are all filters good to execute sell"""
|
||||
pass
|
||||
return False
|
||||
|
||||
@abstractmethod
|
||||
def should_cancel(self) -> bool:
|
||||
|
||||
12
jesse/strategies/TestCanRunWithoutShorting/__init__.py
Normal file
12
jesse/strategies/TestCanRunWithoutShorting/__init__.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from jesse.strategies import Strategy
|
||||
|
||||
|
||||
class TestCanRunWithoutShorting(Strategy):
|
||||
def should_long(self):
|
||||
return False
|
||||
|
||||
def should_cancel(self):
|
||||
return False
|
||||
|
||||
def go_long(self):
|
||||
pass
|
||||
@@ -874,6 +874,10 @@ def test_stop_loss_price_is_replaced_with_market_order():
|
||||
|
||||
def test_take_profit_price_is_replaced_with_market_order():
|
||||
# long position
|
||||
single_route_backtest('TestTakeProfitPriceIsReplacedWithMarketOrderWhenMoreConvenientLongPosition')
|
||||
single_route_backtest('TestTakeProfitPriceIsReplacedWithMarketOrderWhenMoreConvenientLongPTestCanRunWithoutShortingsition')
|
||||
# # short position
|
||||
single_route_backtest('TestTakeProfitPriceIsReplacedWithMarketOrderWhenMoreConvenientShortPosition')
|
||||
|
||||
|
||||
def test_can_run_without_shorting():
|
||||
single_route_backtest('TestCanRunWithoutShorting')
|
||||
|
||||
Reference in New Issue
Block a user