Getting started with Alpaca API and Zipline Reloaded

Hello everyone and thanks for looking at this!

I just finished Clenow’s books ‘Following the Trend’, ‘Stocks on the Move’, and ‘Trading Evolved’.

It has me interested in expanding from strictly TA to doing some Systematic/Quantitative Trading that would require me to standup a backtesting environment and stock selector/screener. These books are 5-10 yrs old, so I want to make sure I’m not going down an outdated path.

Here are the two goals:

  1. Weekly Stock Selector/Screener (may advance to Futures later, but for now US Equities)

Ingest individual price data for all tickers for a specific index (i.e. S&P 500)

  • Data needs to go back 100 days, Daily timeframe, cleaned for splits/dividends, etc.
  • Need to be able to filter based on common technicals, for example something like:
    • disqualify stocks trading below their 100-day moving average
    • disqualify stocks that made any single-day moves exceeding 15% in the past 90 days
    • Rank by Average True Range - to measure volatility

Question - Can Alpaca’s API provide this data? I also have an IBKR account if that API would work as well. I can then use R to run some other criteria

  1. Backtesting environment with historical price data
  • Is something like Python and Zipline-Reloaded using Alpaca still the best solution (as described in Clenow’s ‘Trading Evolved’ book?

Thanks!

Hi Nordy,

Recently started playing with a solution like this aswell, how has your progress been so far? I’ve been looking to see if Alpaca API provides certain data aswell. Have been integrating it with Ollama in the back-end running it on gpt3.5 and some of the answers or suggestions it can give is impressive already.

@nordy @yyxzy I have the same general question. Do either of you have comments on this since your earlier posts? Thanks!

I too have worked through ML4AT and trading Evolved. I am yet to get a working environment for Zipline-Reloaded. That’s where my endeavors seem to end. Clenow seems to provide a clear way to create continuous futures contracts in Zipline (CHRIS dataset is deprecated), I cannot however say I have done that as mentioned earlier. My goal is to apply Stefan’s and Clenow’s methods in Trading Evolved, for intraday futures trading. I have gotten mixed results with Random Forest, XGBoost, LightGBM and LSTM for intraday inference problems and I am happy to share the IPYNBs. I would appreciate any help in setting up Zipline so I can do a thorough deep dive.