All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.contek.invoker.deribit.api.rest.user.GetOrderHistoryByCurrency Maven / Gradle / Ivy

There is a newer version: 3.8.0
Show newest version
package io.contek.invoker.deribit.api.rest.user;

import com.google.common.collect.ImmutableList;
import io.contek.invoker.commons.actor.IActor;
import io.contek.invoker.commons.actor.ratelimit.TypedPermitRequest;
import io.contek.invoker.commons.rest.RestContext;
import io.contek.invoker.commons.rest.RestMethod;
import io.contek.invoker.commons.rest.RestParams;
import io.contek.invoker.deribit.api.common._Order;
import io.contek.invoker.deribit.api.rest.common.RestResponse;

import javax.annotation.concurrent.NotThreadSafe;
import java.util.List;

import static io.contek.invoker.commons.rest.RestMethod.GET;
import static io.contek.invoker.deribit.api.ApiFactory.RateLimits.ONE_API_KEY_NON_MATCHING_ENGINE_REQUEST;
import static java.util.Objects.requireNonNull;

@NotThreadSafe
public final class GetOrderHistoryByCurrency
    extends UserRestRequest {

  private String currency;
  private String kind;
  private Integer count;
  private Integer offset;
  private Boolean include_old;
  private Boolean include_unfilled;

  GetOrderHistoryByCurrency(IActor actor, RestContext context) {
    super(actor, context);
  }

  public GetOrderHistoryByCurrency setCurrency(String currency) {
    this.currency = currency;
    return this;
  }

  public GetOrderHistoryByCurrency setKind(String kind) {
    this.kind = kind;
    return this;
  }

  public GetOrderHistoryByCurrency setCount(Integer count) {
    this.count = count;
    return this;
  }

  public GetOrderHistoryByCurrency setOffset(Integer offset) {
    this.offset = offset;
    return this;
  }

  public GetOrderHistoryByCurrency setIncludeOld(Boolean include_old) {
    this.include_old = include_old;
    return this;
  }

  public GetOrderHistoryByCurrency setIncludeUnfilled(Boolean include_unfilled) {
    this.include_unfilled = include_unfilled;
    return this;
  }

  @Override
  protected RestMethod getMethod() {
    return GET;
  }

  @Override
  protected String getEndpointPath() {
    return "/api/v2/private/get_order_history_by_currency";
  }

  @Override
  protected RestParams getParams() {
    RestParams.Builder builder = RestParams.newBuilder();

    requireNonNull(currency);
    builder.add("currency", currency);

    if (kind != null) {
      builder.add("kind", kind);
    }

    if (count != null) {
      builder.add("count", count);
    }

    if (offset != null) {
      builder.add("offset", offset);
    }

    if (include_old != null) {
      builder.add("include_old", include_old);
    }

    if (include_unfilled != null) {
      builder.add("include_unfilled", include_unfilled);
    }

    return builder.build();
  }

  @Override
  protected ImmutableList getRequiredQuotas() {
    return ONE_API_KEY_NON_MATCHING_ENGINE_REQUEST;
  }

  @Override
  protected Class getResponseType() {
    return Response.class;
  }

  @NotThreadSafe
  public static final class Response extends RestResponse> {}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy