Package com.longport
Class ConfigBuilder
- java.lang.Object
-
- com.longport.ConfigBuilder
-
public class ConfigBuilder extends Object
A Config object builder
-
-
Constructor Summary
Constructors Constructor Description ConfigBuilder(String appKey, String appSecret, String accessToken)Create a `Config` object builder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Configbuild()Build a Config objectConfigBuilderdontPrintQuotePackages()Don't print quote packages when connected to the serverConfigBuilderenableOvernight()Enable overnight quoteConfigBuilderhttpUrl(String httpUrl)Specifies the url of the OpenAPI server.ConfigBuilderlanguage(Language language)Specifies the language identiferConfigBuilderlogPath(String path)Set the path of the log files.ConfigBuilderpushCandlestickMode(PushCandlestickMode mode)Specifies the push candlestick modeConfigBuilderquoteWebsocketUrl(String quoteWsUrl)Specifies the url of the OpenAPI quote websocket server.ConfigBuildertradeWebsocketUrl(String tradeWsUrl)Specifies the url of the OpenAPI trade websocket server.
-
-
-
Method Detail
-
httpUrl
public ConfigBuilder httpUrl(String httpUrl)
Specifies the url of the OpenAPI server.NOTE: Usually you don’t need to change it.
- Parameters:
httpUrl- OpenAPI endpoint (Default: `https://openapi.longportapp.com`)- Returns:
- this object
-
quoteWebsocketUrl
public ConfigBuilder quoteWebsocketUrl(String quoteWsUrl)
Specifies the url of the OpenAPI quote websocket server.NOTE: Usually you don’t need to change it.
- Parameters:
quoteWsUrl- OpenAPI quote websocket endpoint (Default: `wss://openapi-quote.longportapp.com`)- Returns:
- this object
-
tradeWebsocketUrl
public ConfigBuilder tradeWebsocketUrl(String tradeWsUrl)
Specifies the url of the OpenAPI trade websocket server.NOTE: Usually you don’t need to change it.
- Parameters:
tradeWsUrl- OpenAPI trade websocket endpoint (Default: `wss://openapi-quote.longportapp.com`)- Returns:
- this object
-
language
public ConfigBuilder language(Language language)
Specifies the language identifer- Parameters:
language- Language identifer (Default: Language.EN)- Returns:
- this object
-
enableOvernight
public ConfigBuilder enableOvernight()
Enable overnight quote- Returns:
- this object
-
pushCandlestickMode
public ConfigBuilder pushCandlestickMode(PushCandlestickMode mode)
Specifies the push candlestick mode- Parameters:
mode- Mode (Default: PushCandlestickMode.Realtime)- Returns:
- this object
-
dontPrintQuotePackages
public ConfigBuilder dontPrintQuotePackages()
Don't print quote packages when connected to the server- Returns:
- this object
-
logPath
public ConfigBuilder logPath(String path)
Set the path of the log files.- Parameters:
path- The path of the log files (Default: `no logs`)- Returns:
- this object
-
build
public Config build() throws OpenApiException
Build a Config object- Returns:
- Config object
- Throws:
OpenApiException- If an error occurs
-
-