QuantRocket logo

Disclaimer

Moonshot Strategy Code

The strategy code for the dead-cat-drop strategy is provided in dead-cat-drop.py.

Strategy Highlights

In prices_to_signals, the strategy first computes a dollar volume filter to screen out illiquid stocks:

closes = prices.loc["Close"]

# Compute dollar volume mask
dollar_volumes = prices.loc["Volume"] * closes
avg_dollar_volumes = dollar_volumes.rolling(window=22).mean()
are_eligible = avg_dollar_volumes >= self.MIN_DOLLAR_VOLUME

We limit the universe to equity shares (EQS), thus excluding ETFs, Depository Receipts, and other security types:

sectypes = get_securities_reindexed_like(
    closes, "edi_SecTypeCode").loc["edi_SecTypeCode"]
are_eligible &= sectypes == "EQS"

Finally, we identify the stocks that fell 10%:

# Compute big losers mask
prior_returns = (closes - closes.shift()) / closes.shift()
big_losers = prior_returns <= -0.10

short_signals = big_losers & are_eligible

return -short_signals.astype(int)

We short these stocks on the next day's open and exit on the close.

Exchange-specific subclasses

The recommended Moonshot paradigm when backtesting multiple markets is to implement the strategy logic in a base class, then create subclasses for each exchange/market with the appropriate exchange-specific parameters.

For this strategy, the exchange-specific parameters are:

The following code was used to generate the subclasses which were then pasted into the strategy file. If you are using different exchanges, adjust the code below and paste your exchanges in the strategy file:

Install strategy file

To "install" the strategy, execute the following cell to move the strategy file to the /codeload/moonshot directory, where Moonshot looks:


Next Up

Part 3: Multi-Country Backtest