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

io.contek.zeus.MarketSymbol Maven / Gradle / Ivy

There is a newer version: 2.29.0
Show newest version
package io.contek.zeus;

import com.google.common.collect.ImmutableSet;
import io.contek.zeus.common.*;

import javax.annotation.concurrent.Immutable;
import java.util.Collection;

import static com.google.common.collect.ImmutableSet.toImmutableSet;

@Immutable
public final class MarketSymbol extends StringKey {

  private MarketSymbol(String stringValue) {
    super(stringValue);
  }

  public static MarketSymbol of(MarketInfo marketInfo) {
    return of(marketInfo.getMarketSymbol());
  }

  public static MarketSymbol of(Quote quote) {
    return of(quote.getMarketSymbol());
  }

  public static MarketSymbol of(PositionSnapshot positionSnapshot) {
    return of(positionSnapshot.getMarketSymbol());
  }

  public static MarketSymbol of(OrderSnapshot orderSnapshot) {
    return of(orderSnapshot.getOrderSpec().getMarketSymbol());
  }

  public static MarketSymbol of(OrderSpec orderSpec) {
    return of(orderSpec.getMarketSymbol());
  }

  public static MarketSymbol of(String stringValue) {
    return new MarketSymbol(stringValue);
  }

  public static ImmutableSet setOf(Collection stringValues) {
    return stringValues.stream().map(MarketSymbol::of).collect(toImmutableSet());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy