--- title: Gamedayspx emoji: 📊 colorFrom: pink colorTo: purple sdk: streamlit sdk_version: 1.21.0 app_file: app.py pinned: false --- # Gameday SPX: An ML Approach to Predicting 🟥 or 🟩 Given the proliferation of trading styles widely available today to retail investors, there are so many different ways to make money in today's market. This model is an effort to simplify my personal trading style by gathering most of the features that I would consider important, feed them to a model and get an output for whether the day will be green for $SPX (higher than yesterday's close) or red (lower than yesterday's close). In addition to daily data, I also grab intraday data to emulate how I would trade. This is specific for $SPX, because I primarily trade this index and primarily do credit spreads. My style leans toward "this level should hold". # TL;DR on WTF - The purpose of this project is to predict whether the current day's close will be above the previous day's close (`Target`). - Predictions are produced through generalized stacking of an ensemble of 2 models. - 4 different flavors 🍧 are currently available: At Open, 30 / 60 / 90 minutes into trading session. - Using probabilities outside of `(0.4, 0.6]` results in `precision` in 0.7 - 0.8 range. - Model validated with walk forward validation. # Features for `🌞 At Open` - `BigNewsDay`: This feature represents whether the current day is a "big news day", eg. NFP, CPI, PPI, CPE, etc. - `Quarter`: The current quarter as of previous day (Q1,Q2,Q3,Q4) - `Perf5Day`: Whether the previous day's close is higher than it was 5 days earlier. - `Perf5Day_n1`: Previous value of 👆🏽 - `DaysGreen`: Consecutive number of days green (close > previous close), as of the previous day. - `DaysRed`: Consecutive number of days red (close <= previous close), as of the previous day. - `CurrentGap`: The current day's gap as a percentage of the previous close, or (Open - Previous close) / Previous Close - `RangePct`: The previous day's range as a percent of the prior day's close. - `RangePct_n1`: Previous value of 👆🏽 - `RangePct_n2`: Previous value of 👆🏽 - `OHLC4_VIX`: The previous day's OHLC4 of VIX. - `OHLC4_VIX_n1`: Previous value of 👆🏽 - `OHLC4_VIX_n2`: Previous value of 👆🏽 # Additional Features for `30 Min` and `60 Min` models - `CurrentHightoClose`: High of 30/60 Min candles in relation to previous close. - `CurrentLowtoClose`: Low of 30/60 Min candles in relation to previous close. - `CurrentClosetoClose`: Close of 30/60 Min candles in relation to previous close. - `CurrentRange`: High - Low of 30/60 Min candles in relation to previous close. - `GapFill`: Whether the CurrentGap was filled within the first 30/60 minutes.