bitget-java-sdk-open-api

Bitget Open API

  • API version: 2.0.0

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven (3.8.3+)/Gradle (7.2+)

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.upex.contract</groupId>
  <artifactId>bitget-java-sdk-open-api</artifactId>
  <version>1.0.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

  repositories {
    mavenCentral()     // Needed if the 'bitget-java-sdk-open-api' jar has been published to maven central.
    mavenLocal()       // Needed if the 'bitget-java-sdk-open-api' jar has been published to the local maven repo.
  }

  dependencies {
     implementation "com.upex.contract:bitget-java-sdk-open-api:1.0.0"
  }

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/bitget-java-sdk-open-api-1.0.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

// Import classes:
import com.bitget.openapi.ApiClient;
import com.bitget.openapi.ApiException;
import com.bitget.openapi.Configuration;
import com.bitget.openapi.auth.*;
import com.bitget.openapi.models.*;
import com.bitget.openapi.api.MarginCrossAccountApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.bitget.com");
    
    // Configure API key authorization: ACCESS_KEY
    ApiKeyAuth ACCESS_KEY = (ApiKeyAuth) defaultClient.getAuthentication("ACCESS_KEY");
    ACCESS_KEY.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ACCESS_KEY.setApiKeyPrefix("Token");

    // Configure API key authorization: ACCESS_PASSPHRASE
    ApiKeyAuth ACCESS_PASSPHRASE = (ApiKeyAuth) defaultClient.getAuthentication("ACCESS_PASSPHRASE");
    ACCESS_PASSPHRASE.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ACCESS_PASSPHRASE.setApiKeyPrefix("Token");

    // Configure API key authorization: ACCESS_SIGN
    ApiKeyAuth ACCESS_SIGN = (ApiKeyAuth) defaultClient.getAuthentication("ACCESS_SIGN");
    ACCESS_SIGN.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ACCESS_SIGN.setApiKeyPrefix("Token");

    // Configure API key authorization: ACCESS_TIMESTAMP
    ApiKeyAuth ACCESS_TIMESTAMP = (ApiKeyAuth) defaultClient.getAuthentication("ACCESS_TIMESTAMP");
    ACCESS_TIMESTAMP.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ACCESS_TIMESTAMP.setApiKeyPrefix("Token");

    // Configure API key authorization: SECRET_KEY
    ApiKeyAuth SECRET_KEY = (ApiKeyAuth) defaultClient.getAuthentication("SECRET_KEY");
    SECRET_KEY.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //SECRET_KEY.setApiKeyPrefix("Token");

    MarginCrossAccountApi apiInstance = new MarginCrossAccountApi(defaultClient);
    try {
      ApiResponseResultOfVoid result = apiInstance.callVoid();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling MarginCrossAccountApi#callVoid");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
import com.bitget.openapi.ApiClient;
import com.bitget.openapi.ApiException;
import com.bitget.openapi.Configuration;
import com.bitget.openapi.auth.ApiKeyAuth;
import com.bitget.openapi.model.*;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;

public class Example {
    public static void main(String[] args) {        
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.bitget.com");

        ApiKeyAuth SECRET_KEY = (ApiKeyAuth) defaultClient.getAuthentication("SECRET_KEY");
        SECRET_KEY.setApiKey("your value");

        ApiKeyAuth ACCESS_KEY = (ApiKeyAuth) defaultClient.getAuthentication("ACCESS_KEY");
        ACCESS_KEY.setApiKey("your value");

        ApiKeyAuth ACCESS_PASSPHRASE = (ApiKeyAuth) defaultClient.getAuthentication("ACCESS_PASSPHRASE");
        ACCESS_PASSPHRASE.setApiKey("your value");

        MixOrderApi apiInstance = new MixOrderApi(defaultClient);
        MixPlaceOrderRequest req = new MixPlaceOrderRequest();
        req.setSymbol("BTCUSDT_UMCBL");
        req.setMarginCoin("USDT");
        req.setSide("open_long");
        req.setSize(BigDecimal.valueOf(0.01));
        req.setOrderType("market");
        req.setTimeInForceValue("normal");
        try {
            ApiResponseResultOfMixPlaceOrderResult result = apiInstance.placeOrder(req);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling MixOrderApi#placeOrder");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }

        try {
            ApiResponseResultOfMixDelegateOrderListResult result = apiInstance.historyProductType(
                    "umcbl",
                    "1671493129000",
                    "1673517445000",
                    "5", null, null);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling MixOrderApi#historyProductType");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.bitget.com

Class Method HTTP request Description
MarginCrossAccountApi callVoid GET /api/margin/v1/cross/account/void void
MarginCrossAccountApi marginCrossAccountAssets GET /api/margin/v1/cross/account/assets assets
MarginCrossAccountApi marginCrossAccountBorrow POST /api/margin/v1/cross/account/borrow borrow
MarginCrossAccountApi marginCrossAccountMaxBorrowableAmount POST /api/margin/v1/cross/account/maxBorrowableAmount maxBorrowableAmount
MarginCrossAccountApi marginCrossAccountMaxTransferOutAmount GET /api/margin/v1/cross/account/maxTransferOutAmount maxTransferOutAmount
MarginCrossAccountApi marginCrossAccountRepay POST /api/margin/v1/cross/account/repay repay
MarginCrossAccountApi marginCrossAccountRiskRate GET /api/margin/v1/cross/account/riskRate riskRate
MarginCrossBorrowApi crossLoanList GET /api/margin/v1/cross/loan/list list
MarginCrossFinflowApi crossFinList GET /api/margin/v1/cross/fin/list list
MarginCrossInterestApi crossInterestList GET /api/margin/v1/cross/interest/list list
MarginCrossLiquidationApi crossLiquidationList GET /api/margin/v1/cross/liquidation/list list
MarginCrossOrderApi marginCrossBatchCancelOrder POST /api/margin/v1/cross/order/batchCancelOrder batchCancelOrder
MarginCrossOrderApi marginCrossBatchPlaceOrder POST /api/margin/v1/cross/order/batchPlaceOrder batchPlaceOrder
MarginCrossOrderApi marginCrossCancelOrder POST /api/margin/v1/cross/order/cancelOrder cancelOrder
MarginCrossOrderApi marginCrossFills GET /api/margin/v1/cross/order/fills fills
MarginCrossOrderApi marginCrossHistoryOrders GET /api/margin/v1/cross/order/history history
MarginCrossOrderApi marginCrossOpenOrders GET /api/margin/v1/cross/order/openOrders openOrders
MarginCrossOrderApi marginCrossPlaceOrder POST /api/margin/v1/cross/order/placeOrder placeOrder
MarginCrossPublicApi marginCrossPublicInterestRateAndLimit GET /api/margin/v1/cross/public/interestRateAndLimit interestRateAndLimit
MarginCrossPublicApi marginCrossPublicTierData GET /api/margin/v1/cross/public/tierData tierData
MarginCrossRepayApi crossRepayList GET /api/margin/v1/cross/repay/list list
MarginIsolatedAccountApi marginIsolatedAccountAssets GET /api/margin/v1/isolated/account/assets assets
MarginIsolatedAccountApi marginIsolatedAccountBorrow POST /api/margin/v1/isolated/account/borrow borrow
MarginIsolatedAccountApi marginIsolatedAccountMaxBorrowableAmount POST /api/margin/v1/isolated/account/maxBorrowableAmount maxBorrowableAmount
MarginIsolatedAccountApi marginIsolatedAccountMaxTransferOutAmount GET /api/margin/v1/isolated/account/maxTransferOutAmount maxTransferOutAmount
MarginIsolatedAccountApi marginIsolatedAccountRepay POST /api/margin/v1/isolated/account/repay repay
MarginIsolatedAccountApi marginIsolatedAccountRiskRate POST /api/margin/v1/isolated/account/riskRate riskRate
MarginIsolatedBorrowApi isolatedLoanList GET /api/margin/v1/isolated/loan/list list
MarginIsolatedFinflowApi isolatedFinList GET /api/margin/v1/isolated/fin/list list
MarginIsolatedInterestApi isolatedInterestList GET /api/margin/v1/isolated/interest/list list
MarginIsolatedLiquidationApi isolatedLiquidationList GET /api/margin/v1/isolated/liquidation/list list
MarginIsolatedOrderApi marginIsolatedBatchCancelOrder POST /api/margin/v1/isolated/order/batchCancelOrder batchCancelOrder
MarginIsolatedOrderApi marginIsolatedBatchPlaceOrder POST /api/margin/v1/isolated/order/batchPlaceOrder batchPlaceOrder
MarginIsolatedOrderApi marginIsolatedCancelOrder POST /api/margin/v1/isolated/order/cancelOrder cancelOrder
MarginIsolatedOrderApi marginIsolatedFills GET /api/margin/v1/isolated/order/fills fills
MarginIsolatedOrderApi marginIsolatedHistoryOrders GET /api/margin/v1/isolated/order/history history
MarginIsolatedOrderApi marginIsolatedOpenOrders GET /api/margin/v1/isolated/order/openOrders openOrders
MarginIsolatedOrderApi marginIsolatedPlaceOrder POST /api/margin/v1/isolated/order/placeOrder placeOrder
MarginIsolatedPublicApi marginIsolatedPublicInterestRateAndLimit GET /api/margin/v1/isolated/public/interestRateAndLimit interestRateAndLimit
MarginIsolatedPublicApi marginIsolatedPublicTierData GET /api/margin/v1/isolated/public/tierData tierData
MarginIsolatedRepayApi isolateRepayList GET /api/margin/v1/isolated/repay/list list
MarginPublicApi marginPublicCurrencies GET /api/margin/v1/public/currencies currencies
P2pMerchantApi merchantAdvList GET /api/p2p/v1/merchant/advList advList
P2pMerchantApi merchantInfo GET /api/p2p/v1/merchant/merchantInfo merchantInfo
P2pMerchantApi merchantList GET /api/p2p/v1/merchant/merchantList merchantList
P2pMerchantApi merchantOrderList GET /api/p2p/v1/merchant/orderList orderList

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

ACCESS_KEY

  • Type: API key
  • API key parameter name: ACCESS-KEY
  • Location: HTTP header

ACCESS_PASSPHRASE

  • Type: API key
  • API key parameter name: ACCESS-PASSPHRASE
  • Location: HTTP header

ACCESS_SIGN

  • Type: API key
  • API key parameter name: ACCESS-SIGN
  • Location: HTTP header

ACCESS_TIMESTAMP

  • Type: API key
  • API key parameter name: ACCESS-TIMESTAMP
  • Location: HTTP header

SECRET_KEY

  • Type: API key
  • API key parameter name: SECRET-KEY
  • Location: HTTP header

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author