io.contek.invoker.binancespot.api.rest.user.DeleteAllOpenOrders Maven / Gradle / Ivy
package io.contek.invoker.binancespot.api.rest.user;
import com.google.common.collect.ImmutableList;
import io.contek.invoker.binancespot.api.common._Order;
import io.contek.invoker.binancespot.api.rest.user.DeleteAllOpenOrders.Response;
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 javax.annotation.concurrent.NotThreadSafe;
import java.util.ArrayList;
import static com.google.common.base.Preconditions.checkNotNull;
import static io.contek.invoker.binancespot.api.ApiFactory.RateLimits.ONE_REST_REQUEST;
import static io.contek.invoker.commons.rest.RestMethod.DELETE;
@NotThreadSafe
public final class DeleteAllOpenOrders extends UserRestRequest {
private String symbol;
DeleteAllOpenOrders(IActor actor, RestContext context) {
super(actor, context);
}
public DeleteAllOpenOrders setSymbol(String symbol) {
this.symbol = symbol;
return this;
}
@Override
protected Class getResponseType() {
return Response.class;
}
@Override
protected RestMethod getMethod() {
return DELETE;
}
@Override
protected String getEndpointPath() {
return "/api/v3/openOrders";
}
@Override
protected RestParams getParams() {
RestParams.Builder builder = RestParams.newBuilder();
checkNotNull(symbol);
builder.add("symbol", symbol);
builder.add("timestamp", getMillis());
return builder.build();
}
@Override
protected ImmutableList getRequiredQuotas() {
return ONE_REST_REQUEST;
}
@NotThreadSafe
public static final class Response extends ArrayList<_Order> {}
}