The JAVA SDK is deprecated

  • The OANDA v1 REST API will cease to function for your account as early as May 2018.
  • Please migrate your applications to use the v20 REST API. A Java wrapper is available in the sample code section.

Java SDK Code Samples

Check out our code sample

This zip file includes


Simple input from the keyboard for all primitive types.This is not thread safe, not high performance, and doesn’t tell EOF. It’s intended for low-volume easy keyboard input.

EasyIn easy = new EasyIn();
    int i = easy.readInt();   // reads an int from
    float f = easy.readFloat();   // reads a float from

Log in with your fxTrade Practice account to monitor your account and display account info every 5 seconds.

        System.out.println("CURRENT TRADES:");
        for (int i = 0; i < trades.size(); i++) {
        System.out.println("CURRENT ACCOUNT INFO:");
        System.out.println("Balance: " + myaccount.getBalance());
        System.out.println("Realized PL: " + myaccount.getRealizedPL());
        System.out.println("Unrealized PL: " + myaccount.getUnrealizedPL());
        System.out.println("MarginUsed: " + myaccount.getMarginUsed());
        System.out.println("MarginAvailable: " + myaccount.getMarginAvailable());

LimitMapper is an FXTrade API example which detects the execution of limit orders and maps the resultant market orders back to the limit order that spawned it.