Functionality
The Prime and INTX Java SDKs offer a wide array of functionalities designed to simplify and enhance client interaction with Coinbase's trading platforms. Here are some key features:
Authentication and Authorization: Simplified handling of API keys and secrets, ensuring secure and authenticated requests
Order Management: Create, modify, and cancel orders with ease. Includes support for complex order types and parameters
Portfolio Management: Manage and monitor trading portfolios, view balances, and track performance
Transfer and Settlement: Handle internal transfers between portfolios, withdraw to crypto addresses, and track transactions
Error Handling: Robust error handling and response parsing to ensure smooth operation and easy debugging
Both SDKs are built using a shared core Java library, ensuring consistency in the features mentioned above. This allows both SDKs to be used in conjunction without needing to write bespoke handlers.
Running it yourself
The Coinbase Prime and INTX Java SDKs are both vended through Maven. To use these in your own project, install the dependencies using Maven:
<groupId>com.coinbase.intx</groupId>
<artifactId>coinbase-intx-sdk-java</artifactId>
<groupId>com.coinbase.prime</groupId>
<artifactId>coinbase-prime-sdk-java</artifactId>
Before running the above, make sure to check for the latest version on Maven.
To use the Coinbase Prime or INTX Java SDK, initialize the Credentials class and create a new client. The Credentials class is JSON-enabled, making it easy to securely store and manage API credentials. Ensure that Prime or INTX API credentials are stored in a secure manner, such as in ~/.zshrc or ~/.bashrc.
First, initialize the Credentials class and create a new client. See an example of this inside of the examples package.
String credsStringBlob = System.getenv("COINBASE_PRIME_CREDENTIALS");
ObjectMapper mapper = new ObjectMapper();
CoinbaseCredentials credentials = mapper.readValue(credsStringBlob, CoinbaseCredentials.class); CoinbaseHttpClient client = new CoinbaseHttpClient.Builder(credentials)
.withClient(java.net.http.HttpClient.newHttpClient())
To see a working example of the SDKs, each repository contains an examples package that highlights how to construct the corresponding SDK Client, instantiate Credentials, and call several API requests: INTX example, Prime example.
public static void main(String[] args) throws CoinbaseIntxException {
String credsStringBlob = System.getenv("INTX_CREDENTIALS");
ObjectMapper mapper = new ObjectMapper();
CoinbaseCredentials credentials = new CoinbaseCredentials(credsStringBlob);
CoinbaseIntxHttpClient client = new CoinbaseIntxHttpClient(credentials);
ListPortfoliosRequest listReq = new ListPortfoliosRequest.Builder()
ListPortfoliosResponse listResponse = client.listPortfolios(listReq);
System.out.println("List Portfolios Response:");
System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(listResponse));
throw new CoinbaseIntxException("Failed to retrieve the list portfolios response", e);
The release of the Prime Java SDK and International Exchange (INTX) Java SDK marks a significant step in enhancing our support for institutional traders. By providing these comprehensive Java SDKs, we are catering to the specific needs of financial institutions, ensuring they have the tools necessary for efficient and secure trading.
- -
Disclaimer: This application should never be used in any production environment, and any real funds used in this application may be lost. Additionally, this information is provided for informational purposes only and is not investment advice. This is not a recommendation to buy or sell digital assets or to employ a particular investment strategy, codes, or APIs. Coinbase makes no representation on the accuracy, suitability, or validity of any information provided herein.
This material is for informational purposes only and is not (i) an offer, or solicitation of an offer, to invest in, or to buy or sell, any interests or shares, or to participate in any investment or trading strategy, or (ii) intended to provide accounting, legal, or tax advice, or investment recommendations. No representation or warranty is made, expressed or implied, with respect to the accuracy or completeness of the information or to the future performance of any digital asset, financial instrument or other market or economic measure. The information is believed to be current as of the date indicated and may not be updated or otherwise revised to reflect information that subsequently became available or a change in circumstances after the date of publication. Investing in cryptocurrency comes with risk. Prior results do not guarantee future performance. Readers should consult their advisors before making any investment decision. Any references to third parties do not imply Coinbase's endorsement, or approval of any third-party websites or their content. This material is the property of Coinbase, Inc. Any use, review, retransmission, distribution, or reproduction of these materials, in whole or in part, is strictly prohibited in any form without the express written approval of Coinbase. Coinbase, Inc. is licensed to engage in virtual currency business activity by the New York State Department of Financial Services. © 2024 Coinbase, Inc. All Rights Reserved. COINBASE, the C Logo, and the Wallet Logo are all trademarks of Coinbase, Inc.