Java client for the Coinbase API

What is JCoinbase?

JCoinbase is an unofficial & open source client for the Coinbase exchange platform API written in Java 15. It allows you to make queries to the Coinbase API in a quick and easy way.

Designed to be simple

All queries sent via JCoinbase are standardized and give you access to an API entirely designed for speed of use and understanding

Designed to save you time

Want to use the Coinbase API? Don't want to waste time hardcoding all its conventions and requirements? JCoinbase has already done all that for you

Designed to be robust

This project was created with the developers who will use it in mind. It offers a complete and robust API based on lambdas. Under the hood you will find functional programming, immutability and fully tested code

Take a coffee and start using JCoinbase. Everything is ready for you and your project

Get Started




    compile 'com.github.bad-pop:jcoinbase:0.2.0'

Create a new client

You must instantiate a new JCoinbaseClient object using the JCoinbaseClientFactory class :

    long timeout = 3;
    boolean threadSafe = false;

    JCoinbaseClient client = JCoinbaseClientFactory
            "yourApiKey", // Your api key generated by Coinbase in your profile settings
            "yourSecret", // Your secret generated by Coinbase in your profile settings
            "apiVersion", // The Coinbase API version defined in your profile settings
            timeout, // A long value that defines the timeout in seconds for all requests. Recommended value is 3
            threadSafe // A boolean defining if the JCoinbaseClient should be build as a thread safe singleton

Notice that, if you pass null for the api key, the secret and the api version, you won't be able to access non-public data : user, account, addresses, transactions, buy, sell, deposit, withdrawals and payment methods.

Request the Coinbase API

After building a JCoinbaseClient object, you can access the request services

    // Get DataService that you can use to call Coinbase users data
    UserService dataService = client.user();
    CallResult<Seq<CoinbaseError>, ExchangeRates> result = dataservice.getExchangeRates("BTC");
    // Or directly make a request by calling
    CallResult<Seq<CoinbaseError>, ExchangeRates> result =  client.data().getExchangeRates("BTC");

Please note that, by default, returned values use Vavr data types for objects like Collections or Option. So if you don't want to use Vavr, you can always get java objects via the api. For example :

    CallResult<io.vavr.collection.Seq<CoinbaseError>, User> currentUser = client.user().getCurrentUser();
    CallResult<java.util.List<CoinbaseError>, User> currentUser = client.user().getCurrentUserAsJava();

For further information on Vavr, please take a look at : www.vavr.io

Full Documentation

To see the full documentation, please check the github repository

More on GitHub


JCoinbase is distributed for free under the Apache-2.0 License

View the licence

Do you like JCoinbase ? If so, you can encourage me by making a donation or by participating in the development