All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.bitrich.xchangestream.bitget.BitgetStreamingTradeService Maven / Gradle / Ivy

The newest version!
package info.bitrich.xchangestream.bitget;

import info.bitrich.xchangestream.bitget.dto.common.BitgetChannel.ChannelType;
import info.bitrich.xchangestream.bitget.dto.common.BitgetChannel.MarketType;
import info.bitrich.xchangestream.bitget.dto.response.BitgetWsUserTradeNotification;
import info.bitrich.xchangestream.core.StreamingTradeService;
import io.reactivex.rxjava3.core.Observable;
import lombok.AllArgsConstructor;
import org.knowm.xchange.currency.CurrencyPair;
import org.knowm.xchange.dto.trade.UserTrade;

@AllArgsConstructor
public class BitgetStreamingTradeService implements StreamingTradeService {

  private final BitgetStreamingService service;

  @Override
  public Observable getUserTrades(CurrencyPair currencyPair, Object... args) {
    return service
        .subscribeChannel(null, ChannelType.FILL, MarketType.SPOT, currencyPair)
        .map(BitgetWsUserTradeNotification.class::cast)
        .map(BitgetStreamingAdapters::toUserTrade);
  }

  @Override
  public Observable getUserTrades() {
    return getUserTrades(null);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy