Can you automate trading on Alpaca?
Yes. Alpaca is one of the three brokers DeployQuant connects to, and it is the only one of the three with a paper environment on the broker side. Alpaca logs you in with API keys, accepts equity orders through its API, and offers both a live and a paper account. A rule set that lives in DeployQuant can therefore send orders to an Alpaca account without you writing any API code.
Automating a strategy means three things. The rules have to be written down exactly. Something has to watch the market and apply the rules without you at the screen. Orders then have to reach the broker in a form the broker accepts. Alpaca covers the third part with its API. DeployQuant covers the first two: you write the rules in English, with blocks or in Python, and the platform runs them against the live market data feed and sends the orders through your Alpaca connection.
The facts on this page come from two places. The broker details come from DeployQuant's own broker roster. The market numbers come from ETF backtests that start on 2021-01-04 and end on 2026-10-02: 5.74 years, or 1,444 trading sessions. Each begins with $10,000 and uses no margin, and the headline run deducts nothing for fees or slippage. These results are hypothetical. They show the conditions an automated rule meets once it is running and promise nothing.
The topics are what Alpaca accepts, how a strategy gets from an idea to a live order, why the paper step matters, what safety checks sit between a rule and your money, and what the market data says about the kinds of rules people tend to automate. The brokerage API is the piece that makes all of it possible.
What a brokerage API does for automation
Without a brokerage API, a person has to click through the broker's website for each trade. With one, a program can place orders, read positions and stream account data at any hour. Alpaca was built around this interface, and the keys it issues are what DeployQuant uses to connect.
A person who scripts against the API directly takes on four jobs. The script must prove it may trade the account. It must follow each order from submission through acceptance to a full or partial fill, a cancel or a rejection. It must handle errors. It must also compare its own record of holdings with the broker's. Every one of these is a place where a hand-built script can go wrong.
DeployQuant keeps one adapter per broker behind its engine, so those jobs live in one place. Its books are built from the fill reports the broker sends, which means they follow what actually filled. A connection is limited to trading and reading. It has no way to withdraw or transfer money, and you can disconnect whenever you like. Cash and shares remain in your own account, in your name.
What Alpaca accepts compared with the other two brokers
The broker roster lists what each connection supports. Alpaca is the widest of the three on time in force and also supports every order type in the Webull list.
- Alpaca: five order types, namely market, limit, stop, stop_limit and trailing_stop. Time in force can be cls, day, fok, gtc, ioc or opg. Extended hours trading is supported, and a paper account exists.
- Webull: limit, market, stop and stop_limit orders. Time in force is day or gtc. Extended hours are supported. The roster notes live money only, because Webull's US OpenAPI has no working paper environment.
- Charles Schwab: seven order types, including the closing-auction pair limit_on_close and market_on_close that Alpaca's list does not carry. Time in force is day, fok or gtc. The login uses oauth in place of keys, and the roster notes live money only with no paper environment.
The time-in-force codes matter to an automated rule. Day orders expire at the close. Gtc orders rest until filled or cancelled, which is what a standing profit target needs. Opg and cls tie an order to the opening or closing auction. Fok and ioc are about how much of an order must fill straight away. A strategy that only decides once a day has little use for most of them, while a strategy that rests a limit order above the market all week depends on gtc.
The Webull comparison is a practical one for people choosing where to start. Webull and Schwab both route real money only, so a first test there is a live test. Alpaca is the broker where the full order flow can be rehearsed against the broker's own paper account first. The Alpaca broker guide lists the order types and time-in-force codes in a table, and the Webull guide and Schwab guide do the same for those brokers. A related answer covers automating on Webull.
From idea to a rule the platform can run
A DeployQuant strategy can be built three ways, and every strategy keeps two views of the same rules, Blocks and Code.
- In plain English. The AI builder turns a description such as buying TQQQ at the first open of the week, selling at +7%, and getting out Thursday at 2pm if it is losing, into rules you can read and edit.
- From visual blocks that read as sentences, such as one that buys when RSI(14) drops under 30.
- In Python, written in the industry-standard algorithm format that most quant libraries share.
When the AI converts one view into the other, it backtests both versions and compares their fills, which catches a conversion that would alter the trades. A successful AI build uses one token and a failed one uses none. Signup includes 5 tokens, Pro adds 20 each month, and token packs run 5 for $5, 20 for $16 and 100 for $60.
After the rules exist, the backtest runs on minute-resolution consolidated US equity data. A multi-year minute backtest finishes in seconds. The decision log records the prices and indicator readings behind each trade, so the reason for any fill can be read afterwards. That log is the first check on whether the thing you described is the thing you built.
Backtesting does not need a broker. Neither does paper trading on DeployQuant. A free account gets 1 live strategy and unlimited backtests. Pro costs $10 a month and allows up to 20 live strategies at a time. Alpaca only enters the picture when you want orders to reach an Alpaca account.
Why the paper step comes before live money
Paper trading runs a strategy against live market data with simulated money. The signals are real and the prices are real, and no capital is at risk. It sits between a good backtest and a live account, and it tests the whole decision loop of data, signals and orders.
On Alpaca this can be done two ways. DeployQuant has its own paper mode, which needs no brokerage account. Alpaca also runs a paper account with the same API as its live one, so a strategy can send orders to a simulated Alpaca account and exercise the real order path. DeployQuant's own product reference makes the contrast with Webull directly: Webull's API has no paper environment, so paper trading for a Webull-bound strategy has to happen on DeployQuant's paper mode instead.
The answer on paper trading versus live trading lists the two ways paper differs from live. Fills are simulated, so execution looks slightly better than it will be live, with no slippage and no partial fills. The second is that nothing about a loss hurts when the money is simulated. The data, the signals, the order logic and the timing should otherwise be identical, which is the reason the same engine should drive both. DeployQuant's backtests, paper runs and live runs use the same consolidated data feed for paper and live, and the same engine for all three.
A few weeks of paper trading checks that the strategy behaves the way the backtest said it would. Small live size then checks whether you can tolerate it. The two steps catch different failures, and neither replaces the other.
What sits between a rule and your money
Once a strategy is live, an order management system sends every order down one connection per account. Several rules apply before an order goes out.
- A live deployment sends real money only after you type a confirmation.
- A price band rejects any limit order set far from the current market.
- Dollar caps apply to each order and each position, and one more cap limits how many orders go out per sync. A cap never blocks an order that cuts exposure.
- A dry run walks through the whole order flow and sends nothing to the broker.
- A single switch pauses one strategy, and a second pauses all strategies on a broker connection.
Several strategies can share one Alpaca account because each runs in its own sleeve with its own cash, positions and profit and loss. Every order is tagged with the strategy that placed it and checked against that sleeve's own cash, so one strategy cannot spend another's money. Fills go back to the sleeve that placed the order. A strategy that sells everything sells only its own positions. Cash that is not allocated to a sleeve is never traded, and positions you trade by hand stay yours.
The dry run is the safest way to see an order flow for the first time. It produces the orders without sending them, so the sizes and the timing can be read before anything is exposed to the market. The paper account on Alpaca is the next step up, since orders there reach a real broker system with simulated cash.
How much order flow different rules create
Automation changes with the rule, because rules differ a great deal in how often they trade. The strategy hub data lists the median number of round trips across the 59 ETFs for each of 12 templates.
- Dip buyer: 2 round trips, median.
- Golden cross: 3.
- Trend with a trailing stop: 4.
- Momentum breakout: 6.
- 3-month momentum: 12.
- RSI mean reversion: 15.
- SMA 10/50 trend: 17.
- 200-day regime filter: 18.
- EMA 12/26 trend: 22.
- Monthly cycle: 69.
- Weekly 7% target: 106.
- RSI(2) snapback: 166.
Those counts were measured over 5.74 years. A rule with 3 round trips places only a few orders in that time. A rule with 166 round trips places many, and running it across several funds adds more. For the broker, more orders mean more chances for a rejection, a partial fill or a price that moved.
The order type also differs. The weekly 7% target rests a limit order at the profit level, and that needs a time in force that survives past the day, which is what gtc does on Alpaca. A trend rule that decides at the close has no need for it. DeployQuant's Webull note in its answer on that broker says profit targets rest at Webull as real gtc limit orders, so exits work while you are away. The same idea applies to any broker whose time-in-force list includes gtc, and Alpaca's list does.
The medians also show how thin the edge over buy and hold was. The RSI(2) snapback and the weekly 7% target had the most funds beating buy and hold, 34 of 59 each. The median CAGR was 4.74% for the first and 6.61% for the second. Monthly cycle beat buy and hold on 14 of 59 funds. Automation does not change those results. It makes the rule run without you, which includes the losing stretches.
What an automated rule meets in the market
An automated rule trades whatever the market gives it, at the minute it decides. Six funds measured over the same 5.74 years show how different that can be.
- SPY: total return 125.29%, CAGR 15.2%, annualized volatility 16.41%. The deepest drawdown was 24.51%, from the 2022-01-03 peak to the 2022-10-12 trough, with recovery on 2023-12-13.
- QQQ: total return 151.07%, volatility 22.39%, deepest drawdown 35% from 2021-11-19 to 2022-11-03.
- TLT: total return -40.49%. The fund never recovered its 2021-01-04 peak in the window.
- TQQQ: total return 291.92%, volatility 67.11%, deepest drawdown 81.68%.
- IWM: total return 55.8%, volatility 22.35%.
- UVXY: total return -99.94%, volatility 103.95%.
An order that goes wrong on SPY costs little because SPY is so liquid. Its median minute volume was 107,870 shares. QQQ's median minute volume was 77,976. TLT's was 35,636. UVXY's was 1,145, and its average intraday range was 7.03%. A market order for a given size is a bigger event in a fund with 1,145 shares trading in a typical minute than in one with 107,870. That is a reason the price band check exists on the live side, and a reason the 5 and 10 basis point cost runs on each backtest page are worth reading before a strategy goes live.
Daily rules also face the overnight gap. On SPY the overnight share of the return was 62.46%, and on QQQ it was 64.64%. A rule that only trades during the session does not earn the overnight part when it is flat at the close. That is a property of the rule, and it shows up in the backtest regardless of the broker.
The funds also differ in how the automated rule's own signals behave. The RSI(14) fell below 30 on 18 sessions on SPY, and the median 5-day forward return after those sessions was 3.74%, against a baseline median of 0.42%. On TLT it fell below 30 on 61 sessions, and the median 5-day forward return after them was 0.02%. On UVXY it fell below 30 on 116 sessions, and the median 20-day forward return was -5.82%. The same rule produced very different behavior on three funds. Backtesting on the specific fund is the way to see which one you have.
Where the evidence stops
All of the figures here are hypothetical. They cover one window of 5.74 years, which included the 2022 drawdown and several recoveries, and another window would give other numbers. The headline runs deduct no fees or slippage. Buy and hold in them puts 98% of the account in at the first open, the same as the templates.
The method also has limits that matter for live trading. Rules were evaluated as daily decisions, and orders were filled on minute bars. A fill in a paper account is simulated and tends to look better than a live one. DeployQuant reports the live and paper results from the same engine as the backtest, but the market is not obliged to give the same price twice.
Alpaca specifics matter too. The roster shows which order types and time-in-force codes the connection supports, not how Alpaca fills an order in a fast market. Fill quality is something to observe in paper and then in small live size. No verdict on any strategy is given here, and no position is suggested. Nothing here is investment advice, and live trading can lose money, including the money you put in.
The sensible reading of all this is modest. Alpaca can be automated, the connection works with keys, the paper account allows the order flow to be rehearsed, and the platform's checks sit between the rules and the account. What the rules then do with the market is a separate question, and the backtest pages answer it one fund at a time.
A first run from backtest to Alpaca
The order of steps follows from the above.
1. Sign up on DeployQuant. No card and no broker are needed. 2. Describe a strategy to the AI builder, snap blocks together, or paste Python. 3. Backtest it, read the decision log and adjust parameters. 4. Paper trade it on the live feed, with or without an Alpaca paper account. 5. Connect Alpaca with API keys, allocate cash to a sleeve, and type the confirmation for the live deployment.
The first four steps cost nothing in capital. The fifth is where real money is involved, and the dry-run mode, the caps and the price bands are there for that moment. The homepage shows the total equity of all connected live brokerage accounts, paper accounts excluded, so a paper account on Alpaca does not count toward that figure.
Frequently asked questions
Can you automate trading on Alpaca?
Yes. Alpaca exposes an API with keys-based login, and DeployQuant connects to it for live trading and for paper trading. You describe the rules in English, with blocks or in Python, and the platform places the orders in your Alpaca account.
Does Alpaca have a paper trading account?
Yes. The broker roster lists paper as supported for Alpaca and not for Webull or Charles Schwab. The paper account uses the same API as the live one with simulated money. DeployQuant also has its own paper mode that needs no brokerage account.
Which order types can an automated strategy use on Alpaca?
Alpaca's entry lists market, limit, stop, stop_limit and trailing_stop. The time-in-force codes are cls, day, fok, gtc, ioc and opg, and extended hours trading is available. The rules you write decide which of these a strategy uses.
Do I need to write code to automate on Alpaca?
No. Strategies can be written in plain English or built from blocks that read as sentences. Python is available for people who want it, and every strategy has a Blocks view and a Code view of the same rules.
Can an automated strategy withdraw money from my Alpaca account?
No. A connection can place trades and read the account, nothing more. It has no way to withdraw or transfer money, your holdings stay in your own account, and you can disconnect at any time.
What safety checks apply before an order reaches Alpaca?
Live trading needs a typed confirmation first. After that, price bands reject limit orders set too far from the market, dollar caps limit each order and position, and a dry run can rehearse the flow with nothing sent. You can pause one strategy or every strategy on the connection.
Does automating a strategy make it more profitable?
No. Automation applies the rules without you at the screen, and that includes losing stretches. The backtests here are hypothetical, deduct nothing for fees or slippage in the headline run, and cover only 2021-01-04 to 2026-10-02. The results depend on the rules and the fund, and no result is promised.
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.
Terms used here
Related questions
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.