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.int
Get the http connection timeout for the connection.int
Get the http read timeout for the connection.Get the override file for generating theExchangeMetaData
object.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.int
getPort()
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.boolean
By default, some meta data from the exchange is remotely loaded (if implemented).void
Set the API key.void
setExchangeDescription
(String exchangeDescription) Set the exchange description (e.g.void
setExchangeName
(String exchangeName) Set the exchange name (e.g.void
setExchangeSpecificParameters
(Map<String, Object> exchangeSpecificParameters) Set the arbitrary exchange-specific parameters to be passed to the exchange implementation.void
setExchangeSpecificParametersItem
(String key, Object value) Set an item in the arbitrary exchange-specific parameters to be passed to the exchange implementation.void
Set the host name of the server providing data.void
setHttpConnTimeout
(int milliseconds) Set the http connection timeout for the connection.void
setHttpReadTimeout
(int milliseconds) Set the http read timeout for the connection.void
setMetaDataJsonFileOverride
(String metaDataJsonFileOverride) Set the override file for generating theExchangeMetaData
object.void
setOverrideWebsocketApiUri
(String overrideWebsocketApiUri) Set uri to override websocket urivoid
setPassword
(String password) Set the password for authentication.void
setPlainTextUri
(String plainTextUri) Set the URI to reach the root of the exchange API for plaintext (non-SSL) queries (e.g.void
setPort
(int port) Set the port number of the server providing direct socket data (e.g.void
setProxyHost
(String proxyHost) Set the host name of the http proxy server.void
setProxyPort
(Integer proxyPort) Get the port of the http proxy server.void
void
setSecretKey
(String secretKey) Set the API secret key typically used in HMAC signing of requests.void
setShouldLoadRemoteMetaData
(boolean shouldLoadRemoteMetaData) By default, some meta data from the exchange is remotely loaded (if implemented).void
Set the URI to reach the root of the exchange API for SSL queries (e.g.void
setUserName
(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
Exchange
may 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 theExchangeMetaData
object. By default, theExchangeMetaData
object 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 theExchangeMetaData
object. By default, theExchangeMetaData
object 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
-