This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface MetadataService { | |
// Placeholder | |
interface SearchContext { | |
} | |
Observable<Instrument> instrument(String... symbols); | |
Observable<Instrument> instrument(SearchContext ctx, String... symbols); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Subscription<T extends Metadata> extends Existential { | |
enum SubscriptionType { | |
NULL, REALTIME, FIFTEEN_MIN_DELAYED | |
} | |
SubscriptionType type(); | |
T metadata(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Subscription<T extends Metadata> extends Existential { | |
enum Lense { | |
REALTIME, DELAYED, REPLAY | |
} | |
Lense lense(); | |
/** | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface MetadataService { | |
/** | |
* | |
*/ | |
interface Result<V extends Metadata> extends Existential { | |
SearchContext context(); | |
Map<String, List<V>> results(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface LastPrice { | |
/** | |
* In order of lowest to highest priority | |
*/ | |
enum Source { | |
NULL, PREV_SETTLE, LAST_TRADE, CLOSE, SETTLE | |
} | |
Source source(); |
OlderNewer