TakeProfitStrategy#
-
class sigtech.framework.strategies.stop_strategy.TakeProfitStrategy
Baseclasses:
StopStrategy
TakeProfitStrategy - wrapper for constituent instrument/strategy with a triggered take profit.
Keyword arguments:
instrument_name
: Name of instrument/strategy to trade.trigger_type
: Type of trigger to use, string options are listed below.valuation_lag
: Time window between decision time and valuation, defaults to1BD
.trigger_level
: Level used by the trigger.trigger_method
: Optional method to use as close out trigger, takes (dt, valuation, strategy, ).trigger_params
: Optional parameters to use in trigger method.trade_date
: Date to set initial value and determine start date.limit_period
: Time window to trigger close out once exceeded, defaults toNone
.initial_units
: Units of underlier to trade, defaults to1
.initial_cash
: Cash to include, defaults to0
.automatic_closeout
: Activate automatic closeout of the stop strategy if held by a strategy, defaults toTrue
.
The trigger types available are:
'FIXED_PCT_PROFIT'
- Trigger close if percentage profit exceeds level from trade date.'FIXED_ABS_PROFIT'
- Trigger close if absolute profit on one unit exceeds level from trade date.'TRAILING_PCT_PROFIT'
- Trigger close if percentage profit exceeds level from low.'TRAILING_ABS_PROFIT'
- Trigger close if absolute profit on one unit exceeds level from low.'METHOD'
- Trigger close using custom trigger method.
Example object creation:
import datetime as dtm future = env.object.get('ESZ19 INDEX') tp = sig.TakeProfitStrategy( currency='USD', trade_date=dtm.date(2019,9,1), instrument_name=future.name, trigger_type='FIXED_PCT_PROFIT', trigger_level=0.01, )
Alternatively, a strategy wrapper can be generated to trade a specified object using the helper method:
tp = sig.TakeProfitStrategy.get_for_trade(future, dtm.date(2019,9,1))
-
TRIGGER_METHOD = {'FIXED_ABS_PROFIT': <function fixed_abs_profit_trigger>, 'FIXED_PCT_PROFIT': <function fixed_pct_profit_trigger>, 'TRAILING_ABS_PROFIT': <function trailing_abs_profit_trigger>, 'TRAILING_PCT_PROFIT': <function trailing_pct_profit_trigger>}
-
trigger_type: Optional[Literal['FIXED_PCT_PROFIT', 'FIXED_ABS_PROFIT', 'TRAILING_PCT_PROFIT', 'TRAILING_ABS_PROFIT', 'METHOD']]