io.contek.invoker.hbdminverse.api.websocket.user.UserWebSocketApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of invoker-hbdminverse-api Show documentation
Show all versions of invoker-hbdminverse-api Show documentation
Huobi Derivative Inverse Java API
package io.contek.invoker.hbdminverse.api.websocket.user;
import io.contek.invoker.commons.actor.IActor;
import io.contek.invoker.commons.websocket.WebSocketContext;
import io.contek.invoker.hbdminverse.api.websocket.common.notification.NotificationWebSocketApi;
import javax.annotation.concurrent.ThreadSafe;
import java.util.HashMap;
import java.util.Map;
@ThreadSafe
public final class UserWebSocketApi extends NotificationWebSocketApi {
private final Map tradeDetailChannels =
new HashMap<>();
public UserWebSocketApi(IActor actor, WebSocketContext context) {
super(actor, context);
}
public TriggerOrderChannel getTriggerOrderChannel(String contractCode) {
synchronized (tradeDetailChannels) {
return tradeDetailChannels.computeIfAbsent(
TriggerOrderChannel.Id.of(contractCode),
k -> {
TriggerOrderChannel result = new TriggerOrderChannel(k, getRequestIdGenerator());
attach(result);
return result;
});
}
}
}