Skip to content

Commit 4856169

Browse files
committed
Handle response from position closing endpoints
1 parent f4c59eb commit 4856169

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

alpaca_trade_api/rest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,13 @@ def get_position(self, symbol):
294294

295295
def close_position(self, symbol):
296296
'''Liquidates the position for the given symbol at market price'''
297-
self.delete('/positions/{}'.format(symbol))
297+
resp = self.delete('/positions/{}'.format(symbol))
298+
return Order(resp)
298299

299300
def close_all_positions(self):
300301
'''Liquidates all open positions at market price'''
301-
self.delete('/positions')
302+
resp = self.delete('/positions')
303+
return [Order(o) for o in resp]
302304

303305
def list_assets(self, status=None, asset_class=None):
304306
'''Get a list of assets'''

0 commit comments

Comments
 (0)