Skip to content

Instantly share code, notes, and snippets.

@rterp
Created February 11, 2016 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rterp/027b11d37a09cbc98072 to your computer and use it in GitHub Desktop.
Save rterp/027b11d37a09cbc98072 to your computer and use it in GitHub Desktop.
package com.sumzerotrading.ib.example.market.data;
import com.sumzerotrading.data.StockTicker;
import com.sumzerotrading.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();
}
}
@jampanij
Copy link

@rterp In this example, can you show how to unsubscribe level1Quote

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment