queryallOCO method

Future<Either<String, List<OcoOrder>>> queryallOCO({
  1. int? fromId,
  2. int? startTime,
  3. int? endTime,
  4. int? limit,
  5. int? recvWindow,
})

Retrieves all OCO based on provided optional parameters

Implementation

Future<Either<String, List<OcoOrder>>> queryallOCO({
  int? fromId,
  int? startTime,
  int? endTime,
  int? limit,
  int? recvWindow,
}) {
  Map<String, String> params = {};
  if (fromId != null) params['fromId'] = fromId.toString();
  if (startTime != null) params['startTime'] = startTime.toString();
  if (endTime != null) params['endTime'] = endTime.toString();
  if (limit != null) params['limit'] = limit.toString();
  if (recvWindow != null) params['recvWindow'] = recvWindow.toString();
  return sendRequest(
    path: 'api/v3/allOrderList',
    type: RequestType.GET,
    params: params,
    keyRequired: true,
    signatureRequired: true,
    timestampRequired: true,
  ).then((r) => r.isLeft
      ? Left(r.left)
      : Right(List<OcoOrder>.from(r.right.map((e) => OcoOrder.fromMap(e)))));
}