lean
Run QuantConnect LEAN backtests and manage US equity algorithm development. Use when asked to backtest a trading strategy, run a LEAN algorithm, analyze backtest results, download market data, or deploy to Interactive Brokers TWS. Covers algorithm creation, data management, config editing, and result analysis.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/cylqqqcyl/lean-engineLEAN Engine — QuantConnect Algorithmic Trading
Prerequisites & Setup
Required Environment Variables
| Variable | Purpose | Example |
|---|---|---|
LEAN_ROOT | Path to cloned LEAN repository | /home/user/lean |
DOTNET_ROOT | Path to .NET SDK installation | /home/user/.dotnet |
PYTHONNET_PYDLL | Path to Python shared library (required by LEAN's pythonnet) | $LEAN_ROOT/.libs/libpython3.11.so.1.0 |
All three must be set before using this skill. Add to your shell profile:
export LEAN_ROOT="$HOME/lean"
export DOTNET_ROOT="$HOME/.dotnet"
export PATH="$PATH:$DOTNET_ROOT"
export PYTHONNET_PYDLL="$LEAN_ROOT/.libs/libpython3.11.so.1.0"
Note: LEAN bundles its own Python shared library in
$LEAN_ROOT/.libs/. If you built LEAN from source, the library should be there afterdotnet build. If not, installlibpython3.11-devand pointPYTHONNET_PYDLLto your system'slibpython3.11.so.
First-Time Setup
-
Install .NET 8 SDK:
# Linux/macOS wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh chmod +x dotnet-install.sh ./dotnet-install.sh --channel 8.0 export DOTNET_ROOT="$HOME/.dotnet" export PATH="$PATH:$DOTNET_ROOT" -
Clone and build LEAN:
git clone https://github.com/QuantConnect/Lean.git "$LEAN_ROOT" cd "$LEAN_ROOT" dotnet build QuantConnect.Lean.sln -c Debug -
Download initial market data:
pip install yfinance pandas python3 {baseDir}/scripts/download_us_universe.py --symbols sp500 --start 2020-01-01 --data-dir "$LEAN_ROOT/Data" -
Verify setup:
ls "$LEAN_ROOT/Data/equity/usa/daily/" # Should list .zip files ls "$LEAN_ROOT/Launcher/bin/Debug/" # Should contain QuantConnect.Lean.Launcher.dll
Environment
- LEAN source:
$LEAN_ROOT/ - Launcher (pre-built):
$LEAN_ROOT/Launcher/bin/Debug/ - Config:
$LEAN_ROOT/Launcher/config.json - Python algos:
$LEAN_ROOT/Algorithm.Python/ - Market data:
$LEAN_ROOT/Data/ - dotnet:
$DOTNET_ROOT/dotnet(add to PATH:export PATH="$PATH:$DOTNET_ROOT")
Quick Reference
Run a Backtest
- Place algorithm in
$LEAN_ROOT/Algorithm.Python/YourAlgo.py - Edit config to point to it:
# Update config.json — set these fields: # "algorithm-type-name": "YourClassName" # "algorithm-language": "Python" # "algorithm-location": "../../../Algorithm.Python/YourAlgo.py" - Run:
export PATH="$PATH:$DOTNET_ROOT" cd "$LEAN_ROOT/Launcher/bin/Debug" dotnet QuantConnect.Lean.Launcher.dll - Results appear in stdout +
$LEAN_ROOT/Results/
Or use the helper script:
bash {baseDir}/scripts/run_backtest.sh YourClassName YourAlgo.py
Config Editing
Edit $LEAN_ROOT/Launcher/config.json with these key fields:
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-cylqqqcyl-lean-engine": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
body
Physical performance — workouts, fitness tracking, nutrition, meal logging, macros, recipes. Use when the user mentions exercise, lifting, running, training, food, eating, macros, protein, meal planning, or anything related to physical health and performance. Routes to sub-skills: coach (movement/training) or chef (nutrition/food).
recipe-scout
Find and normalize Chinese recipes (中餐菜谱) from structured sources first, then export clean recipe notes to Obsidian markdown. Prefer stable recipe sites over social posts; use 小红书 only for inspiration/fallback. Use when user asks for: Chinese recipes / 中餐菜谱, "how to cook X" / 做法, meal ideas, home-style dishes, weeknight cooking, recipe collection / curation, or recipe note creation in Obsidian.