fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data :param str symbol: unified symbol of the market to fetch the order book for :param int [limit]: the maximum amount of order book entries to return :param dict [params]: extr
(self, symbol: str, limit: Int = None, params={})
| 1056 | return self.parse_balance(response) |
| 1057 | |
| 1058 | def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook: |
| 1059 | """ |
| 1060 | fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data |
| 1061 | :param str symbol: unified symbol of the market to fetch the order book for |
| 1062 | :param int [limit]: the maximum amount of order book entries to return |
| 1063 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 1064 | :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/?id=order-book-structure>` |
| 1065 | """ |
| 1066 | self.load_markets() |
| 1067 | market = self.market(symbol) |
| 1068 | request = { |
| 1069 | 'symbol': market['id'], |
| 1070 | } |
| 1071 | response = self.v1PublicGetDepth(self.extend(request, params)) |
| 1072 | # |
| 1073 | # { |
| 1074 | # "code":0, |
| 1075 | # "data":{ |
| 1076 | # "m":"depth-snapshot", |
| 1077 | # "symbol":"BTC-PERP", |
| 1078 | # "data":{ |
| 1079 | # "ts":1590223998202, |
| 1080 | # "seqnum":115444921, |
| 1081 | # "asks":[ |
| 1082 | # ["9207.5","18.2383"], |
| 1083 | # ["9207.75","18.8235"], |
| 1084 | # ["9208","10.7873"], |
| 1085 | # ], |
| 1086 | # "bids":[ |
| 1087 | # ["9207.25","0.4009"], |
| 1088 | # ["9207","0.003"], |
| 1089 | # ["9206.5","0.003"], |
| 1090 | # ] |
| 1091 | # } |
| 1092 | # } |
| 1093 | # } |
| 1094 | # |
| 1095 | data = self.safe_dict(response, 'data', {}) |
| 1096 | orderbook = self.safe_dict(data, 'data', {}) |
| 1097 | timestamp = self.safe_integer(orderbook, 'ts') |
| 1098 | result = self.parse_order_book(orderbook, symbol, timestamp) |
| 1099 | result['nonce'] = self.safe_integer(orderbook, 'seqnum') |
| 1100 | return result |
| 1101 | |
| 1102 | def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker: |
| 1103 | # |
nothing calls this directly
no test coverage detected