From e938dbd9b2132273dfad38ee37e7e6237fbafdc8 Mon Sep 17 00:00:00 2001 From: Qingda Wen Date: Mon, 18 Dec 2023 21:49:18 -0800 Subject: [PATCH] #573 close_all_positions should take optional cancel_orders argument --- alpaca_trade_api/rest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alpaca_trade_api/rest.py b/alpaca_trade_api/rest.py index db010328..60a39c17 100644 --- a/alpaca_trade_api/rest.py +++ b/alpaca_trade_api/rest.py @@ -524,9 +524,9 @@ def close_position(self, symbol: str, *, resp = self.delete('/positions/{}'.format(symbol), data=data) return self.response_wrapper(resp, Position) - def close_all_positions(self) -> Positions: + def close_all_positions(self, cancel_orders: bool=False) -> Positions: """Liquidates all open positions at market price""" - resp = self.delete('/positions') + resp = self.delete('/positions', data={'cancel_orders': cancel_orders}) if self._use_raw_data: return resp else: