Strategy Safety Scanner
Is Your Strategy Code Safe?
Before running any strategy, dMoERA's safety scanner checks for:
- Banned imports — no network access, no file system, no subprocess
- Time bombs — hardcoded future dates or bar index thresholds that hide logic until live trading
- Unsafe attributes — no access to
__import__, eval, exec, etc.
- AST structural hash — detects identical logic with different variable names
How It Works
When you run a backtest in the Strategy Lab, the safety scanner runs automatically before execution. If any check fails, the backtest is rejected. This is the same scanner that protects dMoERA's production system.
Frequently Asked Questions
- What does the safety scanner check for?
- Banned imports (network, file system, subprocess), time bombs (hardcoded future dates), unsafe attributes (__import__, eval, exec), and structural code hashing.
- Why is safety scanning important?
- User-submitted strategies run in a sandbox. Without safety scanning, a malicious strategy could access the network, read files, or execute arbitrary code. The scanner prevents this.
- What is a time bomb?
- A time bomb is code that checks the current date or bar index and only activates profitable logic after a certain point. This makes the backtest look profitable but the strategy fails in live trading.
- Can I run the safety scanner separately?
- The scanner runs automatically when you backtest in the Strategy Lab. If you want to scan code without backtesting, just paste it and click Run Backtest — the scan happens first.
Try dMoERA Studio — build, backtest, and deploy strategies with production-grade validation →