Class ExchangeSpecification

java.lang.Object
org.knowm.xchange.ExchangeSpecification
Direct Known Subclasses:
IdexExchangeSpecification

public class ExchangeSpecification
extends Object
Specification to provide the following to ExchangeFactory:
  • Provision of required exchangeSpecificParameters for creating an Exchange
  • Provision of optional exchangeSpecificParameters for additional configuration
  • Constructor Details

    • ExchangeSpecification

      @Deprecated public ExchangeSpecification​(String exchangeClassName)
      Deprecated.
      use constructor with exchange class for better performance
      Dynamic binding
      Parameters:
      exchangeClassName - The exchange class name (e.g. "org.knowm.xchange.mtgox.v1.MtGoxExchange")
    • ExchangeSpecification

      public ExchangeSpecification​(Class<? extends Exchange> exchangeClass)
      Static binding
      Parameters:
      exchangeClass - The exchange class
  • Method Details

    • getExchangeClass

      public Class<? extends Exchange> getExchangeClass()
      Returns:
      The exchange class for loading at runtime
    • getExchangeClassName

      @Deprecated public String getExchangeClassName()
      Deprecated.
      use getExchangeClass
      Returns:
      The exchange class name for loading at runtime
    • getParameter

      public Object getParameter​(String key)
      Parameters:
      key - The key into the parameter map (recommend using the provided standard static entries)
      Returns:
      Any additional exchangeSpecificParameters that the Exchange may consume to configure services
    • getHost

      public String getHost()
      Get the host name of the server providing data (e.g. "mtgox.com").
      Returns:
      the host name
    • setHost

      public void setHost​(String host)
      Set the host name of the server providing data.
      Parameters:
      host - the host name
    • getProxyHost

      public String getProxyHost()
      Get the host name of the http proxy server (e.g. "proxy.com").
      Returns:
      the proxy host name
    • setProxyHost

      public void setProxyHost​(String proxyHost)
      Set the host name of the http proxy server.
      Parameters:
      proxyHost - the proxy host name
    • getProxyPort

      public Integer getProxyPort()
      Get the port of the http proxy server (e.g. "80").
      Returns:
      the http proxy port
    • setProxyPort

      public void setProxyPort​(Integer proxyPort)
      Get the port of the http proxy server.
      Parameters:
      proxyPort - the host name
    • getApiKey

      public String getApiKey()
      Get the API key. For MtGox this would be the "Rest-Key" field.
      Returns:
      the API key
    • setApiKey

      public void setApiKey​(String apiKey)
      Set the API key. For MtGox this would be the "Rest-Key" field.
      Parameters:
      apiKey - the API key
    • getPort

      public int getPort()
      Get the port number of the server providing direct socket data (e.g. "1337").
      Returns:
      the port number
    • setPort

      public void setPort​(int port)
      Set the port number of the server providing direct socket data (e.g. "1337").
      Parameters:
      port - the port number
    • getHttpConnTimeout

      public int getHttpConnTimeout()
      Get the http connection timeout for the connection. If the default value of zero is returned then the default rescu timeout will be applied. Check the exchange code to see if this option has been implemented.
      Returns:
      the http read timeout in milliseconds
    • setHttpConnTimeout

      public void setHttpConnTimeout​(int milliseconds)
      Set the http connection timeout for the connection. If not supplied the default rescu timeout will be used. Check the exchange code to see if this option has been implemented. (This value can also be set globally in "rescu.properties" by setting the property "rescu.http.connTimeoutMillis".)
      Parameters:
      milliseconds - the http read timeout in milliseconds
    • getHttpReadTimeout

      public int getHttpReadTimeout()
      Get the http read timeout for the connection. If the default value of zero is returned then the default rescu timeout will be applied. Check the exchange code to see if this option has been implemented.
      Returns:
      the http read timeout in milliseconds
    • setHttpReadTimeout

      public void setHttpReadTimeout​(int milliseconds)
      Set the http read timeout for the connection. If not supplied the default rescu timeout will be used. Check the exchange code to see if this option has been implemented. (This value can also be set globally in "rescu.properties" by setting the property "rescu.http.readTimeoutMillis".)
      Parameters:
      milliseconds - the http read timeout in milliseconds
    • getSecretKey

      public String getSecretKey()
      Get the API secret key typically used in HMAC signing of requests. For MtGox this would be the "Rest-Sign" field.
      Returns:
      the secret key
    • setSecretKey

      public void setSecretKey​(String secretKey)
      Set the API secret key typically used in HMAC signing of requests. For MtGox this would be the "Rest-Sign" field.
      Parameters:
      secretKey - the secret key
    • getSslUri

      public String getSslUri()
      Get the URI to reach the root of the exchange API for SSL queries (e.g. use "https://example.com:8443/exchange", not "https://example.com:8443/exchange/api/v3/trades").
      Returns:
      the SSL URI
    • setSslUri

      public void setSslUri​(String uri)
      Set the URI to reach the root of the exchange API for SSL queries (e.g. use "https://example.com:8443/exchange", not "https://example.com:8443/exchange/api/v3/trades").
      Parameters:
      uri - the SSL URI
    • getPlainTextUri

      public String getPlainTextUri()
      Get the URI to reach the root of the exchange API for plaintext (non-SSL) queries (e.g. use "http://example.com:8080/exchange", not "http://example.com:8080/exchange/api/v3/trades")
      Returns:
      the plain text URI
    • setPlainTextUri

      public void setPlainTextUri​(String plainTextUri)
      Set the URI to reach the root of the exchange API for plaintext (non-SSL) queries (e.g. use "http://example.com:8080/exchange", not "http://example.com:8080/exchange/api/v3/trades")
      Parameters:
      plainTextUri - the plain text URI
    • getExchangeSpecificParameters

      public Map<String,​Object> getExchangeSpecificParameters()
      Get the arbitrary exchange-specific parameters to be passed to the exchange implementation.
      Returns:
      a Map of named exchange-specific parameter values
    • setExchangeSpecificParameters

      public void setExchangeSpecificParameters​(Map<String,​Object> exchangeSpecificParameters)
      Set the arbitrary exchange-specific parameters to be passed to the exchange implementation.
      Parameters:
      exchangeSpecificParameters - a Map of named exchange-specific parameter values
    • getExchangeSpecificParametersItem

      public Object getExchangeSpecificParametersItem​(String key)
      Get an item from the arbitrary exchange-specific parameters to be passed to the exchange implementation.
      Returns:
      a Map of named exchange-specific parameter values
    • setExchangeSpecificParametersItem

      public void setExchangeSpecificParametersItem​(String key, Object value)
      Set an item in the arbitrary exchange-specific parameters to be passed to the exchange implementation.
    • getPassword

      public String getPassword()
      Get the password for authentication.
      Returns:
      the password
    • setPassword

      public void setPassword​(String password)
      Set the password for authentication.
      Parameters:
      password - the password
    • getUserName

      public String getUserName()
      Get the username for authentication.
      Returns:
      the username
    • setUserName

      public void setUserName​(String userName)
      Set the username for authentication.
      Parameters:
      userName - the username
    • getExchangeName

      public String getExchangeName()
      Get the exchange name.
      Returns:
      the exchange name (e.g. "Mt Gox")
    • setExchangeName

      public void setExchangeName​(String exchangeName)
      Set the exchange name (e.g. "Mt Gox").
      Parameters:
      exchangeName - the exchange name
    • getExchangeDescription

      public String getExchangeDescription()
      Get the exchange description (e.g. "Major exchange specialising in USD, EUR, GBP").
      Returns:
      the exchange description
    • setExchangeDescription

      public void setExchangeDescription​(String exchangeDescription)
      Set the exchange description (e.g. "Major exchange specialising in USD, EUR, GBP").
      Parameters:
      exchangeDescription - the exchange description
    • getResilience

    • setResilience

      public void setResilience​(ExchangeSpecification.ResilienceSpecification resilience)
    • getMetaDataJsonFileOverride

      public String getMetaDataJsonFileOverride()
      Get the override file for generating the ExchangeMetaData object. By default, the ExchangeMetaData object is loaded at startup from a json file on the classpath with the same name as the name of the exchange as defined in ExchangeSpecification. With this parameter, you can override that file with a file of your choice located outside of the classpath.
      Returns:
    • setMetaDataJsonFileOverride

      public void setMetaDataJsonFileOverride​(String metaDataJsonFileOverride)
      Set the override file for generating the ExchangeMetaData object. By default, the ExchangeMetaData object is loaded at startup from a json file on the classpath with the same name as the name of the exchange as defined in ExchangeSpecification. With this parameter, you can override that file with a file of your choice located outside of the classpath.
    • isShouldLoadRemoteMetaData

      public boolean isShouldLoadRemoteMetaData()
      By default, some meta data from the exchange is remotely loaded (if implemented).
      Returns:
    • setShouldLoadRemoteMetaData

      public void setShouldLoadRemoteMetaData​(boolean shouldLoadRemoteMetaData)
      By default, some meta data from the exchange is remotely loaded (if implemented). Here you can set this default behavior.
      Parameters:
      shouldLoadRemoteMetaData -
    • getOverrideWebsocketApiUri

      public String getOverrideWebsocketApiUri()
      Get uri to override websocket uri
      Returns:
      The uri that will be used instead of standard exchange websocket uri
    • setOverrideWebsocketApiUri

      public void setOverrideWebsocketApiUri​(String overrideWebsocketApiUri)
      Set uri to override websocket uri
      Parameters:
      overrideWebsocketApiUri - The uri that will be used instead of standard exchange websocket uris