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
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.
All queries sent via JCoinbase are standardized and give you access to an API entirely designed for speed of use and understanding
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
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
<dependency>
<groupId>com.github.bad-pop</groupId>
<artifactId>jcoinbase</artifactId>
<version>0.2.0</version>
</dependency>
compile 'com.github.bad-pop:jcoinbase:0.2.0'
You must instantiate a new JCoinbaseClient object using the JCoinbaseClientFactory class :
long timeout = 3;
boolean threadSafe = false;
JCoinbaseClient client = JCoinbaseClientFactory
.build(
"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.
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
JCoinbase is distributed for free under the Apache-2.0 License
Do you like JCoinbase ? If so, you can encourage me by making a donation or by participating in the development