Code check and Unit tests
Code check is an automatic check of your code for mistakes. Unit tests runs your project's own tests. Neither one runs a backtest or says whether a strategy makes money.
Two panels in the drawer under the editor check your code. They are easy to confuse with a backtest; they are not one.
Code check: an automatic check of your code#
Each time you pause typing, the sandbox checks every Python file in your projects for mistakes, like a spell-checker for code. It lists syntax errors, undefined names and unused imports by file and line, and marks the same lines in the editor. Click a problem to open its line. It also checks that olypse.json and config.toml can be read. The tab says it in one line: “Checks your code for syntax errors and typos as you type. It never runs your strategy.”
Code check never runs your strategy and never reads market data. A clean Code check means the code can run, not that it makes or loses money.
Unit tests: your project's own tests#
Unit tests in the top bar (or ⌘ ⇧ T, Ctrl Shift T on Windows) runs the Python unit tests in your project's tests folder (files named test_*.py), in your browser, with a 60-second limit. The starter projects come with tests that check their helper functions (a signal, a risk limit, an exit price) on fixed inputs. The results show in the Unit tests tab, test by test.
Unit tests never backtest and never read market data: a test cannot call Olypse at all. Passing unit tests only mean your helper functions do what their tests say.
| What | Code check | Unit tests | Backtest |
|---|---|---|---|
| Runs your code | No | Your tests only | Yes, the whole strategy |
| Reads market data | No | No | Yes, past prices |
| Tells you | Where the code is wrong | Whether your helpers behave | What the strategy would have done |
The sandbox assistant also runs your tests on any change it proposes, before it shows it to you.