Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import com.sumzerotrading.data.StockTicker;
import com.zerosumtrading.interactive.brokers.client.InteractiveBrokersClient;
import com.sumzerotrading.marketdata.ILevel1Quote;
import com.sumzerotrading.marketdata.QuoteType;
public class MarketDataStocksExample {
public void start() {
InteractiveBrokersClient ibClient = new InteractiveBrokersClient("localhost", 6468, 1);
ibClient.connect();
StockTicker stockTicker= new StockTicker("AMZN");
ibClient.subscribeLevel1(stockTicker, (ILevel1Quote quote) -> {
if( quote.getType().equals(QuoteType.LAST) ){
System.out.println("Received Quote: " + quote.getValue() );
}
});
}
public static void main(String[] args) {
new MarketDataStocksExample().start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment