What the sandbox lies about
Paper is a correctness harness, not a performance oracle:
- Fills are optimistic. Simulated against the NBBO with no queue position, so any passive/limit strategy will look better than it is.
- No market impact, ever. Size is free.
- Delayed data by default.
quote()returns adelayedflag — if it isTrue, fills against those prices are not evidence of anything. - Paper accounts reset and occasionally drift from what your journal thinks.
Performance claims come from replay backtests over journalled snapshots with an explicit slippage model (milestone 4), not from these fills.
Risk limits
Defaults in labtrader/config.py. Limits live in code, not in prompts — a
prompt is a suggestion, this is a constraint.
| Limit | Default |
|---|---|
| Max single position | 5% NAV |
| Max sector | 25% NAV |
| Max gross exposure | 100% (no margin) |
| Orders per agent per day | 10 |
| Notional per agent per day | $50,000 |
| Drawdown halt | 15%, manual re-arm |
| Limit price deviation | 10% from reference |
| Shorting | disabled |
| Session | RTH only |
De-risking is always allowed. A limit only bites if the trade makes an
already-bad number worse — otherwise a risk-reducing agent gets locked out
exactly when it is needed. See TestDeRiskingAlwaysAllowed.
The drawdown halt is the deliberate exception: it blocks selling too, so flattening after a 15% loss is a human decision.
Alerting
Silence is the failure mode: a run that did not happen looks exactly like a run that decided to do nothing. A heartbeat goes out on every run, so a quiet phone on a weekday means something is broken.
python -m labtrader.notify --discover # after messaging your bot once
python -m labtrader.notify --test
Credentials live in a gitignored .env (see .env.example), never in code.
No dependencies — the Telegram Bot API is plain HTTPS.
Notifier.send returns a bool and never raises on ordinary failures: Telegram
being down is not a reason to skip a rebalance or abandon half-submitted
orders. Containment stops at BaseException so Ctrl+C still works.