Reference

CLI reference

Commands and flags for connecting, running backtests, starting live deployments, and research workflows.

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 connect

After 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
FlagPurpose
--strategyRequired Python import path in module:ClassName format
--startOverride class.start
--endOverride class.end
--universeOverride symbols with SPY,QQQ,IWM or @symbols.txt
--resolutionOverride class.resolution, such as 1day or 5minute
--param key=valuePass strategy parameters, repeatable
--cashOverride class.initial_cash
--benchmarkOverride class.benchmark_symbol
--reportWrite local HTML report
--save-equityWrite equity curve CSV
--save-tradesWrite trades CSV
--save-ordersWrite orders CSV
--log-toWrite trade and equity log to SQLite
--plotShow a local matplotlib equity chart
--no-trackSkip local run registry tracking
--no-progressSuppress monthly progress output
--runs-dbOverride local run registry DB

alphalens live

Run a strategy against Alpaca with completed bars:

bash
alphalens live --strategy my_strategy:MyStrategy
FlagPurpose
--strategyRequired Python import path in module:ClassName format
--brokerBroker backend, currently alpaca
--dataalphalens hosted data or direct polygon
--liveRoute to live Alpaca instead of paper
--history-barsBars seeded before live processing
--history-max-barsMaximum rolling bars retained
--lookback-daysTail lookback used by market data polling
--poll-secPoll interval while waiting for completed bars
--idle-log-secIdle waiting log cadence
--state-pathCheckpoint path
--allow-open-ordersStart even if Alpaca reports open orders
--continue-on-errorKeep polling after callback errors
--deployment-idReuse an existing Strategy Center deployment
--deployment-nameDisplay name for the deployment
--no-telemetryDisable AlphaLens telemetry writes
--param key=valuePass strategy parameters, repeatable

Use direct Polygon data only when you manage your own POLYGON_API_KEY:

bash
alphalens live --strategy my_strategy:MyStrategy --data polygon

alphalens wfa

Run walk-forward analysis:

bash
alphalens wfa \
  --strategy my_strategy:MyStrategy \
  --train 504 \
  --test 63 \
  --step 63
FlagPurpose
--trainTrain window in bars
--testTest window in bars
--stepStep size in bars
--anchorexpanding or rolling
--objectiveMetric for selection
--save-summaryWrite per-fold CSV

Walk-forward and batch workflows are research tools. Strategy Center v1 focuses on synced backtests and live deployments.