
As part of its Elite Smart Router, we’ve released a new feature called Direct Market Access Gateway* (DMA Gateway) that gives you direct control of where your orders are sent. This, along with advanced order types like Volume-Weighted Average Price (VWAP) and Time-Weighted Average Price (TWAP), enables you to efficiently manage large orders, control execution costs, help minimize market impact, and meet your specific trading objectives.
To get the most out of this guide, explore the following resources first:
What is Direct Market Access Gateway?
DMA Gateway is a tool that gives you customization over where your trades are sent. It allows traders to send orders directly to exchanges or market venues without the broker rerouting them through intermediaries like market makers. This is especially important for advanced algorithmic traders because it lets you send your orders to a specific exchange, giving you more customization over how your trades are handled.
How to Use DMA Gateway with Alpaca’s Trading API
DMA Gateway is only available with Alpaca Elite users** who are on the Elite Smart Router. We’ve made integrating DMA Gateway into your trading very easy. You can simply include the advanced_instructions
parameter in your regular order request. This allows you to specify the destination of your orders.
# Create the market order request
req = MarketOrderRequest(
symbol = "SPY",
qty = 100,
side = OrderSide.BUY,
type = OrderType.LIMIT,
order_class = OrderClass.SIMPLE,
time_in_force = TimeInForce.DAY,
advanced_instructions = {
"algorithm": "DMA",
"destination": "NYSE",
"display_qty": "100",
}
)
# Submit the market order request
res = trade_client.submit_order(req)
res
Parameters for DMA Gateway instructions:
Notes:
- You can also find more detailed walkthroughs in the API Doc.
advanced_instructions
will be accepted for paper trading; however, the DMA order will not be simulated in the paper environment.- In live trading, if you are not on the Elite Smart Router, you will likely receive a rejection message like:
{
"code": 40310000,
"message": "account not allowed to use advanced_instructions"
}
Risk of DMA Gateway Order
When using DMA Gateway to route orders to a specific exchange, you may not receive the best available execution price or the most favorable fill. Market conditions, available liquidity, and the exchange’s order book at the time of your trade can all affect execution quality.
In some cases, prices on other venues may be more advantageous, or additional liquidity may be available elsewhere. By choosing a specific destination, you assume the risk that your order could execute at a less favorable price, receive only a partial fill, or remain unfilled.
Conclusion
DMA Gateway can be a comprehensive tool that gives advanced traders control over how their orders are executed. It can help provide an advantage in terms of speed, price, and market impact, especially for large or algorithmic orders. Our Trading API can help make it easy to integrate this powerful feature into your own trading strategies. To get started, explore these resources:
- Sign up for an Alpaca Trading API account
- How to Connect to Alpaca's Trading API
- Alpaca Elite API Documentation
If you want to know more about how to code alpaca-py, check out the following resources:
*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 Alpaca Elite Smart Router users. For more information on Alpaca Elite please see the term and conditions.
Please note that we are using SPY as an example, and it should not be considered investment advice.
Past hypothetical backtest results do not guarantee future returns, and actual results may vary from the analysis.
Options trading is not suitable for all investors due to its inherent high risk, which can potentially result in significant losses. Please read Characteristics and Risks of Standardized Options before investing in options.
The Paper Trading API is offered by AlpacaDB, Inc. and does not require real money or permit a user to transact in real securities in the market. Providing use of the Paper Trading API is not an offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, given or in any manner endorsed by AlpacaDB, Inc. or any AlpacaDB, Inc. affiliate and the information made available through the Paper Trading API is not an offer or solicitation of any kind in any jurisdiction where AlpacaDB, Inc. or any AlpacaDB, Inc. affiliate (collectively, “Alpaca”) is not authorized to do business.
Please note that this article is for general informational purposes only and is believed to be accurate as of the posting date but may be subject to change. The examples above are for illustrative purposes only.
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.