ReinvestmentStrategy
class, you can easily create an exposure to a specific stock and handle all the corporate actions as they occur.SingleStock
object for the primary listing of Apple in the US. SingleStock
and EquityUniverseFilter
pages.SingleStock
objects that handle reinvestment following corporate events with the adjusted_price_history
method.adjusted_price_history
determine whether regular and special dividends should be reinvested, respectively. Events like stock splits are automatically handled by this method: relevant adjustment factors are computed and then incorporated in building price series.adjusted_price_history
series. Regardless of argument choice, the stock splits no longer impact the adjusted price series.TSLA
shows what happens when no dividends have been received by the holders of the security. SIGMaster
to find the primary US listing of TSLA
:adjusted_price_history
does not impact the resulting time series. As expected, the adjusted price series does not show a division by the split factor (5) following the August 2020 stock split.ReinvestmentStrategy
objectsadjusted_price_history
method does not. ReinvestmentStrategy
classReinvestmentStrategy
('RS' henceforth).build
triggers the backtest specified by the object's parameters to be run. It is then possible to view strategy performance through calling history
.history
are determined by its holiday calendar. The holiday calendar can be obtained from the underlying stock.initial_cash
parameter, which defaults to 1000
. ReinvestmentStrategy
inherits from the Strategy
class and inherits its fields, methods, and more.PlotWrapper
and AnalyticsWrapper
components of a strategy:direction
initial_cash
include_trading_costs
total_return
TOP_POSITION_CHG_PTS
: 1000045.SINGLE_STOCK.TRADABLE UNREALISED CASH
at [2019/02/14, 09:00:00] is dividend proceeds.reinvest_cash_dividends
provides user control over this logic.withholding_tax_override
parameter. units_held x unit_price / strategy_price
enable_tracking
parameter will cause an RS to trade toward full exposure on a schedule provided by the user (tracking_frequency
, default SOM
).tracking_threshold
can also be set (default 1bp
) that controls whether these tracking trades should be executed. For example, the threshold is 1%, the current exposure is 99.5%, so no action takes place.threshold_frequency
can impact performance.final_trade_out
parameter causes a Reinvestment Strategy to sell out of the underlying before it is delisted. The RS will then hold cash.final_trade_out
set to False
has nan prices from the delisting date onward, rendering it impossible to trade, which includes the closing of positions in it. The version with final_trade_out
set to True
does not have this problem.borrow_cost_ts
parameter. The following example assumes there is no borrowing cost:trade_swap_format
: equity traded as swap if set to True
. swap_reset_frequency
: frequency at which swap is reset, which leads to margin cleanup.swap_include_financing
: financing, as determined by the libor_instrument_name
and libor_spread
parameters, is charged if True
.