![JAR search and dependency download from the Maven repository](/logo.png)
io.contek.invoker.bybit.api.websocket.user.UserWebSocketApi Maven / Gradle / Ivy
The newest version!
package io.contek.invoker.bybit.api.websocket.user;
import io.contek.invoker.bybit.api.websocket.WebSocketApi;
import io.contek.invoker.commons.actor.IActor;
import io.contek.invoker.commons.websocket.WebSocketContext;
import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
import java.util.HashMap;
import java.util.Map;
@ThreadSafe
public final class UserWebSocketApi extends WebSocketApi {
private final Map orderChannel = new HashMap<>();
private final Map positionChannel = new HashMap<>();
private final Map executionChannel = new HashMap<>();
public UserWebSocketApi(IActor actor, WebSocketContext context) {
super(actor, context);
}
public OrderChannel getOrderChannel(@Nullable String category) {
synchronized (orderChannel) {
return orderChannel.computeIfAbsent(
OrderChannel.Id.of(category),
k -> {
OrderChannel result = new OrderChannel(k, getRequestIdGenerator());
attach(result);
return result;
});
}
}
public PositionChannel getPositionChannel(@Nullable String category) {
synchronized (positionChannel) {
return positionChannel.computeIfAbsent(
PositionChannel.Id.of(category),
k -> {
PositionChannel result = new PositionChannel(k, getRequestIdGenerator());
attach(result);
return result;
});
}
}
public ExecutionChannel getExecutionChannel(@Nullable String category) {
synchronized (executionChannel) {
return executionChannel.computeIfAbsent(
ExecutionChannel.Id.of(category),
k -> {
ExecutionChannel result = new ExecutionChannel(k, getRequestIdGenerator());
attach(result);
return result;
});
}
}
@Override
protected String getUrlSuffix() {
return "/v5/private";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy