DailyStrategy#
-
class sigtech.framework.strategies.strategy.DailyStrategy
Baseclasses:
Strategy
Subclasses:
RollingStrategyBase
,SingleBondStrategy
,StructureBasketBase
,BasketStrategy
,FlexibleBasket
,ReinvestmentStrategy
,OptionsStrategyBase
,SignalStrategy
,FXForwardHedgingStrategy
,PiecewiseStrategy
,DynamicStrategy
,FeeStrategy
,RatesStrategy
,StopStrategy
,TotalReturnSwapStrategy
,DeltaHedgingStrategy
Base daily strategy class, with one decision and execution point per day.
Parameters are the same as in the base
Strategy
.Additional attributes:
decision_time_input
: Decision time used for the addition on processes to a specified date. Optional, taken from Trading Manager if not given.decision_timezone_input
: Timezone to use for the decision time. Optional, taken from Trading Manager if not given.size_time_input
: Time point used to calculate the sizing. Optional, taken from Trading Manager if not given.size_timezone_input
: Timezone of the time point used to calculate the sizing. Optional, taken from Trading Manager if not given.execution_time_input
: Trade execution time. Optional, 4pm by default.execution_timezone_input
: Timezone used for the execution time. Optional, Europe/London by default.
Example:
import datetime as dtm class ExampleStrategy(sig.DailyStrategy): def strategy_initialization(self, dt): # Initialization self.add_method(dt + dtm.timedelta(days=1), self.action) def action(self, dt): # Action for strategy to take self.add_position_target(dt, 'EUR CASH', 1, unit_type='WEIGHT') tst = ExampleStrategy(currency='USD', start_date=dtm.date(2015,1,2)) tst.history()
-
property decision_start_date
First (local) decision date of the strategy.
-
decision_time_input: Optional[time]
-
decision_timezone_input: Optional[str]
-
property execution_time
Execution time for orders created by this strategy. If
execution_time_input
is not given, this defaults to 4pm.
-
execution_time_input: Optional[time]
-
execution_timezone_input: Optional[str]
-
property execution_tzinfo
Timezone for the execution time for the orders created by this strategy. If
execution_timezone_input
is not provided, this defaults to Europe/London.
-
property first_entry_date
First date to use for trading.
-
property size_time
Time point used to calculate the sizing. This is used to imply the correct data point. If not supplied, the close time from the trading manager is used.
-
size_time_input: Optional[time]
-
size_timezone_input: Optional[str]
-
property size_tzinfo
Timezone of the time point used to calculate the sizing. This is used to imply the correct data point. If not supplied, the default timezone from the trading manager is used.
-
decision_dt_from_date(d, use_trading_manager_calendar=True)
Returns UTC datetime for the given date d by appending
_decision_time
. If_decision_time
is not specified it defaults to the business start time of the TradingManager (trader). Input date is adjusted forward to a trader business date if needed.- Parameters:
d – Input date.
use_trading_manager_calendar – If true, the trading manager calendar is used.
- Returns:
Datetime.
-
decision_dt_from_execution_dt(execution_dt)
Return the latest acceptable decision datetime for the given execution datetime. If needed, the decision datetime is rolled back to a valid trader business day.
- Parameters:
execution_dt – Execution datetime.
- Returns:
Datetime.
-
size_date_from_date(d)
Return the previous strategy data point as a datetime to the valuation date.
- Parameters:
d – Valuation date.
- Returns:
Datetime.
-
size_date_from_decision_dt(decision_dt)
Returns the previous strategy data point to the valuation date where the decision datetime falls in.
- Parameters:
decision_dt – Decision datetime.
- Returns:
Datetime.
-
size_dt_from_date(d)
Returns the previous strategy data point as a date to the valuation date.
- Parameters:
d – Valuation date.
- Returns:
Datetime.
-
suggested_next_run_time(asof=None)
Suggested next time to run the strategy to capture the next actions.
This defaults to the decision time on each business day.
- Parameters:
asof – Input as-of-date.
- Returns:
Datetime.