Skip to content

Instantly share code, notes, and snippets.

@rterp
Created March 4, 2016 14:41
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/1c3578465ff94965f7f3 to your computer and use it in GitHub Desktop.
Save rterp/1c3578465ff94965f7f3 to your computer and use it in GitHub Desktop.
public void placeCurrencyOrder() {
InteractiveBrokersClientInterface ibClient = InteractiveBrokersClient.getInstance("localhost", 7999, 1);
ibClient.connect();
CurrencyTicker eurTicker = new CurrencyTicker();
eurTicker.setSymbol("EUR");
eurTicker.setCurrency("USD");
eurTicker.setExchange(Exchange.IDEALPRO);
String orderId = ibClient.getNextOrderId();
int amount = 50000;
TradeOrder order = new TradeOrder(orderId, eurTicker, amount, TradeDirection.BUY);
ibClient.placeOrder(order);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment