Skip to content
All hypotheses

Hypotheses

Quantiacs LSTM Multiple-Features Port: AAPL Daily Next-Open-Up Regressor, Raw Output as Target Weight (AAPL.USEQ 1-DAY, 2x64 LSTMCell, LBFGS, Retrain Every 360 Bars, Fixed Source Defaults)

Faithful port of the open-source MIT strategy 'strategy-ml_lstm_multiple_features' by Quantiacs (https://github.com/quantiacs/strategy-ml_lstm_multiple_features, commit 51f5c6d). Credit goes to the original author. Any…

Hypothesis

Faithful port of the open-source MIT strategy 'strategy-ml_lstm_multiple_features' by Quantiacs (https://github.com/quantiacs/strategy-ml_lstm_multiple_features, commit 51f5c6d). Credit goes to the original author. Any performance the source claims is unverified; our own backtest with real costs decides. The source asset NAS:AAPL maps to AAPL.USEQ on 1-DAY bars (split-adjusted, decades of history). The source backtest starts on 2006-01-01. It uses one instrument and OHLCV only, with no supplementary data. MODEL:……Show moreShow less

Faithful port of the open-source MIT strategy 'strategy-ml_lstm_multiple_features' by Quantiacs (https://github.com/quantiacs/strategy-ml_lstm_multiple_features, commit 51f5c6d). Credit goes to the original author. Any performance the source claims is unverified; our own backtest with real costs decides. The source asset NAS:AAPL maps to AAPL.USEQ on 1-DAY bars (split-adjusted, decades of history). The source backtest starts on 2006-01-01. It uses one instrument and OHLCV only, with no supplementary data. MODEL: two stacked LSTMCell layers (input_dim=3, hidden=64) followed by Linear(64->1). Hidden and cell states start at zero at the beginning of each sequence, and the model gives an output at every step. Gates follow standard PyTorch LSTMCell order i,f,g,o with both bias_ih and bias_hh. FEATURES per bar, in this order: [ln(close), ln(open), high]. The source does NOT log the high; this quirk is kept on purpose. Missing values are forward-filled, then back-filled, then filled with 1. TARGET for bar t: 1 if open[t+1] > open[t], else 0. In a training slice the last bar has no next open, so xr.where gives it label 0; this is kept. TRAINING: use the last train_period=100 bars up to and including the current bar as one batch of size 1. Loss is MSE over the 100 per-step outputs. The optimiser is L-BFGS with lr=0.08 and PyTorch defaults (max_iter=20, max_eval=25, tolerance_grad=1e-7, tolerance_change=1e-9, history_size=100, no line search), and exactly one optimiser.step call (epochs=1). Each retrain builds a fresh seed-42 model. Retraining happens every retrain_interval=360 bars; retrain_interval_after_submit is live-only and not used here. PREDICTION (predict_each_day=False, lookback_period=155): after each retrain, the model starts from zero state 155 bars before the retrain bar and runs causally until the next retrain. The output at bar d is the target weight for bar d. POSITION: w = clip(output, -1, 1). A positive w means long w x equity; a negative w means short |w| x equity. The position is rebalanced every daily bar to whole shares, decided at the close and executed at the next available price. The source has no stop or take-profit. Leverage is 1.0. DECLARED UNAVOIDABLE DEVIATION: PyTorch cannot be imported in the sandbox. The LSTMCell forward pass, the backprop-through-time gradient and PyTorch L-BFGS are therefore re-implemented in numpy. Initial weights are drawn U(-0.125, 0.125), PyTorch's default, from numpy default_rng(42) in PyTorch parameter order. Their distribution matches, but the exact torch RNG stream does not. Everything else is line-for-line.

Analysis

strategy-ml_lstm_multiple_features

Backtest and paper results are hypothetical. Trading involves risk of loss.