* @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: string, symbol: Str = undefined, params = {})
| 4384 | * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} |
| 4385 | */ |
| 4386 | async fetchOrder (id: string, symbol: Str = undefined, params = {}) { |
| 4387 | await this.loadMarkets (); |
| 4388 | const isTwapOrder = this.safeBool (params, 'twap', false); |
| 4389 | params = this.omit (params, 'twap'); |
| 4390 | let response: NullableDict = undefined; |
| 4391 | let market: Market = undefined; |
| 4392 | if (isTwapOrder) { |
| 4393 | const twapRequest: Dict = { |
| 4394 | 'mainOrderId': id, |
| 4395 | }; |
| 4396 | response = await this.swapV1PrivateGetTwapOrderDetail (this.extend (twapRequest, params)); |
| 4397 | // |
| 4398 | // { |
| 4399 | // "code": 0, |
| 4400 | // "msg": "success cancel order", |
| 4401 | // "timestamp": 1732760856617, |
| 4402 | // "data": { |
| 4403 | // "symbol": "LTC-USDT", |
| 4404 | // "mainOrderId": "5596903086063901779", |
| 4405 | // "side": "BUY", |
| 4406 | // "positionSide": "LONG", |
| 4407 | // "priceType": "constant", |
| 4408 | // "priceVariance": "10.00", |
| 4409 | // "triggerPrice": "120.00", |
| 4410 | // "interval": 8, |
| 4411 | // "amountPerOrder": "0.5", |
| 4412 | // "totalAmount": "1.0", |
| 4413 | // "orderStatus": "Filled", |
| 4414 | // "executedQty": "1.0", |
| 4415 | // "duration": 16, |
| 4416 | // "maxDuration": 86400, |
| 4417 | // "createdTime": 1732693017000, |
| 4418 | // "updateTime": 1732693033000 |
| 4419 | // } |
| 4420 | // } |
| 4421 | // |
| 4422 | } else { |
| 4423 | if (symbol === undefined) { |
| 4424 | throw new ArgumentsRequired (this.id + ' fetchOrder() requires a symbol argument'); |
| 4425 | } |
| 4426 | market = this.market (symbol); |
| 4427 | const request: Dict = { |
| 4428 | 'symbol': market['id'], |
| 4429 | 'orderId': id, |
| 4430 | }; |
| 4431 | let type: Str = undefined; |
| 4432 | let subType: Str = undefined; |
| 4433 | [ type, params ] = this.handleMarketTypeAndParams ('fetchOrder', market, params); |
| 4434 | [ subType, params ] = this.handleSubTypeAndParams ('fetchOrder', market, params); |
| 4435 | if (type === 'spot') { |
| 4436 | response = await this.spotV1PrivateGetTradeQuery (this.extend (request, params)); |
| 4437 | // |
| 4438 | // { |
| 4439 | // "code": 0, |
| 4440 | // "msg": "", |
| 4441 | // "data": { |
| 4442 | // "symbol": "XRP-USDT", |
| 4443 | // "orderId": 1514087361158316032, |
nothing calls this directly
no test coverage detected