Skip to content

Instantly share code, notes, and snippets.

View GLitchfield's full-sized avatar

Gavin M Litchfield GLitchfield

  • Maxpoint
  • Raleigh, NC
View GitHub Profile
public interface MetadataService {
/**
*
*/
interface Result<V extends Metadata> extends Existential {
SearchContext context();
Map<String, List<V>> results();
public class DoubleUtil
{
//Hardcode some byte arrays to make them quickly available
public static final char NO_THOUSANDS_SEPARATOR = '@';
public static final char[] INFINITY = {'I','n','f','i','n','i','t','y'};
public static final char[] NaN = {'N','a','N'};
public static final char[][] ZEROS = {
{},
{'0'},
{'0','0'},
public final class MarketDataGetters {
public interface MDGetter<V extends MarketData<V>> {
public V get(Market market);
}
@SuppressWarnings({ "rawtypes", "serial" })
private static final Map<Class, MDGetter> getters =
public interface Subscription<T extends Metadata> extends Existential {
enum Lense {
REALTIME, DELAYED, REPLAY
}
Lense lense();
/**
*
public interface Subscription<T extends Metadata> extends Existential {
enum SubscriptionType {
NULL, REALTIME, FIFTEEN_MIN_DELAYED
}
SubscriptionType type();
T metadata();
public interface MetadataService {
// Placeholder
interface SearchContext {
}
Observable<Instrument> instrument(String... symbols);
Observable<Instrument> instrument(SearchContext ctx, String... symbols);
@Override
public Observable<AccountBlob> accounts(final Identifier userID,
final GatewayID gatewayID) {
/* Create RestResponse Observable */
final Observable<RestResponse<byte[]>> obs = send(authRequest(Method.GET,
"/" + gatewayID.toString() + "/" + userID.toString() + "/accounts"));
/* We map each RestResponse to multiple AccountBlobs
*
public class GatewayID extends Identifier<GatewayID> {
public GatewayID(String id) {
super(id, GatewayID.class);
}
public static final GatewayID NULL = new GatewayID("NULL_GATEWAY_ID") {
@Override
public boolean isNull() {
public abstract class Identifier<T extends Identifier<T>>
implements Comparable<T>, Existential {
private final String id;
private final Class<T> clazz;
public Identifier(final String id, final Class<T> clazz) {
if(id == null) {
throw new IllegalArgumentException("ID cannot be null");