fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data https://github.com/Bitrue-exchange/Spot-official-api-docs#order-book https://www.bitrue.com/api-docs#order-book https://www.bitrue.com/api_docs_includes_file/delivery.html#
(self, symbol: str, limit: Int = None, params={})
| 1208 | return self.parse_balance(result) |
| 1209 | |
| 1210 | def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook: |
| 1211 | """ |
| 1212 | fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data |
| 1213 | |
| 1214 | https://github.com/Bitrue-exchange/Spot-official-api-docs#order-book |
| 1215 | https://www.bitrue.com/api-docs#order-book |
| 1216 | https://www.bitrue.com/api_docs_includes_file/delivery.html#order-book |
| 1217 | |
| 1218 | :param str symbol: unified symbol of the market to fetch the order book for |
| 1219 | :param int [limit]: the maximum amount of order book entries to return |
| 1220 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 1221 | :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/?id=order-book-structure>` |
| 1222 | """ |
| 1223 | self.load_markets() |
| 1224 | market = self.market(symbol) |
| 1225 | response = {} |
| 1226 | if market['swap']: |
| 1227 | request = { |
| 1228 | 'contractName': market['id'], |
| 1229 | } |
| 1230 | if limit is not None: |
| 1231 | if limit > 100: |
| 1232 | limit = 100 |
| 1233 | request['limit'] = limit # default 100, max 100, see https://www.bitrue.com/api-docs#order-book |
| 1234 | if market['linear']: |
| 1235 | response = self.fapiV1PublicGetDepth(self.extend(request, params)) |
| 1236 | elif market['inverse']: |
| 1237 | response = self.dapiV1PublicGetDepth(self.extend(request, params)) |
| 1238 | elif market['spot']: |
| 1239 | request = { |
| 1240 | 'symbol': market['id'], |
| 1241 | } |
| 1242 | if limit is not None: |
| 1243 | if limit > 1000: |
| 1244 | limit = 1000 |
| 1245 | request['limit'] = limit # default 100, max 1000, see https://github.com/Bitrue-exchange/bitrue-official-api-docs#order-book |
| 1246 | response = self.spotV1PublicGetDepth(self.extend(request, params)) |
| 1247 | else: |
| 1248 | raise NotSupported(self.id + ' fetchOrderBook only support spot & swap markets') |
| 1249 | # |
| 1250 | # spot |
| 1251 | # |
| 1252 | # { |
| 1253 | # "lastUpdateId":1635474910177, |
| 1254 | # "bids":[ |
| 1255 | # ["61436.84","0.05",[]], |
| 1256 | # ["61435.77","0.0124",[]], |
| 1257 | # ["61434.88","0.012",[]], |
| 1258 | # ], |
| 1259 | # "asks":[ |
| 1260 | # ["61452.46","0.0001",[]], |
| 1261 | # ["61452.47","0.0597",[]], |
| 1262 | # ["61452.76","0.0713",[]], |
| 1263 | # ] |
| 1264 | # } |
| 1265 | # |
| 1266 | # swap |
| 1267 | # |
nothing calls this directly
no test coverage detected