Skip to content

Commit 290ee80

Browse files
authored
Merge pull request #98 from alpacahq/feature/cancel-all-orders
Add method for canceling all open orders
2 parents 7918a13 + cfceca2 commit 290ee80

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ Calls `GET /orders/{order_id}` and returns an `Order` entity.
120120
### REST.cancel_order(order_id)
121121
Calls `DELETE /orders/{order_id}`.
122122

123+
### REST.cancel_all_orders()
124+
Calls `DELETE /orders`.
125+
123126
### REST.list_positions()
124127
Calls `GET /positions` and returns a list of `Position` entities.
125128

alpaca_trade_api/rest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ def cancel_order(self, order_id):
220220
'''Cancel an order'''
221221
self.delete('/orders/{}'.format(order_id))
222222

223+
def cancel_all_orders(self):
224+
'''Cancel all open orders'''
225+
self.delete('/orders')
226+
223227
def list_positions(self):
224228
'''Get a list of open positions'''
225229
resp = self.get('/positions')

0 commit comments

Comments
 (0)