Skip to content

Repository files navigation

Netflix (NFLX) Hybrid Forecasting and Trading Overlay

A baseline-aware time-series forecasting project that tests whether technical, fundamental, and sentiment features can improve next-day NFLX forecasting once evaluation is kept chronological, leakage-aware, and benchmarked against strong baselines.

This repository does not claim to have found a universal stock-prediction engine. Its main contribution is more honest than that: it shows what survives after feature audits, purged validation, strong persistence baselines, and end-to-end trading-style evaluation.


TL;DR

  • I tested four regression branches: T+S, T+F, F+S, and T+F+S.

  • Across all branches, none of the final forecasting models beat a persistence baseline on next-day price prediction.

  • The most interesting weak signal appeared in sentiment-linked branches, especially in decision-time directional metrics.

  • In the trading layer, the ranking depended heavily on the execution overlay; there was no stable universal model winner across all presets.

  • The best tested trading result in the final runs was:

    • Branch: F+S
    • Model: LSTM
    • Execution overlay: ultra-conservative
    • Final assets: $9,315.10
    • Return: -6.85%
    • Max drawdown: -12.22%
  • That still means no tested strategy produced a positive absolute return.

  • The practical takeaway is narrower and more defensible: disciplined evaluation + conservative risk control reduced losses materially relative to buy-and-hold, but did not create a robust profitable trading system in this sample.


Research question

Do combinations of:

  • technical indicators such as SMA, RSI, MACD, and signal line,
  • fundamental indicators such as EPS, P/E ratio, and free cash flow,
  • sentiment indicators such as mean sentiment, sentiment intensity, and tweet activity,

provide useful information for next-day NFLX forecasting once the problem is evaluated properly?


What this project covers

Regression branches

  • Technical + Sentiment (T+S)
  • Technical + Fundamental (T+F)
  • Fundamental + Sentiment (F+S)
  • Technical + Fundamental + Sentiment (T+F+S)

Secondary appendix

  • Exploratory next-day direction classification

Trading layer

  • A long-only forecast-driven rebalancing overlay
  • Exposure caps, return thresholds, rebalance logic, transaction costs, and optional warm-up periods
  • Comparison against buy-and-hold over the same test window

Data and audit highlights

Base dataset

  • 1,137 trading-day rows

  • Date range: 2018-01-022022-07-08

  • No missing values in the core source file

  • Covers multiple market regimes:

    • volatile 2018,
    • strong 2020–2021 uptrend,
    • sharp 2022 repricing

    alt text

Important audit findings

  • Heavy-tailed features: Volume and twt_count were strongly right-skewed, so log transforms were retained for modelling.

  • Redundant fundamentals removed:

    • pb_ratio behaved as an almost deterministic transform of price
    • roe behaved as an almost deterministic transform of EPS
  • These were excluded to reduce multicollinearity and avoid pretending that duplicated information is fresh signal.

alt text

Why this matters

A lot of financial modelling work looks good only because the feature set is bloated, the evaluation leaks information, or the benchmark is weak. This project was built specifically to avoid that.


Methodology

The forecasting pipeline was built around:

  • chronological train/test splitting
  • time-series cross-validation on the training segment only
  • purged validation logic for rolling-window experiments
  • training-only scaling for LSTM models
  • feature provenance and redundancy audits
  • strong baselines, especially persistence
  • prediction export for downstream inspection and trading-style analysis

Core forecasting baselines

  • Price-level persistence baseline: tomorrow’s price = today’s price
  • Return baseline: next-day return = 0

Modelling families used

  • Random Forest Regressor (RFR)
  • XGBoost Regressor (XGBR)
  • LSTM

Trading overlay assumptions

The execution layer should still be read as a stylised research backtest, not a live brokerage simulator.

  • Long-only
  • Forecast-driven position adjustment
  • Exposure-capped rebalancing rather than unrestricted all-in/all-out trading
  • Includes transaction costs
  • Includes multiple overlay presets with different aggressiveness levels
  • Evaluated against buy-and-hold over the same branch-specific test window

Forecasting results

Main result

Across all four regression branches, the same pattern repeated:

  • raw exploratory relationships looked mildly interesting,
  • those relationships weakened after winsorisation and shock-day trimming,
  • restricted XGBoost feature screening failed against persistence,
  • final models also failed to beat persistence on next-day price forecasting.

In this NFLX sample, the dominant short-horizon structure was price persistence and autocorrelation, not a strong incremental edge from technical, fundamental, or sentiment features.

Final branch-level summary

Branch Final reporting feature set Best tradable directional accuracy among final models Beat persistence on next-day price RMSE? Main takeaway
T+S Adj Close, log_volume, P_mean 54.59% (XGBoost) No Strongest sentiment-linked branch, but still not a standalone forecasting edge
T+F Adj Close, log_volume, pe_ratio 50.24% (XGBoost) No Fundamentals behaved mostly as slow-moving context
F+S Adj Close, fcf, P_mean 49.34% (XGBoost / LSTM tie) No Event-driven patterns weakened sharply under baseline-aware evaluation
T+F+S Adj Close, log_volume, pe_ratio, P_mean 52.17% (XGBoost) No Richest feature branch still failed against persistence

