Marimo Notebooks¶
This repository contains interactive Marimo notebooks.
Features¶
Notebooks live in book/marimo/notebooks/ (configured via MARIMO_FOLDER in .rhiza/.env):
| Notebook | Description |
|---|---|
Experiment1.py |
Basic CTA strategy implementation using moving averages |
Experiment2.py |
Improved CTA strategy with volatility scaling |
Experiment3.py |
Advanced CTA strategy with price filtering and oscillators |
Experiment4.py |
CTA strategy with optimization and risk scaling |
Experiment5.py |
Advanced CTA strategy with correlation-based optimization |
Running the Notebooks¶
Using the Makefile¶
From the repository root:
This will start the Marimo server and open all notebooks in the notebooks folder as specified in .rhiza/.env.
Validating Notebooks¶
To validate that all notebooks run without errors:
Running a Specific Notebook¶
To run a single notebook:
Using uv (Recommended)¶
The notebooks include inline dependency metadata, making them self-contained:
This will automatically install the required dependencies and run the notebook.
Notebook Structure¶
Marimo notebooks are pure Python files (.py), not JSON. This means:
- ✅ Easy version control with Git
- ✅ Standard code review workflows
- ✅ No hidden metadata
- ✅ Compatible with all Python tools
Each notebook includes inline metadata that specifies its dependencies:
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "marimo==0.13.15",
# "numpy==2.3.0",
# "pandas==2.3.0",
# "plotly==6.1.2",
# "cvxsimulator==1.4.3"
# ]
# ///
Configuration¶
Marimo is configured in pyproject.toml to properly import the local package:
The notebook folder is configured in .rhiza/.env:
CI/CD Integration¶
The .github/workflows/rhiza_marimo.yml workflow automatically:
- Discovers all
.pyfiles inbook/marimo/notebooks/ - Runs each notebook in a fresh environment
- Verifies that notebooks can bootstrap themselves
- Ensures reproducibility
This guarantees that all notebooks remain functional and up-to-date.
Creating New Notebooks¶
To create a new Marimo notebook:
-
Create a new
.pyfile in the notebooks directory: -
Add inline metadata at the top:
-
Start building your notebook with cells
-
Test it runs in a clean environment:
-
Commit and push — the CI will validate it automatically
Learn More¶
- Marimo Documentation: https://docs.marimo.io/
- Example Gallery: https://marimo.io/examples
- Community Discord: https://discord.gg/JE7nhX6mD8
Tips¶
- Reactivity: Remember that cells automatically re-run when their dependencies change
- Pure Python: Edit notebooks in any text editor, not just Marimo's UI
- Git-Friendly: Notebooks diff and merge like regular Python files
- Self-Contained: Use inline metadata to make notebooks reproducible
- Interactive: Take advantage of Marimo's rich UI components for better user experience