/BinanceManager

This is a Java Based library useful to work with Binance's API service.

Primary LanguageJava

BinanceManager

v1.0.9

This is a Java Based library useful to work with Binance's API service.

Implementation

Add the JitPack repository to your build file

Gradle

  • Add it in your root build.gradle at the end of repositories
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  • Add the dependency
dependencies {
	implementation 'com.github.N7ghtm4r3:BinanceManager:1.0.9'
}

Maven

  • Add it in your root build.gradle at the end of repositories
<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
  • Add the dependency
<dependency>
    <groupId>com.github.N7ghtm4r3</groupId>
    <artifactId>BinanceManager</artifactId>
    <version>1.0.9</version>
</dependency>

🛠 Skills

  • Java

Endpoints managers available

  • Wallet (Signed manager)
  • Market Data (NO-Signed manager)
  • Spot Account/Trade (Signed manager)
  • Margin Account/Trade (Signed manager)

The other endpoints managers will be gradually released

Usage/Examples

No-Signed Managers

// with automatic research for a workly basepoint
try {
    BinanceMarketManager binanceMarketManager = new BinanceMarketManager();
} catch (Exception e) {
    e.printStackTrace();
}

// choose basepoint manually (index from 0 to 3)
try {
    BinanceMarketManager binanceMarketManager = new BinanceMarketManager(BinanceManager.BASE_ENDPOINTS.get(0));
} catch (Exception e) {
    e.printStackTrace();
}

Signed Managers (requests with apiKey)

// with automatic research for a workly basepoint
try {
    BinanceSpotManager binanceSpotManager = new BinanceSpotManager("yourApiKey", "yourSecretKey");
} catch (Exception e) {
    e.printStackTrace();
}

// choose basepoint manually (index from 0 to 3)
try {
    BinanceSpotManager binanceSpotManager = new BinanceSpotManager(BinanceManager.BASE_ENDPOINTS.get(0), "yourApiKey", "yourSecretKey");
} catch (Exception e) {
    e.printStackTrace();
}

Responses

In this example manager is NO signed type manager, but is the same for signed type managers

  • String: will return response formatted as {@link String} object
try {
    System.out.println(binanceMarketManager.getPriceTicker("BTCBUSD"));
} catch (Exception e) {
    e.printStackTrace();
}
  • JSON: will return response formatted as JSON (JSONObject or JSONArray)
try {
    System.out.println(binanceMarketManager.getJSONPriceTicker("BTCBUSD"));
} catch (Exception e) {
    e.printStackTrace();
}
  • Custom-object: will return response formatted as custom object provided by library
try {
    System.out.println(binanceMarketManager.getObjectPriceTicker("BTCBUSD"));
} catch (Exception e) {
    e.printStackTrace();
}
  • Primitives: some requests will return primitive types like boolean, long, double
// it return long type es. 151596910325
try {
    System.out.println(binanceMarketManager.getTimestamp());
} catch (Exception e) {
    e.printStackTrace();
}

Errors handling

try {
    System.out.println(binanceMarketManager.getTimestamp());
} catch (Exception e) {
    System.out.println(binanceMarketManager.getErrorResponse());
    //or
    binanceMarketManager.printErrorResponse(); 
}
/* NOTE: if is not a request error will appear: "Error is not in api request, check out your code"
  and you will have to work on your code to manage error*/

Authors

Support

If you need help using the library or encounter any problems or bugs, please contact us via the following links:

Thank you for your help!

Badges

Twitter

Donations

If you want support project and developer with crypto: 0x5f63cc6d13b16dcf39cd8083f21d50151efea60e

If you want support project and developer with PayPal

Copyright © 2022 Tecknobit