Created
February 11, 2016 17:42
-
-
Save rterp/027b11d37a09cbc98072 to your computer and use it in GitHub Desktop.
This file contains 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
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(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@rterp In this example, can you show how to unsubscribe level1Quote