Class BaseExchange

java.lang.Object
org.knowm.xchange.BaseExchange
All Implemented Interfaces:
Exchange
Direct Known Subclasses:
BankeraExchange, BiboxExchange, BinanceExchange, BitbayExchange, BitbayExchange, BitcoinAverageExchange, BitcoinChartsExchange, BitcoinCoreWallet, BitcoindeExchange, BitcoindeExchange, BitcoiniumExchange, BitcointoyouExchange, BitfinexExchange, BitflyerExchange, BithumbExchange, BitmexExchange, BitsoExchange, BitstampExchange, BittrexExchange, BityExchange, BitZExchange, Bl3pExchange, BleutradeExchange, BlockchainExchange, BTCCExchange, BTCMarketsExchange, BTCTradeExchange, BTCTurkExchange, CCEXExchange, CexIOExchange, CmcExchange, CobinhoodExchange, CoinbaseExchange, CoinbaseExchange, CoinbaseProExchange, CoinbeneExchange, CoindealExchange, CoindirectExchange, CoinEggExchange, CoinexExchange, CoinfloorExchange, CoingiExchange, CoinjarExchange, CoinMarketCapExchange, CoinmateExchange, CoinoneExchange, CoinsuperExchange, CryptoFacilitiesExchange, CryptopiaExchange, CryptowatchExchange, DeribitExchange, DragonexExchange, DsxExchange, DVChainExchange, dydxExchange, EnigmaExchange, ExmoExchange, EXXExchange, FCoinExchange, FtxExchange, GateioExchange, GeminiExchange, GlobitexExchange, HitbtcExchange, HuobiExchange, IdexExchange, IndependentReserveExchange, ItBitExchange, KoineksExchange, KoinimExchange, KrakenExchange, KucoinExchange, KunaExchange, LakeBTCExchange, LatokenExchange, LgoExchange, LivecoinExchange, LunoExchange, LykkeExchange, MercadoBitcoinExchange, OERExchange, OkCoinExchange, OkexExchangeV3, ParibuExchange, PaymiumExchange, PoloniexExchange, QuoineExchange, RippleExchange, SerumExchange, SimulatedExchange, TheRockExchange, TradeOgreExchange, TrueFxExchange, UpbitExchange, VaultoroExchange, YoBitExchange, ZaifExchange

public abstract class BaseExchange
extends Object
implements Exchange
  • Field Details

  • Constructor Details

    • BaseExchange

      public BaseExchange()
  • Method Details

    • initServices

      protected abstract void initServices()
    • applySpecification

      public void applySpecification​(ExchangeSpecification exchangeSpecification)
      Description copied from interface: Exchange
      Applies any exchange specific parameters
      Specified by:
      applySpecification in interface Exchange
      Parameters:
      exchangeSpecification - The ExchangeSpecification
    • remoteInit

      public void remoteInit() throws IOException, ExchangeException
      Description copied from interface: Exchange
      Initialize this instance with the remote meta data. Most exchanges require this method to be called before Exchange.getExchangeMetaData(). Some exchanges require it before using some of their services.
      Specified by:
      remoteInit in interface Exchange
      Throws:
      IOException
      ExchangeException
    • getNonceFactory

      public si.mazi.rescu.SynchronizedValueFactory<Long> getNonceFactory()
      Description copied from interface: Exchange
      The nonce factory used to create a nonce value. Allows services to accept a placeholder that is replaced with generated value just before message is serialized and sent. If a method of a rest accepts ValueFactory as a parameter, it's evaluated, the message is serialized and sent in a single synchronized block.
      Specified by:
      getNonceFactory in interface Exchange
      Returns:
      Synchronized value factory
    • loadExchangeMetaData

      protected void loadExchangeMetaData​(InputStream is)
    • loadMetaData

      protected <T> T loadMetaData​(InputStream is, Class<T> type)
    • getExchangeSymbols

      public List<CurrencyPair> getExchangeSymbols()
      Description copied from interface: Exchange
      Returns a list of CurrencyPair objects. This list can either come originally from a loaded json file or from a remote call if the implementation override's the `remoteInit` method.
      Specified by:
      getExchangeSymbols in interface Exchange
      Returns:
      The exchange's symbols
    • getMetaDataFileName

      public String getMetaDataFileName​(ExchangeSpecification exchangeSpecification)
    • getExchangeSpecification

      public ExchangeSpecification getExchangeSpecification()
      Specified by:
      getExchangeSpecification in interface Exchange
      Returns:
      The ExchangeSpecification in use for this exchange
    • getExchangeMetaData

      public ExchangeMetaData getExchangeMetaData()
      Description copied from interface: Exchange
      The Meta Data defining some semi-static properties of an exchange such as currency pairs, trading fees, etc.
      Specified by:
      getExchangeMetaData in interface Exchange
      Returns:
      The exchange's meta data
    • getMarketDataService

      public MarketDataService getMarketDataService()
      Description copied from interface: Exchange
      A market data service typically consists of a regularly updated list of the available prices for the various symbols

      This is the non-streaming (blocking) version of the service

      Specified by:
      getMarketDataService in interface Exchange
      Returns:
      The exchange's market data service
    • getTradeService

      public TradeService getTradeService()
      Description copied from interface: Exchange
      An trade service typically provides access to trading functionality

      Typically access is restricted by a secret API key and/or username password authentication which are usually provided in the ExchangeSpecification

      Specified by:
      getTradeService in interface Exchange
      Returns:
      The exchange's trade service
    • getAccountService

      public AccountService getAccountService()
      Description copied from interface: Exchange
      An account service typically provides access to the user's private exchange data

      Typically access is restricted by a secret API key and/or username password authentication which are usually provided in the ExchangeSpecification

      Specified by:
      getAccountService in interface Exchange
      Returns:
      The exchange's account service
    • toString

      public String toString()
      Overrides:
      toString in class Object