* @method * @name modetrade#fetchOrder * @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-order_id * @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-client_order_id * @see https://orderly.network/docs/
(id: string, symbol: Str = undefined, params = {})
| 1945 | * @returns {object} An [order structure]{@link https://docs.ccxt.com/?id=order-structure} |
| 1946 | */ |
| 1947 | async fetchOrder (id: string, symbol: Str = undefined, params = {}) { |
| 1948 | await this.loadMarkets (); |
| 1949 | let market: Market = undefined; |
| 1950 | if (symbol !== undefined) { |
| 1951 | market = this.market (symbol); |
| 1952 | } |
| 1953 | const trigger = this.safeBool2 (params, 'stop', 'trigger', false); |
| 1954 | const request: Dict = {}; |
| 1955 | const clientOrderId = this.safeStringN (params, [ 'clOrdID', 'clientOrderId', 'client_order_id' ]); |
| 1956 | params = this.omit (params, [ 'stop', 'trigger', 'clOrdID', 'clientOrderId', 'client_order_id' ]); |
| 1957 | let response = undefined; |
| 1958 | if (trigger) { |
| 1959 | if (clientOrderId) { |
| 1960 | request['client_order_id'] = clientOrderId; |
| 1961 | response = await this.v1PrivateGetAlgoClientOrderClientOrderId (this.extend (request, params)); |
| 1962 | } else { |
| 1963 | request['oid'] = id; |
| 1964 | response = await this.v1PrivateGetAlgoOrderOid (this.extend (request, params)); |
| 1965 | } |
| 1966 | } else { |
| 1967 | if (clientOrderId) { |
| 1968 | request['client_order_id'] = clientOrderId; |
| 1969 | response = await this.v1PrivateGetClientOrderClientOrderId (this.extend (request, params)); |
| 1970 | } else { |
| 1971 | request['oid'] = id; |
| 1972 | response = await this.v1PrivateGetOrderOid (this.extend (request, params)); |
| 1973 | } |
| 1974 | } |
| 1975 | // |
| 1976 | // { |
| 1977 | // "success": true, |
| 1978 | // "timestamp": 1702989203989, |
| 1979 | // "data": { |
| 1980 | // "order_id": 78151, |
| 1981 | // "user_id": 12345, |
| 1982 | // "price": 0.67772, |
| 1983 | // "type": "LIMIT", |
| 1984 | // "quantity": 20, |
| 1985 | // "amount": 10, |
| 1986 | // "executed_quantity": 20, |
| 1987 | // "total_executed_quantity": 20, |
| 1988 | // "visible_quantity": 1, |
| 1989 | // "symbol": "PERP_BTC_USDC", |
| 1990 | // "side": "BUY", |
| 1991 | // "status": "FILLED", |
| 1992 | // "total_fee": 0.5, |
| 1993 | // "fee_asset": "BTC", |
| 1994 | // "client_order_id": 1, |
| 1995 | // "average_executed_price": 0.67772, |
| 1996 | // "created_time": 1653563963000, |
| 1997 | // "updated_time": 1653564213000, |
| 1998 | // "realized_pnl": 123 |
| 1999 | // } |
| 2000 | // } |
| 2001 | // |
| 2002 | const orders = this.safeDict (response, 'data', response); |
| 2003 | return this.parseOrder (orders, market); |
| 2004 | } |
nothing calls this directly
no test coverage detected