DMA Gateway / Advanced Order Types
Take Control of Your Trades with Direct Market Access Gateway and Advanced Order Types
Elite Smart Router
Elite Smart Router is designed to meet the sophisticated needs of institutional clients and experienced algorithmic traders. A wide array of advanced investing and trading strategies are supported with higher API limits and cost-effective pricing.
One year after launching Alpaca Elite, we are expanding the feature set of the Elite Smart Router. The two key additions are Direct Market Access (DMA) Gateway* and Advanced Order Types. DMA Gateway gives users the ability to control and specify the execution venue for their orders. As part of the advanced order suite, we are introducing two additional order types: VWAP and TWAP. DMA Gateway, VWAP, and TWAP can only be accessed if users are on the Elite Smart Router as part of the Alpaca Elite Program.
*Direct Market Access Gateway is provided solely by DASH Financial Technologies ("DASH"), a member of the listed exchanges. Alpaca enables customers to route orders to the selected exchange through DASH’s DMA capabilities.
DMA Gateway
DMA orders provide control and flexibility by allowing you to send orders directly to specific exchanges.
Benefits:
- Route orders directly to your preferred exchange
- Minimize market impact through precise execution control
- Customize order display quantities for optimal market presence
- Efficiently manage large orders
Implementation
DMA orders are configured using advanced_instructions
in your order request payload:
curl --request POST \
--url $APIDOMAIN/v2/orders \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header "Apca-Api-Key-Id: $APIKEY" \
--header "Apca-Api-Secret-Key: $SECRET" \
--data '
{
"side": "buy",
"symbol": "AAPL",
"type": "limit",
"qty": "100",
"time_in_force": "day",
"limit_price": "212",
"order_class": "simple",
"advanced_instructions": {
"algorithm": "DMA",
"destination": "NYSE",
"display_qty": "100"
}
}' | jq -r
curl --request DELETE \
--url $APIDOMAIN/v2/orders/<your_order_id> \
--header 'accept: application/json' \
--header "Apca-Api-Key-Id: $APIKEY" \
--header "Apca-Api-Secret-Key: $SECRET" \
Parameters
Parameter | Required | Description | Values |
---|---|---|---|
algorithm | mandatory | Must be set to "DMA" for Direct Market Access routing | "DMA" |
destination | mandatory | Target exchange for order execution | "NYSE" , "NASDAQ" , "ARCA" |
display_qty | optional | Maximum shares/contracts displayed on the exchange at any time | Must be in round lot increments (100s) |
Notes:
- Parameter replacement is not supported for DMA orders
Available Destinations
- NYSE - New York Stock Exchange
- NASDAQ - NASDAQ Stock Market
- ARCA - NYSE Arca
We’re starting with the three destinations listed above, with plans to expand to 10+ additional destinations—including BATS, IEX, AMEX, and more—in the coming months.
Extended Hours Trading
DMA orders support extended hours trading for the following destinations:
- NASDAQ - Pre-market and after-hours sessions
- ARCA - Pre-market and after-hours sessions
VWAP: Volume-Weighted Average Price Orders
VWAP is an order type that seeks to execute a trade at or near the volume-weighted average price of a security over a specific period of time. It is calculated by taking the total dollar amount traded for a security (price * volume) and dividing it by the total volume traded for the security. It is best for large institutional traders or asset managers who want to minimize market impact by spreading their trades throughout the day, matching the average price weighted by volume.
Benefits:
- Minimizes market impact: By following the market's natural volume, VWAP helps prevent large trades from pushing the price against the trader's interest.
- Benchmarking: VWAP serves as a benchmark for traders to ensure that fills are in line with the volume-weighted average.
- Reduces slippage: The algorithm helps avoid large price moves that could result from executing a large block of shares all at once.
Implementation
VWAP orders are configured using advanced_instructions
in your order request payload:
curl --request POST \
--url $APIDOMAIN/v2/orders \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header "Apca-Api-Key-Id: $APIKEY" \
--header "Apca-Api-Secret-Key: $SECRET" \
--data '
{
"side": "buy",
"symbol": "AAPL",
"type": "limit",
"qty": "100",
"time_in_force": "day",
"limit_price": "212",
"order_class": "simple",
"advanced_instructions": {
"algorithm": "VWAP",
"start_time": "2025-07-21T09:30:00-04:00",
"end_time": "2025-07-21T15:30:00-04:00",
"max_percentage": "0.123"
}
}' | jq -r
curl --request PATCH \
--url $APIDOMAIN/v2/orders/<your_order_id> \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header "Apca-Api-Key-Id: $APIKEY" \
--header "Apca-Api-Secret-Key: $SECRET" \
--data '
{
"qty": "200",
"advanced_instructions": {
"algorithm": "VWAP",
"start_time": "2025-07-21T09:40:00-04:00",
"end_time": "2025-07-21T15:20:00-04:00",
"max_percentage": "0.321"
}
}' | jq -r
curl --request DELETE \
--url $APIDOMAIN/v2/orders/<your_order_id> \
--header 'accept: application/json' \
--header "Apca-Api-Key-Id: $APIKEY" \
--header "Apca-Api-Secret-Key: $SECRET" \
Notes:
- If
advanced_instructions
is not included in the replace payload then it will remain the same - If
advanced_instructions
is included in the replace payload then it will replace the original one. So if the client wants to update only theend_time
and keep the rest parameters as is, then the wholeadvanced_instructions
payload needs to be sent in the replace request, including the unchanged parameters.
Parameters
Parameter | Required | Description | Values |
---|---|---|---|
algorithm | mandatory | Must be set to "VWAP" for Volume-Weighted Average Price Orders | "VWAP" |
start_time | optional | When the algorithm is to start executing | RFC3339 Timestamp, must be within current market trading hours. Defaults to start immediately or at start of the regular market hours (whichever is later). VWAP orders do NOT participate in Open Auction. |
end_time | optional | When the algorithm is to be done executing | RFC3339 Timestamp, must be within current market trading hours and after start_time . Defaults to end of regular market hours. VWAP orders do NOT participate in Close Auction. |
max_percentage | optional | Maximum percentage of the ticker's period volume this order might participate in | Decimal number, must be 0 < max_percentage < 1, with up to 3 decimal points precision. |
TWAP: Time-Weighted Average Price Orders
TWAP is an order type designed to execute an order evenly over a specified time period. The goal is to spread out the trades in a way that minimizes price impact over the execution horizon. Unlike VWAP, which is volume-based, TWAP treats time as the primary factor, dividing the order into equal chunks to be executed at regular intervals.
Benefits:
- Reduces market impact: By spreading the order evenly across time, it minimizes the risk of significant price changes caused by large trades.
- Predictable execution: Unlike VWAP, which may execute orders more aggressively when volume is high, TWAP ensures more consistent and predictable execution over the time period.
- Useful in low liquidity environments: When volume patterns are unpredictable, TWAP helps prevent trading in a way that would disrupt the market.
Implementation
TWAP orders are configured using advanced_instructions
in your order request payload:
curl --request POST \
--url $APIDOMAIN/v2/orders \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header "Apca-Api-Key-Id: $APIKEY" \
--header "Apca-Api-Secret-Key: $SECRET" \
--data '
{
"side": "buy",
"symbol": "AAPL",
"type": "limit",
"qty": "100",
"time_in_force": "day",
"limit_price": "212",
"order_class": "simple",
"advanced_instructions": {
"algorithm": "TWAP",
"start_time": "2025-07-21T09:30:00-04:00",
"end_time": "2025-07-21T15:30:00-04:00",
"max_percentage": "0.123"
}
}' | jq -r
curl --request PATCH \
--url $APIDOMAIN/v2/orders/<your_order_id> \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header "Apca-Api-Key-Id: $APIKEY" \
--header "Apca-Api-Secret-Key: $SECRET" \
--data '
{
"qty": "200",
"advanced_instructions": {
"algorithm": "TWAP",
"start_time": "2025-07-21T09:40:00-04:00",
"end_time": "2025-07-21T15:20:00-04:00",
"max_percentage": "0.321"
}
}' | jq -r
curl --request DELETE \
--url $APIDOMAIN/v2/orders/<your_order_id> \
--header 'accept: application/json' \
--header "Apca-Api-Key-Id: $APIKEY" \
--header "Apca-Api-Secret-Key: $SECRET" \
Notes:
- If
advanced_instructions
is not included in the replace payload then it will remain the same - If
advanced_instructions
is included in the replace payload then it will replace the original one. So if the client wants to update only theend_time
and keep the rest parameters as is, then the wholeadvanced_instructions
payload needs to be sent in the replace request, including the unchanged parameters.
Parameters
Parameter | Required | Description | Values |
---|---|---|---|
algorithm | mandatory | Must be set to "TWAP" for Time-Weighted Average Price Orders | "TWAP" |
start_time | optional | When the algorithm is to start executing | RFC3339 Timestamp, must be within current market trading hours. Defaults to start immediately or at start of the regular market hours (whichever is later). TWAP orders do NOT participate in Open Auction. |
end_time | optional | When the algorithm is to be done executing | RFC3339 Timestamp, must be within current market trading hours and after start_time . Defaults to end of regular market hours. TWAP orders do NOT participate in Close Auction. |
max_percentage | optional | Maximum percentage of the ticker's period volume this order might participate in | Decimal number, must be 0 < max_percentage < 1, with up to 3 decimal points precision. |
Key Considerations:
advanced_instructions
will be accepted for paper trading; however, the order will not be simulated in the paper environment.- DMA gateway only supports market and limit orders and Time in Force (TIF) = day. If you wish to use MOO/MOC, gtc, or stop orders, you cannot specify advanced_instructions
Direct Market Access Gateway is provided solely by DASH Financial Technologies ("DASH"), a member of the listed exchanges. Alpaca enables customers to route orders to the selected exchange through DASH’s DMA capabilities..
Please note that this is currently only available to users who are on the Elite Smart Router. For more information on Alpaca Elite please see the term and conditions.
All investments involve risk, and the past performance of a security, or financial product does not guarantee future results or returns. There is no guarantee that any investment strategy will achieve its objectives. Please note that diversification does not ensure a profit, or protect against loss. There is always the potential of losing money when you invest in securities, or other financial products. Investors should consider their investment objectives and risks carefully before investing.
Securities brokerage services are provided by Alpaca Securities LLC ("Alpaca Securities"), member FINRA/SIPC, a wholly-owned subsidiary of AlpacaDB, Inc. Technology and services are offered by AlpacaDB, Inc.
This is not an offer, solicitation of an offer, or advice to buy or sell securities or open a brokerage account in any jurisdiction where Alpaca Securities are not registered or licensed, as applicable.
Updated about 5 hours ago