Skip to content

Commit 8b5734b

Browse files
committed
Add position liquidation endpoints
1 parent 290ee80 commit 8b5734b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

alpaca_trade_api/rest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,14 @@ def get_position(self, symbol):
234234
resp = self.get('/positions/{}'.format(symbol))
235235
return Position(resp)
236236

237+
def close_position(self, symbol):
238+
'''Liquidates the position for the given symbol at market price'''
239+
self.delete('/positions/{}'.format(symbol))
240+
241+
def close_all_positions(self, symbol):
242+
'''Liquidates all open positions at market price'''
243+
self.delete('/positions')
244+
237245
def list_assets(self, status=None, asset_class=None):
238246
'''Get a list of assets'''
239247
params = {

0 commit comments

Comments
 (0)