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

com.quotemedia.streamer.client.Subscription Maven / Gradle / Ivy

package com.quotemedia.streamer.client;

/**
 * Streaming market data subscription request.
 * 

* Instances of this class can be created using {@link Subscription.Builder}. */ public final class Subscription { private Subscription() { } private String[] symbols; /** * Returns the ticker symbols to subscribe for. * * @return the ticker symbols */ public final String[] symbols() { return this.symbols; } private Datatype[] types; /** * Returns the market data types to subscribe for. * * @return the market data types */ public final Datatype[] types() { return this.types; } private Boolean skipHeavyInitialLoad; /** * Returns whether heavy loads (e.g., previous trades) * should be excluded from the initial subscriptions payload. * * @return whether to exclude heavy initial loads. */ public boolean skipHeavyInitialLoad() { return skipHeavyInitialLoad != null ? skipHeavyInitialLoad : false; } private Integer conflation; /** * Returns the conflation value. * * @return the conflation */ public Integer conflation() { return this.conflation; } private Integer intervalPeriod; /** * Returns the interval period value. * * @return the interval period */ public Integer intervalPeriod() { return this.intervalPeriod; } /** * Builder to create immutable instances of {@link Subscription} with fluent api. */ public static final class Builder { private String[] symbols; /** * Sets the ticker symbols to subscribe for. *

* Each ticker symbol is subscribed for each market data type specified with {@link #types(Datatype[])}. * * @param value the ticker symbols * @return a reference to this object */ public final Builder symbols(final String... value) { this.symbols = value; return this; } private Datatype[] types; /** * Sets the market data types to subscribe for. *

* Each market data type is subscribed for each ticker symbol specified with {@link #symbols(String[])}. * * @param value the market data types * @return a reference to this object */ public final Builder types(final Datatype... value) { this.types = value; return this; } private boolean skipHeavyInitialLoad = false; /** * Sets whether to skip heavy initial loads. * * @param value whether to skip heavy initial loads. * @return a reference to this object */ public final Builder skipHeavyInitialLoad(final boolean value) { this.skipHeavyInitialLoad = value; return this; } private Integer conflation = null; /** * Sets conflation value. * * @param value conflation value. * @return a reference to this object */ public Builder conflation(final Integer value) { this.conflation = value; return this; } private Integer intervalPeriod = null; /** * Sets the interval period in milliseconds for INTERVAL types. * * @param value interval period value. * @return a reference to this object */ public Builder intervalPeriod(final Integer value) { this.intervalPeriod = value; return this; } /** * Creates a {@code Subscription} instance from set values. * * @return the created instance */ public final Subscription build() { final Subscription obj = new Subscription(); obj.symbols = this.symbols; obj.types = this.types; obj.skipHeavyInitialLoad = this.skipHeavyInitialLoad; obj.conflation = this.conflation; obj.intervalPeriod = this.intervalPeriod; return obj; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy