🎬 Deploy Guide
The stratequeue deploy
command is the heart of StrateQueue.
It wraps your strategy files in the live trading runtime, streams market data, and (optionally) sends real trades to your broker.
🛡️ Safe by default — if you don't pass
--paper
or--live
, StrateQueue only prints signals.
1 · Command Anatomy
stratequeue deploy \
--strategy <file.py[,file2.py,...]> \
[ --allocation <pct|$>[, ...] ] \
[ --symbol TICKER[, ...] ] \
[ --data-source demo|polygon|coinmarketcap[, ...] ] \
[ --timeframe 1s|5m|1h[, ...] ] \
[ --broker alpaca|kraken|... ] \
[ --engine backtesting|backtrader|vectorbt|zipline ] \
[ --paper | --live | --no-trading ] \
[ --duration 120 ] \
[ --lookback 200 ] \
[ --verbose ] \
[ --daemon ]
Everything in brackets is optional; the only required flag is --strategy
.
2 · Execution Modes
Mode | Flag | Trades Sent? | Credentials Required |
---|---|---|---|
Signals-only (default) | — or --no-trading |
❌ | None |
Paper trading | --paper |
✅ – sandbox | Broker paper keys |
Live trading | --live |
✅ – real money | Broker live keys |
🚨 Passing
--live
will print an extra warning block (see code inDeployValidator
) before anything is executed.
3 · Single-Strategy Examples
# Test safely on demo data (prints signals every new bar)
stratequeue deploy \
--strategy examples/strategies/backtesting.py/sma.py \
--symbol AAPL --timeframe 1m
# Paper trade on Polygon real-time feed
stratequeue deploy \
--strategy my_algo.py --symbol AAPL \
--data-source polygon --timeframe 1m --paper
# Explicitly pick an engine (overrides auto-detect)
stratequeue deploy \
--strategy my_vbt_algo.py --engine vectorbt \
--symbol ETH-USD --timeframe 5m --no-trading
4 · Multi-Strategy Portfolios
Passing multiple files to --strategy
switches StrateQueue into multi-strategy mode.
4.1 Inline allocations
# 70 % SMA + 30 % Momentum on the same symbol
stratequeue deploy \
--strategy sma.py,momentum.py \
--allocation 0.7,0.3 \
--symbol AAPL --timeframe 1m
Rules enforced by DeployValidator
:
--allocation
is mandatory in multi-strategy mode.- Values can be all percentages (
0-1
) or all dollar amounts (>1
) — mixing types raises an error. - Percentages should sum ≈ 100 %; a warning is logged otherwise.
4.2 1 : 1 strategy-symbol mapping
If the number of symbols equals the number of strategies, StrateQueue pairs them automatically:
# Each strategy on its own market
stratequeue deploy \
--strategy btc_scalper.py,eth_swing.py \
--allocation 0.5,0.5 \
--symbol BTCUSD,ETHUSD \
--timeframe 1m
Internally a temporary CSV config is generated (see create_inline_strategy_config
).
5 · Advanced Flags
Flag | Purpose | Default |
---|---|---|
--data-source |
demo , polygon , coinmarketcap (one or many) |
demo |
--timeframe / --granularity |
Bar size per data source. Validity checked by validate_granularity . |
— |
--broker |
Override auto-detected broker (alpaca , kraken , …). Use auto or omit to let StrateQueue inspect env vars. |
auto |
--engine |
Force engine if auto-detection fails (backtesting , vectorbt , zipline ). |
auto |
--lookback |
Historical bars to fetch plus one (implemented as type=lambda x: int(x)+1 ). |
60 |
--duration |
Minutes to run before graceful shutdown. | 60 |
--verbose |
Extra log output (stratequeue.log ). |
off |
--daemon |
Sends the deployment to the background REST daemon on port 8400. | off |
--
6 · Background Daemon
# Non-blocking: returns immediately, leaves strategy running in the daemon
stratequeue deploy --strategy sma.py --symbol AAPL --daemon
If the daemon isn't running, StrateQueue will spawn it automatically, then POST the deployment request (see _send_to_daemon()
).
Check status later:
stratequeue status # broker + engine health
curl http://127.0.0.1:8400 # daemon API
7 · Discoverability Cheatsheet
stratequeue list engines # Which engines are installed & usable
stratequeue list brokers # Supported brokers
Need a refresher?
stratequeue deploy --help
The help text is generated straight from DeployCommand.setup_parser()
and always up to date.
8 · Troubleshooting
Message | Likely Cause | Fix |
---|---|---|
❌ Strategy file not found: |
Path typo | Provide correct .py path |
--allocation is required for multi-strategy mode |
Forgot allocations | Add --allocation values |
Cannot mix percentage and dollar allocations |
Mixed 0.5,1000 |
Use all percentages or all dollars |
Unsupported broker 'x' |
Wrong name | stratequeue list brokers |
No scrolling output | yfinance rate-limit | --data-source something or lower bar freq |
Live mode prompt not shown | Forgot --live |
Add it (double-check keys first!) |
🎉 Deployment mastered!
You can now iterate fast:
- Edit the strategy file
- Rerun the same
deploy
command - Level-up from signals → paper → live when ready
Happy trading! 🚀