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.BybitApiMarketAsyncRestClientImpl 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.BybitApiAsyncMarketDataRestClient;
import com.bybit.api.client.restApi.BybitApiCallback;
import com.bybit.api.client.restApi.BybitApiService;
import com.bybit.api.client.domain.market.request.MarketDataRequest;
import static com.bybit.api.client.service.BybitApiServiceGenerator.createService;
public class BybitApiMarketAsyncRestClientImpl implements BybitApiAsyncMarketDataRestClient {
private final BybitApiService bybitApiService;
public BybitApiMarketAsyncRestClientImpl(String baseUrl, boolean debugMode, long recvWindow, String logOption) {
bybitApiService = createService(BybitApiService.class, baseUrl, debugMode, recvWindow, logOption);
}
// Market Data endpoints
@Override
public void getServerTime(BybitApiCallback callback) {
bybitApiService.getServerTime().enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getMarketLinesData(MarketDataRequest marketKlineRequest, BybitApiCallback callback) {
bybitApiService.getMarketLinesData(
marketKlineRequest.getCategory().getCategoryTypeId(),
marketKlineRequest.getSymbol(),
marketKlineRequest.getMarketInterval() == null ? null : marketKlineRequest.getMarketInterval().getIntervalId(),
marketKlineRequest.getStart(),
marketKlineRequest.getEnd(),
marketKlineRequest.getLimit()).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getMarketPriceLinesData(MarketDataRequest marketKlineRequest, BybitApiCallback callback) {
bybitApiService.getMarketPriceLinesData(
marketKlineRequest.getCategory().getCategoryTypeId(),
marketKlineRequest.getSymbol(),
marketKlineRequest.getMarketInterval() == null ? null : marketKlineRequest.getMarketInterval().getIntervalId(),
marketKlineRequest.getStart(),
marketKlineRequest.getEnd(),
marketKlineRequest.getLimit()).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getIndexPriceLinesData(MarketDataRequest marketKlineRequest, BybitApiCallback callback) {
bybitApiService.getIndexPriceLinesData(
marketKlineRequest.getCategory().getCategoryTypeId(),
marketKlineRequest.getSymbol(),
marketKlineRequest.getMarketInterval() == null ? null : marketKlineRequest.getMarketInterval().getIntervalId(),
marketKlineRequest.getStart(),
marketKlineRequest.getEnd(),
marketKlineRequest.getLimit()).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getPremiumIndexPriceLinesData(MarketDataRequest marketKlineRequest, BybitApiCallback callback) {
bybitApiService.getPremiumIndexPriceLinesData(
marketKlineRequest.getCategory().getCategoryTypeId(),
marketKlineRequest.getSymbol(),
marketKlineRequest.getMarketInterval() == null ? null : marketKlineRequest.getMarketInterval().getIntervalId(),
marketKlineRequest.getStart(),
marketKlineRequest.getEnd(),
marketKlineRequest.getLimit()).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getInstrumentsInfo(MarketDataRequest instrumentInfoRequest, BybitApiCallback callback) {
bybitApiService.getInstrumentsInfo(
instrumentInfoRequest.getCategory().getCategoryTypeId(),
instrumentInfoRequest.getSymbol(),
instrumentInfoRequest.getInstrumentStatus() == null ? null : instrumentInfoRequest.getInstrumentStatus().getStatus(),
instrumentInfoRequest.getBaseCoin(),
instrumentInfoRequest.getLimit(),
instrumentInfoRequest.getCursor()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getMarketOrderBook(MarketDataRequest marketOrderBookRequest, BybitApiCallback callback) {
bybitApiService.getMarketOrderBook(
marketOrderBookRequest.getCategory().getCategoryTypeId(),
marketOrderBookRequest.getSymbol(),
marketOrderBookRequest.getLimit()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getMarketTickers(MarketDataRequest marketDataTickerRequest, BybitApiCallback callback) {
bybitApiService.getMarketTickers(
marketDataTickerRequest.getCategory().getCategoryTypeId(),
marketDataTickerRequest.getSymbol(),
marketDataTickerRequest.getBaseCoin(),
marketDataTickerRequest.getExpDate()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getFundingHistory(MarketDataRequest fundingHistoryRequest, BybitApiCallback callback) {
bybitApiService.getFundingHistory(
fundingHistoryRequest.getCategory().getCategoryTypeId(),
fundingHistoryRequest.getSymbol(),
fundingHistoryRequest.getStartTime(),
fundingHistoryRequest.getEndTime(),
fundingHistoryRequest.getLimit()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getRecentTradeData(MarketDataRequest recentTradeRequest, BybitApiCallback callback) {
bybitApiService.getRecentTradeData(
recentTradeRequest.getCategory().getCategoryTypeId(),
recentTradeRequest.getSymbol(),
recentTradeRequest.getBaseCoin(),
recentTradeRequest.getOptionType() == null ? null : recentTradeRequest.getOptionType().getOpType(),
recentTradeRequest.getLimit()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getOpenInterest(MarketDataRequest openInterestRequest, BybitApiCallback callback) {
bybitApiService.getOpenInterest(
openInterestRequest.getCategory().getCategoryTypeId(),
openInterestRequest.getSymbol(),
openInterestRequest.getMarketInterval() == null ? null : openInterestRequest.getMarketInterval().getIntervalId(),
openInterestRequest.getStartTime(),
openInterestRequest.getEndTime(),
openInterestRequest.getLimit(),
openInterestRequest.getCursor()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getHistoricalVolatility(MarketDataRequest historicalVolatilityRequest, BybitApiCallback callback) {
bybitApiService.getHistoricalVolatility(
historicalVolatilityRequest.getCategory().getCategoryTypeId(),
historicalVolatilityRequest.getBaseCoin(),
historicalVolatilityRequest.getOptionPeriod(),
historicalVolatilityRequest.getStartTime(),
historicalVolatilityRequest.getEndTime()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getInsurance(MarketDataRequest marketDataRequest, BybitApiCallback callback) {
bybitApiService.getInsurance(marketDataRequest.getCoin()).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getInsurance(BybitApiCallback callback) {
bybitApiService.getInsurance().enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getRiskLimit(MarketDataRequest marketRiskLimitRequest, BybitApiCallback callback) {
bybitApiService.getRiskLimit(
marketRiskLimitRequest.getCategory().getCategoryTypeId(),
marketRiskLimitRequest.getSymbol()
).
enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getDeliveryPrice(MarketDataRequest deliveryPriceRequest, BybitApiCallback callback) {
bybitApiService.getDeliveryPrice(deliveryPriceRequest.getCategory().getCategoryTypeId(),
deliveryPriceRequest.getSymbol(),
deliveryPriceRequest.getBaseCoin(),
deliveryPriceRequest.getLimit(),
deliveryPriceRequest.getCursor()).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getMarketAccountRatio(MarketDataRequest marketAccountRatioRequest, BybitApiCallback callback) {
bybitApiService.getMarketAccountRatio(marketAccountRatioRequest.getCategory().getCategoryTypeId(),
marketAccountRatioRequest.getSymbol(),
marketAccountRatioRequest.getDataRecordingPeriod() == null ? null : marketAccountRatioRequest.getDataRecordingPeriod().getPeriod(),
marketAccountRatioRequest.getLimit()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
@Override
public void getAnnouncementInfo(MarketDataRequest announcementInfoRequest, BybitApiCallback callback) {
bybitApiService.getAnouncementInfo(
announcementInfoRequest.getLocale() == null ? null : announcementInfoRequest.getLocale().getLanguageSymbol(),
announcementInfoRequest.getType() == null ? null : announcementInfoRequest.getType().getAnnouncementType(),
announcementInfoRequest.getTag() == null ? null : announcementInfoRequest.getTag().getEnglishTranslation(),
announcementInfoRequest.getPage(),
announcementInfoRequest.getLimit()
).enqueue(new BybitApiCallbackAdapter<>(callback));
}
}