Package com.longport

Class Config

    • Method Detail

      • fromEnv

        public static Config fromEnv()
                              throws OpenApiException
        Create a new `Config` from the given environment variables

        It 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`) - `LONGPORT_PRINT_QUOTE_PACKAGES` - Print quote packages when connected, `true` or `false` (Default: `true`)

        Returns:
        Config object
        Throws:
        OpenApiException - If an error occurs