a Joint-Embedding Predictive Architecture for stock price prediction
tickle is a JEPA-based (Joint-Embedding Predictive Architecture) system for stock price prediction. Unlike generative models that predict exact prices, JEPA learns representations in a joint embedding space, making it more robust to market noise.
The system processes 1-minute OHLCV data with 30-tick context windows and 20 input features (5 price + 15 technical indicators). It predicts log-returns with uncertainty estimates, enabling position sizing based on expected risk-adjusted returns.
| stock | dataset | return | win rate | sharpe | trades |
|---|---|---|---|---|---|
| AMZN | test | +1.32% | 43.9% | 0.52 | 312 |
| META | test | -2.17% | 48.1% | -0.09 | 81 |
| AAPL | train | -2.43% | 39.7% | -1.27 | 224 |
| TSLA | train | -5.82% | 40.2% | -0.99 | 764 |
| MSFT | train | -9.42% | 37.5% | -1.33 | 24 |
The winning configuration (Kelly=0.7, Min Return=0.005) achieved +1.32% return on AMZN with 43.9% win rate. Notably, this configuration only works on AMZN — suggesting the model learned stock-specific patterns rather than generalizable features.
# Model architecture in PyTorch
context_encoder = Conv1DEncoder(
input_dim=20,
hidden_dims=[64, 128],
embedding_dim=128
)
predictor = MLPPredictor(
embedding_dim=128,
hidden_dims=[128, 128]
)
decoder = LogReturnDecoder(
embedding_dim=128,
hidden_dim=64,
output_features=5
)
The trading strategy uses a Kelly-inspired position sizing approach with configurable parameters:
# Winning configuration
kelly_fraction = 0.7 # More aggressive than half-Kelly
min_expected_return = 0.005 # Filter low-quality signals
max_position = 1.0 # Full position cap
# Position calculation
raw_kelly = expected_return / variance
position_size = raw_kelly * kelly_fraction
The high min_expected_return threshold (0.005) filters out low-quality trades,
while the aggressive kelly_fraction (0.7) capitalizes on the edge when signals
pass the filter. This combination achieved positive returns where the baseline failed.
| phase | description | status | result |
|---|---|---|---|
| Phase 1 | Technical Indicators | complete | +6.7% win rate |
| Phase 2 | Multi-Stock Training | complete | 46.7% win rate |
| Phase 3 | Architecture Experiments | complete | Conv1D best |
| Phase 4 | Transformer | complete | overfit |
| Phase 5 | HMM Regime Detection | complete | 3 regimes |
| Phase 6 | Best Config | complete | 40-46% win |
| Phase 7A | Position Sizing | complete | +1.32% AMZN |
# Activate environment
source venv/bin/activate
# Run training with best config
python scripts/train_best_config.py --symbol AMZN --device cuda
# Run backtest with optimized parameters
python scripts/train_and_backtest_fast.py \
--symbol AMZN \
--kelly-fraction 0.7 \
--min-expected-return 0.005 \
--use-features
tickle/
├── src/
│ ├── models/ # Encoders, Predictors
│ ├── features.py # Technical indicators
│ ├── strategies.py # Trading strategies
│ └── simulator.py # Backtesting engine
├── scripts/
│ ├── train_best_config.py
│ ├── optimize_position_sizing.py
│ └── test_winning_config_all_stocks.py
├── stock_data/ # 1-minute OHLCV data
└── results/ # Experiment results