Strategy
class is the basis for all backtesting in the SigTech platform. Functionality embedded within the Strategy
class is also accessible via the classes inheriting from it. Strategy
, using the full functionality of the SigTech platform’s building blocks requires a familiarity with the base class. sig.obj.get
API.Strategy
class and calling build
on it.Strategy
:build
on a strategy that has already been built has no additional effect.RollingFutureStrategy
object is an example:currency
and start_date
. If an end_date
isn't used, the asofdate
for the configured environment is used.history
retrieves a pd.Series
of its values or prices:history
on an instrument to return its value through time.build
and history
separately. Calling history
on an unbuilt strategy calls build
automatically.name
to it, using the ticker
parameter. Once constructed, it is added to the cache of the environment.ticker
is not provided on construction, the strategy name
is determined using the strategy details:S
for Strategy
or BS
for BasketStrategy
.Strategy
and display its automatically generated name:Strategy
called TEST STRATEGY
:STRATEGY
added to the end.RollingFutureStrategy
called rfs
. But we did not assign a ticker
value. To display the automatically generated name of rfs
:STRATEGY
:sig.obj.get
API. This includes strategies created by users:rfs
and specify a ticker:ObjectError
, unless the new strategy has identical characteristics to the existing strategy.rfs_duplicate
having the same ticker
as rfs_ticker
, there is no ObjectError
as the characteristics of both strategies are identical:rfs_error
and rfs_ticker
sharing the same ticker
, but not the same start_date
:clone_strategy
method allows you to create a copy of an existing strategy and vary some of its parameters.{parameter: new_value}
pairs should be supplied. The following example creates a version of rfs
in 'EUR'
with an updated ticker
:currency
of the strategy. The number of units is determined by the initial_cash
parameter, with a default value of 1000
.RollingFutureStrategy
in Backtesting, plotting the history of rfs
results in an initial value of 1000:rfs
whose initial_cash
level is 100
:100
:initial_cash
in this way is purely a matter of scaling and will not impact performance characteristics:initial_cash
is set to zero. In this case no positions are opened. It is not possible to compute common metrics, such as return, for such a strategy.RollingFutureStrategy
, you will need to provide a fixed_contracts
parameter and set the initial_cash
to zero. ReinvestmentStrategy
objects, using the initial_shares
parameter. total_return
.rfs
that does not accrue interest on cash held:TotalReturn
version of the strategy and the ExcessReturn
version is approximately 32 basis points:total_return
set to False
and plot the performance of both versions of the strategy:total_return
at the global level when configuring the environment, use the command: sig.env()[sig.config.EXCESS_RETURN_ONLY] = True
.include_trading_costs
parameter.rfs
that does not assume any trading costs:sig.env()[sig.config.IGNORE_T_COSTS] = True
.direction
parameter with a value of 'short'
, as opposed to its default of 'long'
:RollingFutureStrategy
, the 'short'
version coincides with the negative of the long version:RollingFutureStrategy
through a basket delivers the same result as going long on the short version of the RollingFutureStrategy
through a basket:ReinvestmentStrategy
:RollingFutureStrategy
will be determined by the strategy's value and the value of each futures contract. It is possible to specify that a fixed number of contracts be traded by using the fixed_contracts
parameter.ReinvestmentStrategy
that holds precisely one unit of the underlying stock the initial_shares
parameter can be used. You can also choose whether to include an initial cash balance on the strategy.