Skip to content

Commit

Permalink
Handle response from position closing endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
ttt733 committed Feb 6, 2020
1 parent f4c59eb commit 4856169
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions alpaca_trade_api/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,13 @@ def get_position(self, symbol):

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

def close_all_positions(self):
'''Liquidates all open positions at market price'''
self.delete('/positions')
resp = self.delete('/positions')
return [Order(o) for o in resp]

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

0 comments on commit 4856169

Please sign in to comment.