getOrderStatus method

Future<BinanceOrderStatus> getOrderStatus({
  1. String baseUri = defaultUri,
  2. required String symbol,
  3. int? orderId,
  4. String? origClientOrderId,
  5. int recvWindow = 5000,
})

Will query the status of a given order.

API Key required : yes (+ signature)

Query weight : 2

Returns a BinanceOrderStatus containing all returned data when request is a success.

Throws a BinanceApiError if an error occurs.

Other info from docs:

  • Either orderId or origClientOrderId must be sent.
  • For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time.

Implementation

Future<BinanceOrderStatus> getOrderStatus({
  String baseUri = defaultUri,
  required String symbol,
  int? orderId,
  String? origClientOrderId,
  int recvWindow = 5000,
}) async {
  if (null == orderId && null == origClientOrderId) {
    throw ArgumentError('Either orderId or origClientOrderId must be sent.');
  }
  final queryParameters = {
    'symbol': symbol,
    'recvWindow': '$recvWindow',
  };
  if (null != orderId) {
    queryParameters['orderId'] = '$orderId';
  }
  if (null != origClientOrderId) {
    queryParameters['origClientOrderId'] = origClientOrderId;
  }
  return BinanceOrderStatus.fromJson(await sendRequest(
    baseUri,
    tradeOrderPath,
    queryParameters: queryParameters,
    withSignature: true,
  ));
}