Appendix classification result

Exploratory up/down classification was retained only as a secondary check.

  • Best held-out result: T+S Random Forest ≈ 55.3% test accuracy
  • But the cross-validation uplift over baseline was weak
  • So classification is treated as exploratory only, not as robust evidence of edge

Trading backtests

Why trading was included

Forecasting metrics alone can be misleading. A model can look weak on RMSE and still behave differently once filtered through execution rules. So I added a trading layer to test whether weak directional structure could be turned into something more practical.

Strategy variants tested

  • Baseline
  • Active
  • Selective
  • Ultra-conservative
  • Defensive but not dead
  • Warm-up

These variants changed the strictness of:

  • minimum expected return for exposure increases,
  • sell / de-risk thresholds,
  • rebalance sensitivity,
  • maximum portfolio exposure,
  • and warm-up timing before the strategy becomes active.

Main trading takeaway

Execution design mattered at least as much as model choice.

A more conservative overlay usually reduced drawdown and often reduced losses relative to more active variants, but none of the tested strategies generated a positive absolute return in the final run set.

Best tested trading run

Among the final tested strategy variants, the strongest result was:

  • Branch: F+S
  • Model: LSTM
  • Execution rule-set: ultra-conservative
  • Final assets: $9,315.10
  • Return: -6.85%
  • Max drawdown: -12.22%
  • Buy-and-hold over the same test window: -62.57%

alt text

Important caveat

That result is best relative to the other tested overlays, not proof of profitability.

It still lost money in absolute terms. What it did show is that a conservative overlay could lose far less than buy-and-hold during a very weak NFLX test window.

Practical interpretation

The trading result does not overturn the forecasting conclusion. It shows something narrower:

weak and fragile directional structure, when filtered through conservative execution logic, can reduce losses relative to naive exposure over this sample window.

That is useful. It is just not the same thing as saying the forecasting model itself is robust or commercially tradable.


Why this project is credible

This repository is strongest where many similar projects are weakest.

It does not:

  • cherry-pick a single flattering metric,
  • ignore persistence,
  • keep redundant features just to look sophisticated,
  • or call fragile signal “alpha”.

Instead, it shows:

  • how to audit engineered variables,
  • how to test multiple feature families systematically,
  • how easily apparent signal collapses under stricter evaluation,
  • and how execution rules can dominate weak model differences.

That honesty is the point.


Repository structure

.
├── data/
│   ├── Final_nflx_data_2018-2022.csv
│   ├── T+S_regr.csv
│   ├── T+F_regr.csv
│   ├── F+S_regr.csv
│   ├── T+F+S_regr.csv
│   └── predictions/
├── trading_bot/
│   ├── agent.py
│   ├── methods.py
│   └── utils.py
├── nflx_hybrid_forecasting.ipynb
├── run_backtest.py
├── train.py
└── visualize.ipynb

train.py is a convenience wrapper kept for convenience. run_backtest.py is the main entry point for the trading overlay.


How to run

1. Reproduce the forecasting pipeline

Open and run:

nflx_hybrid_forecasting.ipynb

This notebook:

  • audits the data,
  • builds the feature branches,
  • runs the regression experiments,
  • exports prediction CSVs,
  • and summarises the results.

2. Run the default trading backtests

python run_backtest.py --pred_glob "data/predictions/*_w4_pred_*.csv" --summary_out data/predictions/backtest_summary.csv

3. Visualise a single backtest session

Open:

visualize.ipynb

For the strongest final tested run, point the notebook to:

  • data/predictions/fs_w4_pred_lstm.csv
  • the matching ultra-conservative backtest history file for that run

Current limitations

  • Single asset: this is an NFLX-only study, not a cross-sectional equity model
  • Short-horizon focus: everything is framed around next-day forecasting
  • Stylised execution: the backtest is useful for disciplined comparison, but it is not live-market execution
  • Signal fragility: most interesting effects weaken after robustness checks
  • Branch-specific test windows: buy-and-hold comparisons differ slightly across some branches
  • No positive absolute trading result: the final strategy sweep improved loss control, but did not produce a profitable strategy in this sample

Final conclusion

Under chronological, leakage-aware, baseline-driven evaluation:

none of the tested feature branches provided a dependable standalone next-day forecasting edge for NFLX in this sample.

That is the central forecasting result.

The strongest practical result came from the trading layer:

F+S + LSTM + ultra-conservative execution overlay produced the best tested end-to-end outcome, finishing at $9,315.10, with -6.85% return and -12.22% max drawdown.

That is still a losing strategy in absolute terms, so the final message of the project is not that complex modelling solved next-day NFLX prediction.

It is that:

  • stronger methodology changes the story,
  • redundancy audits matter,
  • persistence is hard to beat,
  • more features do not automatically help,
  • and conservative execution can reduce damage without creating a robust forecasting edge.

Disclaimer

This repository is a research project, not financial advice. Nothing here should be interpreted as a live trading recommendation.

About

Baseline-aware NFLX forecasting with technical, fundamental, and sentiment features, comparing Random Forest, XGBoost, and LSTM under leakage-safe evaluation and a trading overlay.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages