STRATA — Market State Framework¶
A trainable, stateful neural network architecture purpose-built for market trading.
STRATA is a direct competitor to LSTM/GRU/Transformer for financial time-series, but with a fully interpretable hidden state and outputs designed specifically for trading decision support — not price prediction.
What is STRATA?¶
STRATA provides three levels of API — from foundation model to classic rule-based:
from strata import StrataFormer, StrataFormerConfig, StrataFormerPretrainer
# Step 1: self-supervised pretraining — no labels needed
cfg = StrataFormerConfig(max_seq_len=256, n_layers=4, n_assets=10)
model = StrataFormer(cfg)
trainer = StrataFormerPretrainer(model)
model = trainer.pretrain(raw_candles_10000_bars, epochs=50)
# Step 2: fine-tune on specific asset
from strata import StrataFormerTrainer, StrataFormerDataset
dataset = StrataFormerDataset.from_candles(aapl_candles, seq_len=128, asset="AAPL")
trainer = StrataFormerTrainer(model=model, lr=1e-4)
model = trainer.train(dataset, epochs=20)
# Step 3: variable-length inference
result = model.predict_action(torch.randn(200, 5)) # any length!
# {"action": "LONG", "confidence": 0.71, "context_len": 200,
# "state": {"bias": 0.82, "momentum": 0.45, "trap_risk": 0.18, ...}}
from strata import StrataNet, StrataNetTrainer, StrataNetDataset
# Train from OHLCV — no manual labeling needed
dataset = StrataNetDataset.from_candles(candles, seq_len=30, asset="AAPL")
trainer = StrataNetTrainer(asset="AAPL")
model = trainer.train(dataset, epochs=30)
model.save("aapl_net.pt")
result = model.predict_action(x_tensor)
# {"action": "LONG", "confidence": 0.71, "regime": "TRENDING",
# "state": {"bias": 0.82, "momentum": 0.45, "trap_risk": 0.18, ...}}
from strata import StrataModel, StrataTrainer
# Use pretrained (zero setup)
model = StrataModel.from_pretrained("AAPL")
result = model.predict(candles)
# {"action": "LONG", "confidence": 0.71, "regime": "TRENDING", ...}
# Or train your own
trainer = StrataTrainer(asset="MSFT")
model = trainer.train(windows, n_trials=100)
model.save("msft_model.json")
Key Differentiators¶
| LSTM / GRU | Transformer (GPT) | StrataNet | StrataFormer | |
|---|---|---|---|---|
| Domain | General | General | Trading only | Trading only |
| Hidden state | Opaque | Opaque | 4-dim semantic | 4-dim semantic |
| Context window | Fixed | Variable | Fixed 30 | Variable 30–512+ |
| Multi-asset | ❌ | ❌ | ❌ | ✅ |
| Pretraining | Supervised | Next-token | STRATA teacher | Self-supervised (MBM) |
| Parameters | Millions | Billions | ~5K | ~15K–5M (scalable) |
Links¶
- GitHub: rafaelsistems/strata-market
- PyPI: strata-market
- Hugging Face: emylton/strata-net
- Pretrained Models: AAPL, TSLA, SPY, NVDA, QQQ, BTC