public class Main { public static void main(final String[] args) { new Main(); } private Main() { final NeoIbApiClient apiClient = new NeoIbApiClient(new MyClientCallback()); apiClient.connect(new ConnectionParameters(1), new ConnectionCallback() { @Override public void onSuccess(final Session session) { session.registerListener(new MyContractSpecificationEventListener()); session.registerListener(new MyTickSizeEventListener()); session.registerListener(new MyTickGenericEventListener()); session.registerListener(new MyCompositeTickEventListener()); Contract contract = getContract("DAX"); session.request(new ContractSpecificationRequest(contract)); session.subscribe(new MarketDataSubscriptionRequest(contract)); session.start(); } private Contract getContract(final String symbol) { final Contract contract = new Contract(); contract.setCurrencyCode("EUR"); contract.setExchange("DTB"); contract.setExpiry("201306"); contract.setSecurityType(SecurityType.FUTURE); contract.setSymbol(symbol); return contract; } @Override public void onFailure(final ConnectionException exception) { } }); } }
and listeners...
public class MyContractSpecificationEventListener implements ContractSpecificationEventListener { ... }
public class MyTickSizeEventListener implements TickSizeEventListener { ... }
public class MyTickGenericEventListener implements TickGenericEventListener { ... }
public class MyCompositeTickEventListener implements CompositeTickEventListener { ... }
<dependency> <groupId>ch.aonyx.broker.ib</groupId> <artifactId>neo-ib-api</artifactId> <version>1.1.5</version> </dependency><repositories> <repository> <id>central.maven</id> <name>Central Maven Repository</name> <url>http://central.maven.org/maven2</url> </repository> </repositories>