io.contek.zeus.MarketSymbol Maven / Gradle / Ivy
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());
}
}