Retrieve all of the current open orders. Parameters ---------- asset : Asset If passed and not None, return only the open orders for the given asset instead of all open orders. Returns ------- open_orders : dict[list[Order]] o
(self, asset=None)
| 1916 | 'get_open_orders. Use `asset` instead.') |
| 1917 | @api_method |
| 1918 | def get_open_orders(self, asset=None): |
| 1919 | """Retrieve all of the current open orders. |
| 1920 | |
| 1921 | Parameters |
| 1922 | ---------- |
| 1923 | asset : Asset |
| 1924 | If passed and not None, return only the open orders for the given |
| 1925 | asset instead of all open orders. |
| 1926 | |
| 1927 | Returns |
| 1928 | ------- |
| 1929 | open_orders : dict[list[Order]] or list[Order] |
| 1930 | If no asset is passed this will return a dict mapping Assets |
| 1931 | to a list containing all the open orders for the asset. |
| 1932 | If an asset is passed then this will return a list of the open |
| 1933 | orders for this asset. |
| 1934 | """ |
| 1935 | if asset is None: |
| 1936 | return { |
| 1937 | key: [order.to_api_obj() for order in orders] |
| 1938 | for key, orders in iteritems(self.blotter.open_orders) |
| 1939 | if orders |
| 1940 | } |
| 1941 | if asset in self.blotter.open_orders: |
| 1942 | orders = self.blotter.open_orders[asset] |
| 1943 | return [order.to_api_obj() for order in orders] |
| 1944 | return [] |
| 1945 | |
| 1946 | @api_method |
| 1947 | def get_order(self, order_id): |