Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.bybit.api.client.impl.BybitApiAsyncUserRestClientImpl Maven / Gradle / Ivy
Go to download
The Official Java API connector for Bybit's HTTP and WebSocket APIs.
Dive into a plethora of functionalities:
- Market Data Retrieval
- Trade Execution
- Position Management
- Account and Asset Info Retrieval
- User and Upgrade Management
— Public Websocket Streaming
- Private Websocket Streaming
- Lending Institution and Client
- Broker Earning Data
package com.bybit.api.client.impl;
import com.bybit.api.client.restApi.BybitApiAsyncUserRestClient;
import com.bybit.api.client.restApi.BybitApiCallback;
import com.bybit.api.client.restApi.BybitApiService;
import com.bybit.api.client.domain.preupgrade.PreUpgradeDataRequest;
import com.bybit.api.client.domain.user.UserDataRequest;
import com.bybit.api.client.domain.user.request.UserSubMemberRequest;
import com.bybit.api.client.service.BybitJsonConverter;
import static com.bybit.api.client.constant.Helper.listToString;
import static com.bybit.api.client.service.BybitApiServiceGenerator.createService;
/**
* Implementation of Bybit's REST API using Retrofit with asynchronous/non-blocking method calls.
*/
public class BybitApiAsyncUserRestClientImpl implements BybitApiAsyncUserRestClient {
private final BybitApiService bybitApiService;
private final BybitJsonConverter converter = new BybitJsonConverter();
public BybitApiAsyncUserRestClientImpl(String apiKey, String secret, String baseUrl, boolean debugMode, long recvWindow, String logOption) {
bybitApiService = createService(BybitApiService.class, apiKey, secret, baseUrl, debugMode, recvWindow, logOption, "");
}
// pre upgrade endpoints
@Override
public void getPreUpgradeOrderHistory(PreUpgradeDataRequest request, BybitApiCallback callback) {
bybitApiService.getPreUpgradeOrderHistory(
request.getCategory().getCategoryTypeId(),
request.getSymbol(),
request.getBaseCoin(),
request.getOrderId(),
request.getOrderLinkId(),
request.getOrderFilter(),
request.getOrderStatus() == null ? null : request.getOrderStatus().getDescription(),
request.getStartTime(),
request.getEndTime(),
request.getLimit(),
request.getCursor()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getPreUpgradeTradeHistory(PreUpgradeDataRequest request, BybitApiCallback callback) {
bybitApiService.getPreUpgradeTradeHistory(
request.getCategory().getCategoryTypeId(),
request.getSymbol(),
request.getOrderId(),
request.getOrderLinkId(),
request.getBaseCoin(),
request.getStartTime(),
request.getEndTime(),
request.getExecType() == null ? null : request.getExecType().getExecTypeId(),
request.getLimit(),
request.getCursor()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getPreUpgradeClosePnl(PreUpgradeDataRequest request, BybitApiCallback callback) {
bybitApiService.getPreUpgradeClosePnl(
request.getCategory().getCategoryTypeId(),
request.getSymbol(),
request.getStartTime(),
request.getEndTime(),
request.getLimit(),
request.getCursor()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getPreUpgradeTransaction(PreUpgradeDataRequest request, BybitApiCallback callback) {
bybitApiService.getPreUpgradeTransaction(
request.getCategory().getCategoryTypeId(),
request.getBaseCoin(),
request.getTransactionType() == null ? null : request.getTransactionType().getTransactionTypeId(),
request.getStartTime(),
request.getEndTime(),
request.getLimit(),
request.getCursor()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getPreUpgradeOptionDelivery(PreUpgradeDataRequest request, BybitApiCallback callback) {
bybitApiService.getPreUpgradeOptionDelivery(
request.getCategory().getCategoryTypeId(),
request.getSymbol(),
request.getExpDate(),
request.getLimit(),
request.getCursor()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getPreUpgradeUsdcSettlement(PreUpgradeDataRequest request, BybitApiCallback callback) {
bybitApiService.getPreUpgradeUsdcSettlement(
request.getCategory().getCategoryTypeId(),
request.getSymbol(),
request.getLimit(),
request.getCursor()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
// User endpoints
@Override
public void createSubMember(UserDataRequest request, BybitApiCallback callback) {
UserSubMemberRequest subUserRequest = converter.mapToCreateSubMemberRequest(request);
bybitApiService.createSubMember(subUserRequest).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void createSubAPI(UserDataRequest request, BybitApiCallback callback) {
var createApiKeyRequest = converter.mapToCreateSubApiRequest(request);
bybitApiService.createSubAPI(createApiKeyRequest).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getSubUIDList(BybitApiCallback callback) {
bybitApiService.getSubUIDList().enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void freezeSubMember(UserDataRequest request, BybitApiCallback callback) {
var freezeSubUIDRquest = converter.mapToFreezeSubApiRequest(request);
bybitApiService.freezeSubMember(freezeSubUIDRquest).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getCurrentAPIKeyInfo(BybitApiCallback callback) {
bybitApiService.getCurrentAPIKeyInfo().enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getUIDWalletType(UserDataRequest request, BybitApiCallback callback) {
bybitApiService.getUIDWalletType(request.getMemberIds() == null ? null : listToString(request.getMemberIds())).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void modifyMasterApiKey(UserDataRequest userDataRequest, BybitApiCallback callback) {
var modifyMasterApiKeyRequest = converter.mapToModifyApiKeyRequest(userDataRequest);
bybitApiService.modifyMasterApiKey(modifyMasterApiKeyRequest).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void modifySubApiKey(UserDataRequest userDataRequest, BybitApiCallback callback) {
var modifySubApiKeyRequest = converter.mapToModifyApiKeyRequest(userDataRequest);
bybitApiService.modifySubApiKey(modifySubApiKeyRequest).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void deleteMasterApiKey(BybitApiCallback callback) {
bybitApiService.deleteMasterApiKey().enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void deleteSubApiKey(UserDataRequest userDataRequest, BybitApiCallback callback) {
var deleteSubApiKeyRequest = converter.mapToDeleteSubApiKeyRequest(userDataRequest);
bybitApiService.deleteSubApiKey(deleteSubApiKeyRequest).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getAffiliateUserInfo(UserDataRequest userDataRequest, BybitApiCallback callback) {
bybitApiService.getAffiliateUserInfo(userDataRequest.getUid()).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getSubUIDListUnlimited(UserDataRequest subUserRequest, BybitApiCallback callback) {
bybitApiService.getSubUIDListUnlimited(
subUserRequest.getPageSize(),
subUserRequest.getNextCursor()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getSubUIDListUnlimited(BybitApiCallback callback) {
bybitApiService.getSubUIDListUnlimited().enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getSubAccAllAPIKeyInfo(UserDataRequest subUserRequest, BybitApiCallback callback) {
bybitApiService.getSubAccAllAPIKeyInfo(
subUserRequest.getSubMemberId(),
subUserRequest.getLimit(),
subUserRequest.getCursor()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
}