Package info.bitrich.xchangestream.bybit
Class BybitStreamingTradeService
java.lang.Object
org.knowm.xchange.service.BaseExchangeService<BybitExchange>
org.knowm.xchange.service.BaseResilientExchangeService<BybitExchange>
org.knowm.xchange.bybit.service.BybitBaseService
info.bitrich.xchangestream.bybit.BybitStreamingTradeService
- All Implemented Interfaces:
StreamingTradeService
-
Field Summary
Fields inherited from class org.knowm.xchange.bybit.service.BybitBaseService
apiKey, bybit, bybitAuthenticated, signatureCreatorFields inherited from class org.knowm.xchange.service.BaseResilientExchangeService
resilienceRegistriesFields inherited from class org.knowm.xchange.service.BaseExchangeService
exchange -
Constructor Summary
ConstructorsConstructorDescriptionBybitStreamingTradeService(BybitUserDataStreamingService streamingService, BybitUserTradeStreamingService userTradeService, ResilienceRegistries resilienceRegistries, BybitExchange exchange) -
Method Summary
Modifier and TypeMethodDescriptionbatchCancelOrder(List<CancelOrderParams> params) batchChangeOrder(List<LimitOrder> orders) io.reactivex.rxjava3.core.Single<Integer> cancelOrder(CancelOrderParams params, Object... args) Cancels an existing order on the exchange.io.reactivex.rxjava3.core.Single<Integer> changeOrder(LimitOrder order, Object... args) Modifies an existing limit order on the exchange.io.reactivex.rxjava3.core.Observable<BybitComplexPositionChanges> getBybitPositionChanges(BybitCategory category) io.reactivex.rxjava3.core.Observable<BybitComplexOrderChanges> getComplexOrderChanges(BybitCategory category) io.reactivex.rxjava3.core.Observable<Order> getOrderChanges(CurrencyPair pair, Object... args) Get the changes of order state for the logged-in user.io.reactivex.rxjava3.core.Observable<Order> getOrderChanges(Instrument instrument, Object... args) io.reactivex.rxjava3.core.Observable<OpenPosition> getPositionChanges(BybitCategory category) io.reactivex.rxjava3.core.Single<Integer> placeLimitOrder(LimitOrder order, Object... args) Places a limit order on the exchange.io.reactivex.rxjava3.core.Single<Integer> placeMarketOrder(MarketOrder order, Object... args) Places a market order on the exchange.Methods inherited from class org.knowm.xchange.bybit.service.BybitBaseService
getAmendOrderRateLimiter, getBatchAmendOrderRateLimiter, getBatchCancelOrderRateLimiter, getCancelOrderRateLimiter, getCreateOrderRateLimiterMethods inherited from class org.knowm.xchange.service.BaseResilientExchangeService
decorateApiCall, rateLimiter, rateLimiter, retry, retryMethods inherited from class org.knowm.xchange.service.BaseExchangeService
verifyOrder, verifyOrder, verifyOrderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface info.bitrich.xchangestream.core.StreamingTradeService
getPositionChanges, getUserTrades, getUserTrades, getUserTrades
-
Constructor Details
-
BybitStreamingTradeService
public BybitStreamingTradeService(BybitUserDataStreamingService streamingService, BybitUserTradeStreamingService userTradeService, ResilienceRegistries resilienceRegistries, BybitExchange exchange)
-
-
Method Details
-
placeMarketOrder
public io.reactivex.rxjava3.core.Single<Integer> placeMarketOrder(MarketOrder order, Object... args) Description copied from interface:StreamingTradeServicePlaces a market order on the exchange. A market order is an order to buy or sell a financial instrument immediately at the best available current price. Specific exchanges may require additional optional parameters to process the market order.- Specified by:
placeMarketOrderin interfaceStreamingTradeService- Parameters:
order- The details of the market order, including the instrument, amount, and side (buy/sell).args- Optional additional arguments that may be required by specific exchanges.- Returns:
- A
Singlethat emits the operation result code, typically 0 for success.
-
placeLimitOrder
Description copied from interface:StreamingTradeServicePlaces a limit order on the exchange. A limit order specifies the price at which the user wants to buy or sell a financial instrument, potentially with additional optional parameters.- Specified by:
placeLimitOrderin interfaceStreamingTradeService- Parameters:
order- The details of the limit order, including instrument, price, volume, and side (buy/sell).args- Optional additional arguments that may be required by specific exchanges.- Returns:
- A
Singlethat emits the operation result code, typically 0 for success.
-
changeOrder
Description copied from interface:StreamingTradeServiceModifies an existing limit order on the exchange. This can include changes to the price, volume, or other adjustable parameters of the order, depending on the exchange's specific functionality and constraints.- Specified by:
changeOrderin interfaceStreamingTradeService- Parameters:
order- The limit order to be modified, including the updated details such as price or/and volume.args- Optional additional arguments that may be required by specific exchanges.- Returns:
- A
Singlethat emits the operation result code, typically 0 for success.
-
batchChangeOrder
-
cancelOrder
public io.reactivex.rxjava3.core.Single<Integer> cancelOrder(CancelOrderParams params, Object... args) Description copied from interface:StreamingTradeServiceCancels an existing order on the exchange. The operation requires specific parameters describing the order to be canceled, such as order ID or user reference ID.- Specified by:
cancelOrderin interfaceStreamingTradeService- Parameters:
params- An object implementingCancelOrderParamsthat contains order ID or user reference ID.args- Optional additional arguments that may be required by specific exchanges.- Returns:
- A
Singlethat emits the operation result code, typically 0 for success.
-
batchCancelOrder
public io.reactivex.rxjava3.core.Single<List<Integer>> batchCancelOrder(List<CancelOrderParams> params) -
getOrderChanges
public io.reactivex.rxjava3.core.Observable<Order> getOrderChanges(Instrument instrument, Object... args) - Specified by:
getOrderChangesin interfaceStreamingTradeService
-
getOrderChanges
public io.reactivex.rxjava3.core.Observable<Order> getOrderChanges(CurrencyPair pair, Object... args) Description copied from interface:StreamingTradeServiceGet the changes of order state for the logged-in user.Warning: there are currently no guarantees that messages will arrive in order, that messages will not be skipped, or that any initial state message will be sent on connection. Most exchanges have a recommended approach for managing this, involving timestamps, sequence numbers and a separate REST API for re-sync when inconsistencies appear. You should implement these approaches, if required, by combining calls to this method with
TradeService.getOpenOrders().Emits
NotConnectedExceptionWhen not connected to the WebSocket API.Immediately throws
ExchangeSecurityExceptionif called without authentication details- Specified by:
getOrderChangesin interfaceStreamingTradeService- Parameters:
pair- Currency pair of the order changes.- Returns:
Observablethat emitsOrderwhen exchange sends the update.
-
getComplexOrderChanges
public io.reactivex.rxjava3.core.Observable<BybitComplexOrderChanges> getComplexOrderChanges(BybitCategory category) -
getPositionChanges
public io.reactivex.rxjava3.core.Observable<OpenPosition> getPositionChanges(BybitCategory category) -
getBybitPositionChanges
public io.reactivex.rxjava3.core.Observable<BybitComplexPositionChanges> getBybitPositionChanges(BybitCategory category)
-