Get a list of open orders for a product. The amount of detail shown can be customized with the `level` parameter: * 1: Only the best bid and ask * 2: Top 50 bids and asks (aggregated) * 3: Full order book (non aggregated) Level 1 and Level 2 are reco
(self, product_id, level=1)
| 50 | return self._send_message('get', '/products') |
| 51 | |
| 52 | def get_product_order_book(self, product_id, level=1): |
| 53 | """Get a list of open orders for a product. |
| 54 | |
| 55 | The amount of detail shown can be customized with the `level` |
| 56 | parameter: |
| 57 | * 1: Only the best bid and ask |
| 58 | * 2: Top 50 bids and asks (aggregated) |
| 59 | * 3: Full order book (non aggregated) |
| 60 | |
| 61 | Level 1 and Level 2 are recommended for polling. For the most |
| 62 | up-to-date data, consider using the websocket stream. |
| 63 | |
| 64 | **Caution**: Level 3 is only recommended for users wishing to |
| 65 | maintain a full real-time order book using the websocket |
| 66 | stream. Abuse of Level 3 via polling will cause your access to |
| 67 | be limited or blocked. |
| 68 | |
| 69 | Args: |
| 70 | product_id (str): Product |
| 71 | level (Optional[int]): Order book level (1, 2, or 3). |
| 72 | Default is 1. |
| 73 | |
| 74 | Returns: |
| 75 | dict: Order book. Example for level 1:: |
| 76 | { |
| 77 | "sequence": "3", |
| 78 | "bids": [ |
| 79 | [ price, size, num-orders ], |
| 80 | ], |
| 81 | "asks": [ |
| 82 | [ price, size, num-orders ], |
| 83 | ] |
| 84 | } |
| 85 | |
| 86 | """ |
| 87 | params = {'level': level} |
| 88 | return self._send_message('get', |
| 89 | '/products/{}/book'.format(product_id), |
| 90 | params=params) |
| 91 | |
| 92 | def get_product_ticker(self, product_id): |
| 93 | """Snapshot about the last trade (tick), best bid/ask and 24h volume. |