Reference
CLI reference
Commands and flags for connecting, running backtests, starting live deployments, and research workflows.
AlphaLens Core docs
The alphalens command is installed by alphalens-core.
bash
pip install "alphalens-core[live,cloud,fast]"alphalens connect
Cache an AlphaLens API key locally:
bash
alphalens connect --api-key alens_...You can also omit the flag and paste the key when prompted:
bash
alphalens connectAfter connecting, future runs can use the cached session. You can also skip this step and set ALPHALENS_API_KEY for each process.
alphalens run
Run one backtest:
bash
alphalens run --strategy my_strategy:MyStrategy| Flag | Purpose |
|---|---|
--strategy | Required Python import path in module:ClassName format |
--start | Override class.start |
--end | Override class.end |
--universe | Override symbols with SPY,QQQ,IWM or @symbols.txt |
--resolution | Override class.resolution, such as 1day or 5minute |
--param key=value | Pass strategy parameters, repeatable |
--cash | Override class.initial_cash |
--benchmark | Override class.benchmark_symbol |
--report | Write local HTML report |
--save-equity | Write equity curve CSV |
--save-trades | Write trades CSV |
--save-orders | Write orders CSV |
--log-to | Write trade and equity log to SQLite |
--plot | Show a local matplotlib equity chart |
--no-track | Skip local run registry tracking |
--no-progress | Suppress monthly progress output |
--runs-db | Override local run registry DB |
alphalens live
Run a strategy against Alpaca with completed bars:
bash
alphalens live --strategy my_strategy:MyStrategy| Flag | Purpose |
|---|---|
--strategy | Required Python import path in module:ClassName format |
--broker | Broker backend, currently alpaca |
--data | alphalens hosted data or direct polygon |
--live | Route to live Alpaca instead of paper |
--history-bars | Bars seeded before live processing |
--history-max-bars | Maximum rolling bars retained |
--lookback-days | Tail lookback used by market data polling |
--poll-sec | Poll interval while waiting for completed bars |
--idle-log-sec | Idle waiting log cadence |
--state-path | Checkpoint path |
--allow-open-orders | Start even if Alpaca reports open orders |
--continue-on-error | Keep polling after callback errors |
--deployment-id | Reuse an existing Strategy Center deployment |
--deployment-name | Display name for the deployment |
--no-telemetry | Disable AlphaLens telemetry writes |
--param key=value | Pass strategy parameters, repeatable |
Use direct Polygon data only when you manage your own POLYGON_API_KEY:
bash
alphalens live --strategy my_strategy:MyStrategy --data polygonalphalens wfa
Run walk-forward analysis:
bash
alphalens wfa \
--strategy my_strategy:MyStrategy \
--train 504 \
--test 63 \
--step 63| Flag | Purpose |
|---|---|
--train | Train window in bars |
--test | Test window in bars |
--step | Step size in bars |
--anchor | expanding or rolling |
--objective | Metric for selection |
--save-summary | Write per-fold CSV |
Walk-forward and batch workflows are research tools. Strategy Center v1 focuses on synced backtests and live deployments.