TakeProfitStrategy

TakeProfitStrategy#

class sigtech.framework.strategies.stop_strategy.TakeProfitStrategy

Baseclasses: StopStrategy

TakeProfitStrategy - wrapper for constituent instrument/strategy with a triggered take profit.

Keyword arguments:

  1. instrument_name: Name of instrument/strategy to trade.

  2. trigger_type: Type of trigger to use, string options are listed below.

  3. valuation_lag: Time window between decision time and valuation, defaults to 1BD.

  4. trigger_level: Level used by the trigger.

  5. trigger_method: Optional method to use as close out trigger, takes (dt, valuation, strategy, ).

  6. trigger_params: Optional parameters to use in trigger method.

  7. trade_date: Date to set initial value and determine start date.

  8. limit_period: Time window to trigger close out once exceeded, defaults to None.

  9. initial_units: Units of underlier to trade, defaults to 1.

  10. initial_cash: Cash to include, defaults to 0.

  11. automatic_closeout: Activate automatic closeout of the stop strategy if held by a strategy, defaults to True.

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']]