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

io.contek.invoker.deribit.api.websocket.user.UserChangesChannel Maven / Gradle / Ivy

package io.contek.invoker.deribit.api.websocket.user;

import io.contek.invoker.deribit.api.common._Order;
import io.contek.invoker.deribit.api.common._Position;
import io.contek.invoker.deribit.api.common._UserTrade;
import io.contek.invoker.deribit.api.websocket.WebSocketChannelId;
import io.contek.invoker.deribit.api.websocket.WebSocketRequestIdGenerator;
import io.contek.invoker.deribit.api.websocket.common.WebSocketSingleChannelMessage;

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

import static java.lang.String.format;

@ThreadSafe
public final class UserChangesChannel
    extends UserWebSocketChannel {

  UserChangesChannel(Id id, WebSocketRequestIdGenerator requestIdGenerator) {
    super(id, requestIdGenerator);
  }

  @Override
  public Class getMessageType() {
    return Message.class;
  }

  @Immutable
  public static final class Id extends WebSocketChannelId {

    private Id(String value) {
      super(value);
    }

    public static Id of(String kind, String currency, String interval) {
      return new Id(format("user.changes.%s.%s.%s", kind, currency, interval));
    }

    public static Id of(String instrumentName, String interval) {
      return new Id(format("user.changes.%s.%s", instrumentName, interval));
    }
  }

  @NotThreadSafe
  public static final class Message extends WebSocketSingleChannelMessage {}

  @NotThreadSafe
  public static final class Data {

    public String instrument_name;
    public List<_Order> orders;
    public List<_Position> positions;
    public List<_UserTrade> trades;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy