Automated trading on Alpaca
Alpaca is an API-first broker with a paper-trading environment, and DeployQuant supports both paper and live accounts on it. You connect with API keys, DeployQuant sends the orders your strategy produces, and your cash and shares stay in your Alpaca account in your name.
Ten of the 12 templates run live at Alpaca. The other two use trailing-stop exits: 20-day momentum with a trailing stop and SMA-200 trend with a 15% trailing stop. Trailing-stop exits are not deployable live yet at any broker, so those two can be backtested but not deployed to an Alpaca account. The table below marks them backtest only for now, and the template pages carry their backtest results. The 3-month momentum switch has no trailing stop and runs live.
The numbers on this page come from backtests on 59 ETFs from 2021-01-04 to 2026-10-02 with $10,000 starting capital, no margin, and no fees or slippage in the headline run. They are hypothetical. They show what each template did on past data and say nothing about how it will do on a live account.
How it works
- Connect Alpaca with your API keys. Paper and live accounts are both supported.
- Validate any strategy against Alpaca paper first: same rules, simulated money, live data.
- Promote to the live account when paper behavior matches the backtest.
- Each deployed strategy runs in its own sleeve with independent cash.
- Guardrails check every order: price bands, notional caps, and a global pause.
Alpaca's paper environment runs strategies through the same order path as live, with no capital at risk, before you switch to live.
Connecting Alpaca and moving from paper to live
The setup has five steps in the product. You connect Alpaca with your API keys, and both paper and live accounts are supported. You validate a strategy against Alpaca paper first, which uses the same rules, simulated money and live data. When paper behavior matches the backtest, you promote the strategy to the live account. Each deployed strategy runs in its own sleeve with independent cash. Guardrails check every order, and they include price bands, notional caps and a global pause.
The paper step is the reason to start on Alpaca. The notes in the data state that Alpaca's paper environment runs strategies through the same order path as live, with no capital at risk, before you switch. On Alpaca the same order flow can be rehearsed with simulated money, so a strategy that sends a rejected order or an unexpected size shows it on paper first.
Paper trading in DeployQuant also works without any brokerage account. The platform paper trades on the live market data feed, and that needs no broker. An Alpaca paper account adds the broker's side of the path: orders go to Alpaca and fills come back from Alpaca. The platform's books follow the broker's own fill reports, so what the sleeve records is what filled at Alpaca.
Several strategies can share one Alpaca account. Every deployed strategy runs in its own sleeve with its own cash, positions and P&L, and every order is tagged with the strategy that placed it. Each order is checked against that sleeve's own cash before it is sent, so one strategy cannot spend another's money. A strategy that sells everything only sells its own positions. Two strategies can hold the same symbol in the same account, and each one's share of the position is tracked separately. Cash that is not allocated to a sleeve is never traded, and positions you trade by hand stay yours. All sleeves share one broker connection and one login, and an order management system sends every order down that one connection.
The live-trading controls are specific. Real money only moves after you type an explicit confirmation on a live deployment. Price bands refuse limit orders priced too far from the market. There are per-order and per-position dollar caps, plus a cap on orders per sync, and the caps never block an order that reduces exposure. Dry-run mode runs the whole order flow without sending any order to the broker. One switch pauses a single strategy and another pauses every strategy on a broker connection. The connection has trade and read permissions only. It cannot withdraw or transfer money, and you can disconnect at any time.
Alpaca also matters outside live trading. The open-source engine, DQengine, backtests with free Alpaca API keys for market data, and a paper account is enough. The quick start sets two environment variables and runs `dqengine data fetch`. That is separate from deploying to Alpaca through the platform, and it means one Alpaca account can feed the backtests and receive the orders.
What the test leaves out: the backtests do not model Alpaca's own fills, so paper trading is the step that shows how orders behave there. A backtest fills on minute bars with no fees or slippage, and the cost runs on the individual pages add 5 and 10 basis points as a rough measure of how much trading frequency matters.
What the Alpaca connection supports
| Alpaca | |
|---|---|
| Order types | Limit, Market, Stop, Stop limit, Trailing stop |
| Time in force | At the close, Day, Fill or kill, Good till canceled, Immediate or cancel, At the open |
| Extended hours | Yes |
| Paper trading account | Yes |
| How you connect | API keys |
| Assets | US stocks and ETFs |
Order types and time in force on Alpaca
The Alpaca connection accepts five order types: limit, market, stop, stop limit and trailing stop. For time in force it accepts six: at the close, day, fill or kill, good till canceled, immediate or cancel, and at the open. Extended hours trading is supported. Assets are US stocks and ETFs.
Compared with the other two connections, Alpaca has the widest time-in-force list. Webull accepts limit, market, stop and stop limit orders with day and good-till-canceled time in force. Schwab accepts limit, limit on close, market, market on close, stop, stop limit and trailing stop orders with day, fill or kill and good-till-canceled time in force. Alpaca is the only one of the three that lists at the open, at the close and immediate or cancel. The Webull and Schwab pages have the same table for those brokers.
The templates use only a small part of this. Ten of the 12 can run live. Eight of them send market orders only: RSI(14) mean reversion, RSI(2) snapback, the golden cross, SMA 10/50, EMA 12/26, the 200-day filter, the 3-month momentum switch and the monthly cycle. Their rules are daily decisions made when the market opens: if the strategy is not invested and the signal is true, buy with 98% of the sleeve, and if it is invested and the signal reverses, sell the whole position.
Two templates add a limit order. The weekly 7% target buys at the first open of the week and then rests a limit order at the entry price times 1.07. The rules also say that at 2:00pm on the second-to-last session of the week, if the position is losing, the strategy sells everything. The dip buyer buys after a drawdown worse than 10% from the 20-day high and rests a limit order at the entry price times 1.08. In both, the limit is a real order at the broker. The template descriptions say DeployQuant maintains it as a managed order. A resting order that needs to stay in place across sessions is the case where Alpaca's good-till-canceled setting matters, and the connection lists it among the six.
The two trailing-stop templates are the exception to what the connection accepts. The table lists a trailing stop among the orders both send, and it marks both as backtest only for now. In the backtest, the stop follows the position's high-water mark: 10% below it for the momentum template and 15% below it for the SMA-200 template. The deployment of that exit to a live broker account is not built yet, whatever the broker accepts, and those two templates cannot run live at any of the three brokers until it is.
Market orders carry the cost risk. A strategy that sends a market order at the open takes whatever price the open gives. The cost runs on each backtest page add 5 and 10 basis points per fill to show the sensitivity. The templates that trade often are the exposed ones: RSI(2) snapback has the highest turnover in the library, and its ETF pages show the CAGR falling as the charge rises. The templates that trade a few times a year barely move.
Build it from blocks (or type it in English), backtest it on 5.7 years of minute data in seconds, tweak any parameter, then paper trade it on live data. No card, no broker needed to start.
The 12 strategy templates on Alpaca
| Strategy | Orders it sends | Runs live at Alpaca | Median CAGR, 59 ETFs | Strongest ETF |
|---|---|---|---|---|
| RSI(14) Mean Reversion | Market | Yes, all of them | 3.0% | TECL 23.9% |
| RSI(2) Dip Snapback | Market | Yes, all of them | 4.7% | TQQQ 39.3% |
| Golden Cross (SMA 50/200) | Market | Yes, all of them | 2.0% | SOXL 45.9% |
| SMA 10/50 Trend | Market | Yes, all of them | 2.1% | QLD 18.8% |
| EMA 12/26 Trend | Market | Yes, all of them | 2.8% | SOXL 26.2% |
| 200-Day SMA Regime Filter | Market | Yes, all of them | 1.8% | TQQQ 24.9% |
| Weekly Entry + 7% Target | Market, Limit | Yes, all of them | 6.6% | TECL 35.5% |
| Drawdown Dip Buyer + 8% Target | Market, Limit | Yes, all of them | 1.3% | SOXX 27.5% |
| 20-Day Momentum + Trailing Stop | Market, Trailing stop | Backtest only for now: trailing-stop exits are not deployable live yet | 0.0% | QLD 22.5% |
| SMA-200 Trend + 15% Trailing Stop | Market, Trailing stop | Backtest only for now: trailing-stop exits are not deployable live yet | 2.6% | TQQQ 25.0% |
| 3-Month Momentum Switch | Market | Yes, all of them | 0.0% | SOXL 16.4% |
| First-to-Last Day of Month | Market | Yes, all of them | 5.5% | TECL 36.0% |
The 12 templates and what each did on past data
The table above lists each template with its median CAGR across the 59 ETFs and its strongest ETF. The medians are low: most templates earned a few percent a year at the median fund over the window, and the strongest funds for each were leveraged or sector ETFs with large drawdowns.
Of the ten templates that run live at Alpaca, the weekly 7% target had the highest median at 6.61%, with 35.49% on TECL. The monthly cycle came next at 5.46% and its best result was 35.97% on TECL. RSI(2) snapback had a median of 4.74% and the highest single result among the three, 39.31% on TQQQ. The monthly cycle is a research template that holds about 95% of sessions, so its results usually track buy-and-hold minus the boundary days.
The trend templates sit lower. EMA 12/26 had a median of 2.76% and its best fund was SOXL at 26.20%. SMA 10/50 had 2.12%, with 18.76% on QLD. The golden cross had 2.05% and 45.93% on SOXL, the highest single figure in the table. The 200-day filter had 1.84% and 24.95% on TQQQ. RSI(14) mean reversion had 2.98%, with 23.89% on TECL. The dip buyer had the lowest median of the group that can run live at 1.33%, and 27.48% on SOXX. The 3-month momentum switch had a median of 0% and its best fund was SOXL at 16.43%.
A pattern shows up in the strongest-fund column. Almost every best result is a leveraged fund or a sector fund: TQQQ, TECL, SOXL, SOXX and QLD. Those funds have the highest volatility in the set, and the templates earned the most on them in absolute terms. The individual backtest pages show the drawdowns that came with them. The median result is the figure that describes what the template did on an ordinary fund, and the best result is the one that describes the most volatile one.
The two backtest-only templates have a median of 0% for the momentum breakout and 2.61% for the trend plus trailing stop. Their best funds were QLD at 22.49% for the momentum breakout and TQQQ at 25.03% for the trailing-stop template. These two are the ones to read as research for now, since they cannot be deployed live yet.
What a backtest cannot tell you about Alpaca is how a particular strategy fills on a particular day. The paper step is where that is measured. A strategy that trades at the open on a thin fund can see a different fill than the backtest assumed, and the guardrails, price bands in particular, exist to refuse orders that stray from the market. The backtest says what the rules would have done on historical bars. Paper trading says what the order path does with them.
The comparison pages in the library set two templates side by side across the same 59 ETFs, and the strategy pages give the rules in plain English. A template can be copied into a new strategy, changed, and backtested again before any account is involved. Paper trading and the Free plan need no broker. The Free plan covers 1 live strategy, and Pro at $10 a month covers up to 20 at a time.
Frequently asked questions
Can you automate trading on Alpaca?
Yes. Connect Alpaca to DeployQuant and strategies you build from blocks or plain English trade in your existing Alpaca account. The connection can trade and read, never withdraw, your assets stay at Alpaca, and live trading requires an explicit typed confirmation.
Does my money move to DeployQuant?
No. Cash and shares stay in your Alpaca account in your name. DeployQuant sends orders and reads fills. It cannot withdraw, and you can disconnect anytime.
Can you automate trading on Alpaca?
Yes. Connect Alpaca to DeployQuant with your API keys and strategies you build from blocks or plain English trade in your existing Alpaca account. The connection can trade and read, never withdraw, and live trading requires an explicit typed confirmation. Paper and live accounts are both supported.
Does Alpaca have paper trading in DeployQuant?
Yes. Alpaca's paper environment runs strategies through the same order path as live. Validate a strategy on paper first, then promote it to the live account when the behavior matches the backtest.
Which strategies can run live on Alpaca?
Ten of the 12 templates run live at Alpaca. The [momentum breakout](/learn/strategies/momentum-breakout-trail/) and [trend plus trailing stop](/learn/strategies/trend-trailing-stop/) templates are backtest only for now, because trailing-stop exits are not deployable live yet at any broker.
What order types does the Alpaca connection support?
Limit, market, stop, stop limit and trailing stop, with time in force of at the close, day, fill or kill, good till canceled, immediate or cancel, and at the open. Extended hours trading is supported. The templates that run live send market orders, and two of them also rest a limit order.
Does my money move to DeployQuant?
No. Cash and shares stay in your Alpaca account in your name. DeployQuant sends orders and reads fills. It cannot withdraw, and you can disconnect at any time.
Do the backtests include Alpaca's fees?
No. The headline backtests have no fees or slippage and fill on minute bars. The cost runs add 5 and 10 basis points per fill so you can see how sensitive each template is. A template that trades often, such as [RSI(2) snapback](/learn/strategies/rsi2-dip-snapback/), loses the most to that charge.
Can I use Alpaca for market data in the open-source engine?
Yes. DQengine backtests need only Python and free Alpaca API keys for market data, and a paper account is enough. The engine is separate from deploying a strategy through the platform.
Other brokers
Backtests are hypothetical, computed by DeployQuant's engine on minute-resolution consolidated US market data (2021-01-04 to 2026-10-02, $10,000 starting capital, no margin, no fees or slippage in the headline run; buy-and-hold puts 98% of the account in at the first open, as the templates do) and do not guarantee future results. Nothing on this page is investment advice. Live trading involves risk of loss.