StaticfromCreate a new Config using API Key authentication
Optional environment variables are read automatically
(LONGPORT_HTTP_URL, LONGPORT_LANGUAGE,
LONGPORT_QUOTE_WS_URL, LONGPORT_TRADE_WS_URL,
LONGPORT_ENABLE_OVERNIGHT, LONGPORT_PUSH_CANDLESTICK_MODE,
LONGPORT_PRINT_QUOTE_PACKAGES, LONGPORT_LOG_PATH). Fields
set in extra override the corresponding environment variables.
Application key
Application secret
Access token
Optionalextra: ExtraConfigParams | nullOptional extra parameters (override env variables)
StaticfromCreate a new Config from the environment (API Key authentication)
It first gets the environment variables from the .env file in the
current directory.
LONGPORT_LANGUAGE - Language identifier, zh-CN, zh-HK or en
(Default: en)LONGPORT_APP_KEY - App keyLONGPORT_APP_SECRET - App secretLONGPORT_ACCESS_TOKEN - Access tokenLONGPORT_HTTP_URL - HTTP endpoint urlLONGPORT_QUOTE_WS_URL - Quote websocket endpoint urlLONGPORT_TRADE_WS_URL - Trade websocket endpoint urlLONGPORT_ENABLE_OVERNIGHT - Enable overnight quote, true or
false (Default: false)LONGPORT_PUSH_CANDLESTICK_MODE - realtime or confirmed
(Default: realtime)LONGPORT_PRINT_QUOTE_PACKAGES - Print quote packages when
connected, true or false (Default: true)LONGPORT_LOG_PATH - Log file directory (Default: no logs)StaticfromCreate a new Config for OAuth 2.0 authentication
OAuth 2.0 is the recommended authentication method that uses Bearer tokens and does not require app_secret or HMAC signatures.
Optional environment variables are read automatically
(LONGPORT_HTTP_URL, LONGPORT_LANGUAGE,
LONGPORT_QUOTE_WS_URL, LONGPORT_TRADE_WS_URL,
LONGPORT_ENABLE_OVERNIGHT, LONGPORT_PUSH_CANDLESTICK_MODE,
LONGPORT_PRINT_QUOTE_PACKAGES, LONGPORT_LOG_PATH). Fields
set in extra override the corresponding environment variables.
OAuth handle obtained from OAuth.build(...)
Optionalextra: ExtraConfigParams | nullOptional extra parameters (override env variables)
Gets a new access_token
This method is only available when using Legacy API Key
authentication (i.e. Config.fromApikey). It is not supported for
OAuth 2.0 mode.
OptionalexpiredAt: Date | nullThe expiration time of the access token, defaults to 90 days from now.
Configuration for Longport SDK