Skip to content

raman-babich/investment-lime-trader-client

Repository files navigation

Lime trader client

This is Java client for the lime.co trader api. Official description of the api could be found here.

Quick start

Important
Java 17+ is required

Add dependency of lime trader client, e.g. if you are using maven it will be something like:

<dependency>
  <groupId>com.ramanbabich.investment</groupId>
  <artifactId>lime-trader-client</artifactId>
  <version>${lime-trader-client.version}</version>
</dependency>

Create an instance of lime trader client specifying your credentials and just invoke methods you need. Don’t forget to close the client when you don’t need it any longer or just use try-with-resources statement to free up borrowed resources.

LimeTraderClient client = new LimeTraderClient(new Credentials(
      "<your-client-id>",
      "<your-client-secret>",
      "<your-username>",
      "<your-password>"));
List<AccountBalance> accountBalances = client.getAccountBalances();
String accountNumber = accountBalances.get(0).accountNumber();
client.setSubscriber((AccountBalanceChangedEventSubscriber) System.out::println);
client.subscribeForAccountBalanceChangedEvents(accountNumber);
Thread.sleep(5 * 1000);
client.close();

Look through one file code of the client overview app to quickly get info about all capabilities of this client. You can also start this app inside your code and analyse capabilities via logs with help of code below:

Warning
application.reviewOrderApi(); is commented because it makes the order that you possibly don’t want to do, it is recommended to look through the source code first of all.
try (ClientOverviewApplication application = new ClientOverviewApplication(new Credentials(
    "<your-client-id>", "<your-client-secret>", "<your-username>", "<your-password>"))) {
  application.reviewAccountApi();
  //application.reviewOrderApi();
  application.reviewPricingApi();
  application.reviewSecurityApi();
  application.reviewMarketDataApi();
}

Internals

This client internally uses java.net.http.HttpClient introduced in Java 11 for http and web socket communication. Shaded FasterXML Jackson databind for (de)serialization of request/responses.

License

Licensed under the Apache License, Version 2.0

Lime trader client includes a number of subcomponents with separate copyright notices and license terms. Your use of the source code for these subcomponents is subject to the terms and conditions of their licenses. Details are included within NOTICE.txt file, please read it before use.

About

Java client for the lime.co trader api

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages