Package org.knowm.xchange
Class ExchangeSpecification
java.lang.Object
org.knowm.xchange.ExchangeSpecification
- Direct Known Subclasses:
IdexExchangeSpecification
Specification to provide the following to
ExchangeFactory:
- Provision of required exchangeSpecificParameters for creating an
Exchange - Provision of optional exchangeSpecificParameters for additional configuration
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionExchangeSpecification(Class<? extends Exchange> exchangeClass) Static bindingExchangeSpecification(String exchangeClassName) Deprecated.use constructor with exchange class for better performance -
Method Summary
Modifier and TypeMethodDescriptionGet the API key.Deprecated.use getExchangeClassGet the exchange description (e.g.Get the exchange name.Get the arbitrary exchange-specific parameters to be passed to the exchange implementation.Get an item from the arbitrary exchange-specific parameters to be passed to the exchange implementation.getHost()Get the host name of the server providing data (e.g.intGet the http connection timeout for the connection.intGet the http read timeout for the connection.Get the override file for generating theExchangeMetaDataobject.Get uri to override websocket urigetParameter(String key) Get the password for authentication.Get the URI to reach the root of the exchange API for plaintext (non-SSL) queries (e.g.intgetPort()Get the port number of the server providing direct socket data (e.g.Get the host name of the http proxy server (e.g.Get the port of the http proxy server (e.g.Get the API secret key typically used in HMAC signing of requests.Get the URI to reach the root of the exchange API for SSL queries (e.g.Get the username for authentication.booleanBy default, some meta data from the exchange is remotely loaded (if implemented).voidSet the API key.voidsetExchangeDescription(String exchangeDescription) Set the exchange description (e.g.voidsetExchangeName(String exchangeName) Set the exchange name (e.g.voidsetExchangeSpecificParameters(Map<String, Object> exchangeSpecificParameters) Set the arbitrary exchange-specific parameters to be passed to the exchange implementation.voidsetExchangeSpecificParametersItem(String key, Object value) Set an item in the arbitrary exchange-specific parameters to be passed to the exchange implementation.voidSet the host name of the server providing data.voidsetHttpConnTimeout(int milliseconds) Set the http connection timeout for the connection.voidsetHttpReadTimeout(int milliseconds) Set the http read timeout for the connection.voidsetMetaDataJsonFileOverride(String metaDataJsonFileOverride) Set the override file for generating theExchangeMetaDataobject.voidsetOverrideWebsocketApiUri(String overrideWebsocketApiUri) Set uri to override websocket urivoidsetPassword(String password) Set the password for authentication.voidsetPlainTextUri(String plainTextUri) Set the URI to reach the root of the exchange API for plaintext (non-SSL) queries (e.g.voidsetPort(int port) Set the port number of the server providing direct socket data (e.g.voidsetProxyHost(String proxyHost) Set the host name of the http proxy server.voidsetProxyPort(Integer proxyPort) Get the port of the http proxy server.voidvoidsetSecretKey(String secretKey) Set the API secret key typically used in HMAC signing of requests.voidsetShouldLoadRemoteMetaData(boolean shouldLoadRemoteMetaData) By default, some meta data from the exchange is remotely loaded (if implemented).voidSet the URI to reach the root of the exchange API for SSL queries (e.g.voidsetUserName(String userName) Set the username for authentication.
-
Constructor Details
-
ExchangeSpecification
Deprecated.use constructor with exchange class for better performanceDynamic binding- Parameters:
exchangeClassName- The exchange class name (e.g. "org.knowm.xchange.mtgox.v1.MtGoxExchange")
-
ExchangeSpecification
Static binding- Parameters:
exchangeClass- The exchange class
-
-
Method Details
-
getExchangeClass
- Returns:
- The exchange class for loading at runtime
-
getExchangeClassName
Deprecated.use getExchangeClass- Returns:
- The exchange class name for loading at runtime
-
getParameter
- Parameters:
key- The key into the parameter map (recommend using the provided standard static entries)- Returns:
- Any additional exchangeSpecificParameters that the
Exchangemay consume to configure services
-
getHost
Get the host name of the server providing data (e.g. "mtgox.com").- Returns:
- the host name
-
setHost
Set the host name of the server providing data.- Parameters:
host- the host name
-
getProxyHost
Get the host name of the http proxy server (e.g. "proxy.com").- Returns:
- the proxy host name
-
setProxyHost
Set the host name of the http proxy server.- Parameters:
proxyHost- the proxy host name
-
getProxyPort
Get the port of the http proxy server (e.g. "80").- Returns:
- the http proxy port
-
setProxyPort
Get the port of the http proxy server.- Parameters:
proxyPort- the host name
-
getApiKey
Get the API key. For MtGox this would be the "Rest-Key" field.- Returns:
- the API key
-
setApiKey
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
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
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
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
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
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
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
Get the arbitrary exchange-specific parameters to be passed to the exchange implementation.- Returns:
- a Map of named exchange-specific parameter values
-
setExchangeSpecificParameters
Set the arbitrary exchange-specific parameters to be passed to the exchange implementation.- Parameters:
exchangeSpecificParameters- a Map of named exchange-specific parameter values
-
getExchangeSpecificParametersItem
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
Set an item in the arbitrary exchange-specific parameters to be passed to the exchange implementation. -
getPassword
Get the password for authentication.- Returns:
- the password
-
setPassword
Set the password for authentication.- Parameters:
password- the password
-
getUserName
Get the username for authentication.- Returns:
- the username
-
setUserName
Set the username for authentication.- Parameters:
userName- the username
-
getExchangeName
Get the exchange name.- Returns:
- the exchange name (e.g. "Mt Gox")
-
setExchangeName
Set the exchange name (e.g. "Mt Gox").- Parameters:
exchangeName- the exchange name
-
getExchangeDescription
Get the exchange description (e.g. "Major exchange specialising in USD, EUR, GBP").- Returns:
- the exchange description
-
setExchangeDescription
Set the exchange description (e.g. "Major exchange specialising in USD, EUR, GBP").- Parameters:
exchangeDescription- the exchange description
-
getResilience
-
setResilience
-
getMetaDataJsonFileOverride
Get the override file for generating theExchangeMetaDataobject. By default, theExchangeMetaDataobject is loaded at startup from a json file on the classpath with the same name as the name of the exchange as defined inExchangeSpecification. With this parameter, you can override that file with a file of your choice located outside of the classpath.- Returns:
-
setMetaDataJsonFileOverride
Set the override file for generating theExchangeMetaDataobject. By default, theExchangeMetaDataobject is loaded at startup from a json file on the classpath with the same name as the name of the exchange as defined inExchangeSpecification. 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
Get uri to override websocket uri- Returns:
- The uri that will be used instead of standard exchange websocket uri
-
setOverrideWebsocketApiUri
Set uri to override websocket uri- Parameters:
overrideWebsocketApiUri- The uri that will be used instead of standard exchange websocket uris
-