Package com.longport
Class Config
- java.lang.Object
-
- com.longport.Config
-
- All Implemented Interfaces:
AutoCloseable
public class Config extends Object implements AutoCloseable
Configuration options for LongPort sdk
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static Config
fromEnv()
Create a new `Config` from the given environment variablesCompletableFuture<String>
refreshAccessToken(OffsetDateTime expiredAt)
-
-
-
Method Detail
-
fromEnv
public static Config fromEnv() throws OpenApiException
Create a new `Config` from the given environment variablesIt first gets the environment variables from the .env file in the current directory. # Variables - `LONGPORT_APP_KEY` - App key - `LONGPORT_APP_SECRET` - App secret - `LONGPORT_ACCESS_TOKEN` - Access token - `LONGPORT_HTTP_URL` - HTTP endpoint url (Default: `https://openapi.longportapp.com`) - `LONGPORT_QUOTE_WS_URL` - Quote websocket endpoint url (Default: `wss://openapi-quote.longportapp.com/v2`) - `LONGPORT_TRADE_WS_URL` - Trade websocket endpoint url (Default: `wss://openapi-trade.longportapp.com/v2`) - `LONGPORT_ENABLE_OVERNIGHT` - Enable overnight quote, `true` or `false` (Default: `false`) - `LONGPORT_PUSH_CANDLESTICK_MODE` - `realtime` or `confirmed` (Default: `realtime`)
- Returns:
- Config object
- Throws:
OpenApiException
- If an error occurs
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
refreshAccessToken
public CompletableFuture<String> refreshAccessToken(OffsetDateTime expiredAt) throws OpenApiException
- Throws:
OpenApiException
-
-