Skip to content

Commit e203f38

Browse files
authored
Merge pull request #452 from alpacahq/extend-list-orders-2
Extend list_orders functionality with symbols filtering
2 parents 5be8f76 + eb03217 commit e203f38

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ for trade in trades_iter:
176176
### Live Stream Data
177177
There are 2 streams available as described [here](https://alpaca.markets/docs/api-documentation/api-v2/market-data/alpaca-data-api-v2/real-time/).<br>
178178
The free plan is using the `iex` stream, while the paid subscription is using the `sip` stream.<br>
179-
You could subscribe to bars, trades or quotes and account updates as well.<br>
179+
You could subscribe to bars, trades or quotes and trade updates as well.<br>
180180
Under the example folder you could find different code [samples](https://github.com/alpacahq/alpaca-trade-api-python/tree/master/examples/websockets) to achieve different goals. Let's see the basic example<br>
181181
We present a new Streamer class under `alpaca_trade_api.stream` for API V2.
182182
```py

alpaca_trade_api/rest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ def list_orders(self,
234234
until: str = None,
235235
direction: str = None,
236236
params=None,
237-
nested: bool = None) -> Orders:
237+
nested: bool = None,
238+
symbols: List[str] = None
239+
) -> Orders:
238240
"""
239241
Get a list of orders
240242
https://docs.alpaca.markets/web-api/orders/#get-a-list-of-orders
@@ -245,6 +247,8 @@ def list_orders(self,
245247
:param until: timestamp
246248
:param direction: asc or desc.
247249
:param params: refer to documentation
250+
:param nested: should the data be nested like json
251+
:param symbols: list of str (symbols)
248252
"""
249253
if params is None:
250254
params = dict()
@@ -260,6 +264,8 @@ def list_orders(self,
260264
params['status'] = status
261265
if nested is not None:
262266
params['nested'] = nested
267+
if symbols is not None:
268+
params['symbols'] = ",".join(symbols)
263269
url = '/orders'
264270
resp = self.get(url, params)
265271
if self._use_raw_data:

0 commit comments

Comments
 (0)