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

info.bitrich.xchangestream.gateio.GateioStreamingAccountService Maven / Gradle / Ivy

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

import info.bitrich.xchangestream.core.StreamingAccountService;
import info.bitrich.xchangestream.gateio.config.Config;
import info.bitrich.xchangestream.gateio.dto.response.balance.GateioSingleSpotBalanceNotification;
import io.reactivex.rxjava3.core.Observable;
import org.knowm.xchange.currency.Currency;
import org.knowm.xchange.dto.account.Balance;

public class GateioStreamingAccountService implements StreamingAccountService {

  private final GateioStreamingService service;

  public GateioStreamingAccountService(GateioStreamingService service) {
    this.service = service;
  }

  @Override
  public Observable getBalanceChanges(Currency currency, Object... args) {
    return service
        .subscribeChannel(Config.SPOT_BALANCES_CHANNEL)
        .map(GateioSingleSpotBalanceNotification.class::cast)
        .filter(
            notification ->
                (currency == null) || (notification.getResult().getCurrency().equals(currency)))
        .map(GateioStreamingAdapters::toBalance);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy