getOrderStatus method
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,
));
}