* @method * @name bingx#fetchOrder * @description fetches information on an order made by the user * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20Order%20details * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Order
(id, symbol = undefined, params = {})
| 4394 | * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} |
| 4395 | */ |
| 4396 | async fetchOrder(id, symbol = undefined, params = {}) { |
| 4397 | await this.loadMarkets(); |
| 4398 | const isTwapOrder = this.safeBool(params, 'twap', false); |
| 4399 | params = this.omit(params, 'twap'); |
| 4400 | let response = undefined; |
| 4401 | let market = undefined; |
| 4402 | if (isTwapOrder) { |
| 4403 | const twapRequest = { |
| 4404 | 'mainOrderId': id, |
| 4405 | }; |
| 4406 | response = await this.swapV1PrivateGetTwapOrderDetail(this.extend(twapRequest, params)); |
| 4407 | // |
| 4408 | // { |
| 4409 | // "code": 0, |
| 4410 | // "msg": "success cancel order", |
| 4411 | // "timestamp": 1732760856617, |
| 4412 | // "data": { |
| 4413 | // "symbol": "LTC-USDT", |
| 4414 | // "mainOrderId": "5596903086063901779", |
| 4415 | // "side": "BUY", |
| 4416 | // "positionSide": "LONG", |
| 4417 | // "priceType": "constant", |
| 4418 | // "priceVariance": "10.00", |
| 4419 | // "triggerPrice": "120.00", |
| 4420 | // "interval": 8, |
| 4421 | // "amountPerOrder": "0.5", |
| 4422 | // "totalAmount": "1.0", |
| 4423 | // "orderStatus": "Filled", |
| 4424 | // "executedQty": "1.0", |
| 4425 | // "duration": 16, |
| 4426 | // "maxDuration": 86400, |
| 4427 | // "createdTime": 1732693017000, |
| 4428 | // "updateTime": 1732693033000 |
| 4429 | // } |
| 4430 | // } |
| 4431 | // |
| 4432 | } |
| 4433 | else { |
| 4434 | if (symbol === undefined) { |
| 4435 | throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument'); |
| 4436 | } |
| 4437 | market = this.market(symbol); |
| 4438 | const request = { |
| 4439 | 'symbol': market['id'], |
| 4440 | 'orderId': id, |
| 4441 | }; |
| 4442 | let type = undefined; |
| 4443 | let subType = undefined; |
| 4444 | [type, params] = this.handleMarketTypeAndParams('fetchOrder', market, params); |
| 4445 | [subType, params] = this.handleSubTypeAndParams('fetchOrder', market, params); |
| 4446 | if (type === 'spot') { |
| 4447 | response = await this.spotV1PrivateGetTradeQuery(this.extend(request, params)); |
| 4448 | // |
| 4449 | // { |
| 4450 | // "code": 0, |
| 4451 | // "msg": "", |
| 4452 | // "data": { |
| 4453 | // "symbol": "XRP-USDT", |
nothing calls this directly
no test coverage detected