Alpaca

Cancel All Orders & Position Liquidations Through API

New Features

Cancel All Orders through API

Previously, Alpaca users could cancel all open orders through the Alpaca web dashboard. Now, users can cancel all open orders through an API call, too!

When the following endpoint is called, all open orders will be canceled. Each cancel request works the same way as the single order cancel API.

DELETE /v2/orders

In addition, the following JSON failure and success responses are provided (and are for illustrative purposes only):

[
  {
    "id": "edf0239d-77c1-418f-bb58-5f0e95288505",
     "status": 500,
     "body":  {
       "code":  50010000,
       "message": "failed to cancel order: error submitting cancel order request",
       "order": {
         "asset_class": "us_equity",
         "asset_id": "fbaa7510-3ea0-4f8e-83b5-d6f527129f48",
         "canceled_at": null,
         "client_order_id":  "f888f584-13fb-4991-8749-0433d48b0a54",
         "created_at": "2019-07-19T22:47:08.002688Z",
         "expired_at":  null,
         "failed_at": null,
         "filled_at": null,
         "filled_avg_price": null,
         "filled_qty": "0",
         "id":  "edf0239d-77c1-418f-bb58-5f0e95288505",
         "limit_price": "201",
         "order_type": "limit",
         "qty": "7",
         "side": "buy",
         "status": "accepted",
         "stop_price": null,
         "submitted_at": "2018-11-15T14:30:28.763971Z",
         "symbol": "AAPL",
         "time_in_force": "gtc",
         "type": "limit",
         "updated_at": "2019-07-24T22:51:28.064664Z"
      }
    }
  },
  {
     "id": "b2967af1-d2ed-43e9-ba2f-9923cb9251af",
     "status": 200,
     "body": {
       "asset_class": "us_equity",
       "asset_id": "fbaa7510-3ea0-4f8e-83b5-d6f527129f48",
       "canceled_at": null,
       "client_order_id": "8564cd3a-acea-4c64-bba8-c22d72747e86",
       "created_at": "2019-07-23T08:01:34.639534Z",
       "expired_at": null,
       "failed_at": null,
       "filled_at": null,
       "filled_avg_price": null,
       "filled_qty": "0",
      "id": "b2967af1-d2ed-43e9-ba2f-9923cb9251af",
       "limit_price": "195",
       "order_type": "limit",
       "qty": "3",
       "side": "buy",
       "status": "new",
       "stop_price": null,
       "submitted_at": "2018-11-15T14:31:20.018938Z",
       "symbol": "AAPL",
       "time_in_force": "gtc",
       "type": "limit",
       "updated_at": "2019-07-24T22:53:36.234571Z"
    }
 }
]

Liquidate Positions through API

You can now liquidate your positions through API (previously only accessible through web dashboard). When the following endpoint is called, orders will be submitted to liquidate all positions for that symbol. This action works for both long and short positions.

 DELETE /v2/positions/

You can also liquidate all open positions within your account by omitting the symbol path element.

Both the Cancel All Open Orders API and the Liquidate Positions API return HTTP 207 Multi-Status. The response body is an JSON array with each element having different sub-status for each operation.


Other News

Web Forum

We’ve launched our forum! Here you can visit and contribute to the conversations about algo-trading, general trading, or about the Alpaca platform.

Alpaca Forums
Hack Financial Systems, Commission Free API Trading

Our Slack server has over 2,500 users, and we will continue to maintain and respond through Slack. However, we did see a gap in searchability and indexing with Slack, which led us to consider a forum as a medium of open discussion. The forum will allow our users to search through old topics much more easily and find questions that have been asked before by fellow forum members. We hope you find it useful!

Infrastructure Updates

We believe that service reliability and availability is one of the most important aspects of a trading service.

To help minimize the risk of execution failures and decrease the latency of trades, we have upgraded the connectivity between Alpaca cloud servers and the physical market exchange servers in New Jersey. This change should reduce the network latency for trade communication and reliability by two orders of magnitude (10–100x).


Coming Soon

We’re constantly working on new features to make the experience on our platform better. Here are several improvements that we will be releasing very soon!

Margin Call Protections
In an effort to protect users from receiving day trade buying power (DTBP) margin calls, we are enabling two types of margin call protections. All users will be defaulted to DTBP margin call protections on entry, meaning that you will be prevented from entering positions that may cause a DTBP margin call. There will be an option to switch on protections on exit, in which case you will be prevented from exiting positions that may cause a DTBP margin call.

We will be enabling these protections beginning Monday 8/5/2019. Please contact our support should you need to modify your DTBP margin call protection setting.


Technology and services are offered by AlpacaDB, Inc. Brokerage services are provided by Alpaca Securities LLC, member FINRA/SIPC. Alpaca Securities LLC is a wholly-owned subsidiary of AlpacaDB, Inc.

You can find us @AlpacaHQ, if you use twitter.