Skip to content
This repository has been archived by the owner on May 7, 2022. It is now read-only.

JCoinbaseClientFactory

Bad_Pop edited this page Mar 29, 2021 · 2 revisions

The JCoinbaseClientFactory class is a factory class that allows you to create new instances of JCoinbaseClient. It is therefore via this class that you must instantiate your JCoinbaseClient objects.

The JCoinbaseClientFactory gives you access to a single method named build(), by which you instantiate your objects. It takes several parameters : an ApiKey an ApiSecret, an ApiVersion, a long value representing the wanted timeout for all the http requests, and finally, a boolean defining if you want an instance built as a thread safe singleton.`

JCoinbaseClientFactory usage exemple

Simply call the build method

// Return a new JCoinbaseClient instance configured with the given parameters.
JCoinbaseClient client=JCoinbaseClientFactory.build(
        "apiKey",
        "apiSecret",
        "apiVersion",
        3,
        false
        );

Note that the apiKey, secret and apiVersion params are optional, so you can set these params to null. However, you will only be able to access the public data of coinbase in this case. So, if you want to access protected data such as accounts or transactions, you should provide an api key and a secret.

If you do not already have an api key, you can follow this link to create a new one.

Also note that you can create a JCoinbaseClient object as a safe thread singleton by passing true for the threadSafe param. This will keep the same instance for each call of this method with threadSafe = true, but it is also more resource intensive. If you do not want the JCoinbaseClient to be a thread safe singleton, simply set the threadSafe parameter to false for each call. This will return a new instance each time you call this method

Clone this wiki locally