MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_order

Method fetch_order

python/ccxt/delta.py:2156–2208  ·  view source on GitHub ↗

fetches information on an order made by the user https://docs.delta.exchange/#get-order-by-id https://docs.delta.exchange/#get-order-by-client-oid :param str id: the order id :param str [symbol]: unified symbol of the market the order was made in :p

(self, id: str, symbol: Str = None, params={})

Source from the content-addressed store, hash-verified

2154 ]
2155
2156 def fetch_order(self, id: str, symbol: Str = None, params={}) -> Order:
2157 """
2158 fetches information on an order made by the user
2159
2160 https://docs.delta.exchange/#get-order-by-id
2161 https://docs.delta.exchange/#get-order-by-client-oid
2162
2163 :param str id: the order id
2164 :param str [symbol]: unified symbol of the market the order was made in
2165 :param dict [params]: extra parameters specific to the exchange API endpoint
2166 :param str [params.clientOrderId]: client order id of the order
2167 :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
2168 """
2169 self.load_markets()
2170 market = None
2171 if symbol is not None:
2172 market = self.market(symbol)
2173 clientOrderId = self.safe_string_n(params, ['clientOrderId', 'client_oid', 'clientOid'])
2174 params = self.omit(params, ['clientOrderId', 'client_oid', 'clientOid'])
2175 request = {}
2176 response = None
2177 if clientOrderId is not None:
2178 request['client_oid'] = clientOrderId
2179 response = self.privateGetOrdersClientOrderIdClientOid(self.extend(request, params))
2180 else:
2181 request['order_id'] = id
2182 response = self.privateGetOrdersOrderId(self.extend(request, params))
2183 #
2184 # {
2185 # "success": True,
2186 # "result": {
2187 # "id": 123,
2188 # "user_id": 453671,
2189 # "size": 10,
2190 # "unfilled_size": 2,
2191 # "side": "buy",
2192 # "order_type": "limit_order",
2193 # "limit_price": "59000",
2194 # "stop_order_type": "stop_loss_order",
2195 # "stop_price": "55000",
2196 # "paid_commission": "0.5432",
2197 # "commission": "0.5432",
2198 # "reduce_only": False,
2199 # "client_order_id": "my_signal_34521712",
2200 # "state": "open",
2201 # "created_at": "1725865012000000",
2202 # "product_id": 27,
2203 # "product_symbol": "BTCUSD"
2204 # }
2205 # }
2206 #
2207 result = self.safe_dict(response, 'result', {})
2208 return self.parse_order(result, market)
2209
2210 def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
2211 """

Callers

nothing calls this directly

Calls 9

load_marketsMethod · 0.95
parse_orderMethod · 0.95
safe_string_nMethod · 0.80
safe_dictMethod · 0.80
marketMethod · 0.45
omitMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected