Skip to content

Add support for DMA, TWAP, VWAP orders and advanced instructions - #359

Open
u4653551107 wants to merge 4 commits into
alpacahq:masterfrom
u4653551107:master
Open

Add support for DMA, TWAP, VWAP orders and advanced instructions#359
u4653551107 wants to merge 4 commits into
alpacahq:masterfrom
u4653551107:master

Conversation

@u4653551107

Copy link
Copy Markdown

This commit adds support for Alpaca's Elite Smart Router advanced order instructions, enabling:

  • DMA (Direct Market Access) orders with exchange destination routing
  • TWAP (Time-Weighted Average Price) algorithmic execution
  • VWAP (Volume-Weighted Average Price) algorithmic execution
  • Iceberg/reserve orders via display_qty parameter
  • Time-bounded execution via start_time/end_time parameters
  • Volume participation limits via max_percentage parameter

New types added:

  • Algorithm: DMA, TWAP, VWAP enum
  • Destination: NYSE, NASDAQ, ARCA enum
  • AdvancedInstructions: struct with all advanced routing fields

Updated:

  • Order struct: added AdvancedInstructions field
  • PlaceOrderRequest: added AdvancedInstructions field
  • README: added documentation and examples
  • Tests: added comprehensive test coverage

Ref: https://docs.alpaca.markets/docs/alpaca-elite-smart-router

#2)

This commit adds support for Alpaca's Elite Smart Router advanced order
instructions, enabling:

- DMA (Direct Market Access) orders with exchange destination routing
- TWAP (Time-Weighted Average Price) algorithmic execution
- VWAP (Volume-Weighted Average Price) algorithmic execution
- Iceberg/reserve orders via display_qty parameter
- Time-bounded execution via start_time/end_time parameters
- Volume participation limits via max_percentage parameter

New types added:
- Algorithm: DMA, TWAP, VWAP enum
- Destination: NYSE, NASDAQ, ARCA enum
- AdvancedInstructions: struct with all advanced routing fields

Updated:
- Order struct: added AdvancedInstructions field
- PlaceOrderRequest: added AdvancedInstructions field
- README: added documentation and examples
- Tests: added comprehensive test coverage

Ref: https://docs.alpaca.markets/docs/alpaca-elite-smart-router
- Add //easyjson:json annotation to AdvancedInstructions struct to enable proper JSON unmarshaling
- Regenerate entities_easyjson.go with AdvancedInstructions support
- Shorten comment in rest.go to fix line length lint error (was 137, max 120)
@gnvk gnvk linked an issue Jan 28, 2026 that may be closed by this pull request
Comment thread README.md
The SDK supports Alpaca's Elite Smart Router with advanced order instructions for
Direct Market Access (DMA), Time-Weighted Average Price (TWAP), and Volume-Weighted
Average Price (VWAP) order execution strategies.

@gnvk gnvk Jan 28, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would include here that

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.

from https://docs.alpaca.markets/docs/alpaca-elite-smart-router

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I've actually included this note right above the code block (lines 79-81):

Note: These features are only available to users who have enabled the Elite Smart Router. For more information on Alpaca Elite, see the terms and conditions and the Elite Smart Router documentation.

Let me know if you'd like me to adjust the wording or make it more prominent!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 9f14f08: 9f14f08

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[very minor] I'd prefer the github flavor: [!NOTE]

@gnvk gnvk changed the title feat: Add support for DMA, TWAP, VWAP orders and advanced instructions Add support for DMA, TWAP, VWAP orders and advanced instructions Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to place DMA order?

2 participants