Class BinanceMarketDataService

All Implemented Interfaces:
BaseService, MarketDataService

public class BinanceMarketDataService extends BinanceMarketDataServiceRaw implements MarketDataService
  • Constructor Details

  • Method Details

    • getTrades

      public Trades getTrades(Instrument instrument, Object... args) throws IOException
      optional parameters provided in the args array:
      • 0: Long fromId optional, ID to get aggregate trades from INCLUSIVE.
      • 1: Long startTime optional, Timestamp in ms to get aggregate trades from INCLUSIVE.
      • 2: Long endTime optional, Timestamp in ms to get aggregate trades until INCLUSIVE.
      • 3: Integer limit optional, Default 500; max 500.

      Specified by:
      getTrades in interface MarketDataService
      Parameters:
      args - Optional arguments. Exchange-specific
      Returns:
      The Trades, null if some sort of error occurred. Implementers should log the error.
      Throws:
      IOException - - Indication that a networking error occurred while fetching JSON data
    • getTicker

      public Ticker getTicker(Instrument instrument, Object... args) throws IOException
      Description copied from interface: MarketDataService
      Get a ticker representing the current exchange rate
      Specified by:
      getTicker in interface MarketDataService
      Returns:
      The Ticker, null if some sort of error occurred. Implementers should log the error.
      Throws:
      IOException - - Indication that a networking error occurred while fetching JSON data
    • getOrderBook

      public OrderBook getOrderBook(Instrument instrument, Object... args) throws IOException
      Description copied from interface: MarketDataService
      Get an order book representing the current offered exchange rates (market depth)
      Specified by:
      getOrderBook in interface MarketDataService
      Parameters:
      args - Optional arguments. Exchange-specific
      Returns:
      The OrderBook, null if some sort of error occurred. Implementers should log the error.
      Throws:
      IOException - - Indication that a networking error occurred while fetching JSON data
    • getFundingRates

      public FundingRates getFundingRates() throws IOException
      Description copied from interface: MarketDataService
      Get the FundingRates for all perpetual contracts of the platform.
      Specified by:
      getFundingRates in interface MarketDataService
      Returns:
      The FundingRates, null if some sort of error occurred. Implementers should log the error.
      Throws:
      IOException - - Indication that a networking error occurred while fetching JSON data
    • getFundingRate

      public FundingRate getFundingRate(Instrument instrument) throws IOException
      Description copied from interface: MarketDataService
      Get the FundingRate for specific instrument.
      Specified by:
      getFundingRate in interface MarketDataService
      Parameters:
      instrument - Instrument to get the funding rate.
      Returns:
      The FundingRate, null if some sort of error occurred. Implementers should log the error.
      Throws:
      IOException - - Indication that a networking error occurred while fetching JSON data
    • convertOrderBook

      public static OrderBook convertOrderBook(BinanceOrderbook ob, Instrument pair)