Config
Configuration options for LongPort sdk
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app_key
|
str
|
App Key |
required |
app_secret
|
str
|
App Secret |
required |
access_token
|
str
|
Access Token |
required |
http_url
|
Optional[str]
|
HTTP API url |
None
|
quote_ws_url
|
Optional[str]
|
Websocket url for quote API |
None
|
trade_ws_url
|
Optional[str]
|
Websocket url for trade API |
None
|
language
|
Optional[Type[Language]]
|
Language identifier |
None
|
enable_overnight
|
bool
|
Enable overnight quote |
False
|
push_candlestick_mode
|
Type[PushCandlestickMode]
|
Push candlestick mode |
Realtime
|
from_env()
classmethod
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 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
orfalse
(Default:false
)
refresh_access_token(expired_at=None)
Gets a new access_token
Parameters:
Name | Type | Description | Default |
---|---|---|---|
expired_at
|
Optional[datetime]
|
The expiration time of the access token, defaults to |
None
|
Returns:
Type | Description |
---|---|
str
|
Access token |