CoinEx Exchange API JVM Library
Icon | Item |
---|---|
📺 | Preview |
📱 | Compatibility |
💻 | Usage |
📩 | Download |
📋 | Features |
🧾 | Changelog |
⚖️ | License |
CoinEx4j is a JVM(Java, Kotlin, etc) library for using CoinEx Exchange API. This library aims to provide an easy-to-use abstraction over official API.
JVM11+
First create a client like this, but keep in mind this will give you a default client with predefined configurations.
CoinEx4J coinEx4J = new CoinEx4J.Builder().build();
You can customize your client like this:
CoinEx4J coinEx4J = new CoinEx4J.Builder()
.autoShutDown(true)
.accessId("...")
.secretKey("..")
.okhttp(...)
.retrofit(..)
.baseUrl(...)
.addConverter(...)
.build();
If you are using this library in JVM only (not Android) like in console for debugging or a server it's suggested to
enable autoShutDown
otherwise JVM may or may not exit after task completion depending on OkHttp
client
timeout, more info here.
After creating your client then you need to define the API group that you want to use, which are actually retrofit interfaces.
MarketAPIs marketAPIs = coinEx4J.createAPI(MarketAPIs.class);
Then you can use different sub APIs under that group.
marketAPIs.getMarketsInfo().asyncBody(coinEx4J, (response,error) -> {
System.out.println(response.data());
});
Custom callbacks are provided using retrofit call adapter feature and Java Consumer
class however you can still
use enqueue
and execute
methods. callbacks can be called from Kotlin too. different types of callbacks are explained
here.
Callback | Info |
---|---|
async | returns a callback with type of BiConsumer with Response<T> and Throwable parameters |
asyncCall | returns two callbacks, one for success (BiConsumer with Call<T> and Response<T> parameters) and another for failure (BiConsumer with Call<T> and Throwable parameters) |
asyncBody | returns a callback with type of BiConsumer with T and Throwable as parameters |
T
is response body type.
Find the latest version from Maven Artifact
Step 1. Add the Maven repository to your build file
Add it in your root build.gradle at the end of repositories:
repositories {
mavenCentral()
}
Step 2. Add the dependency
dependencies {
implementation 'io.github.TradersTeam:CoinEx4J:$coinex4j_last_version'
}
Add the dependency
<dependency>
<groupId>io.github.TradersTeam</groupId>
<artifactId>CoinEx4J</artifactId>
<version>$coinex4j_last_version</version>
<type>aar</type>
</dependency>
dependencies {
implementation("io.github.TradersTeam:CoinEx4J:$coinex4j_last_version")
}
- Common APIs
- Market APIs
- Account APIs
- Trading APIs
- Margin APIs
- Contract APIs
- System APIs
- Market APIs
- Trading APIs
- Common APIs (System)
- System APIs
- Market APIs
- Asset APIs
- Order APIs
- Position APIs
- Server APIs
- Market APIs
- Asset APIs
- Order APIs
- Position APIs
CoinEx4J is licensed under the GNU General Public License v3.0
Permissions of this strong copyleft license are conditioned on making
available complete source code of licensed works and modifications,
which include larger works using a licensed work, under the same
license. Copyright and license notices must be preserved. Contributors
provide an express grant of patent rights.
YaMiN |
ArianTron |