Skip to content

Add Bracket Order Support

Choose a tag to compare

@ttt733 ttt733 released this 06 Feb 06:57
· 218 commits to master since this release
f7b09d9

This release adds support for bracket orders. You can submit a bracket order like so:

{
  "side": "buy",
  "symbol": "SPY",
  "type": "market",
  "qty": "100",
  "time_in_force": "gtc",
  "class": "bracket",
  "take_profit": {
    "limit_price": "301"
  },
  "stop_loss": {
    "stop_price": "299",
    "limit_price": "298.5"
  }
}

Please note the inclusion of the new nested parameter in the order list call. Specifying nested=true will make it so that bracket orders have legs fields which will contain their child orders. Child orders will be in this nested field rather than the main array of orders. For more information about using bracket orders at Alpaca, please refer to https://docs.alpaca.markets.