Methods
new
pub fn new(app_key: string, app_secret: string, access_token: string, http_url: string? = nil, quote_ws_url: string? = nil, trade_ws_url: string? = nil, language: Language? = nil, enable_overnight: bool? = nil): Config
[src]
pub fn new(
app_key: string,
app_secret: string,
access_token: string,
http_url: string? = nil,
quote_ws_url: string? = nil,
trade_ws_url: string? = nil,
language: Language? = nil,
enable_overnight: bool? = nil
): Config {
let items_language: int? = nil;
if (language != nil) {
items_language = language as int;
}
let inner = _Config
.new(
app_key,
app_secret,
access_token,
http_url: http_url,
quote_ws_url: quote_ws_url,
trade_ws_url: trade_ws_url,
language: items_language,
enable_overnight: enable_overnight
);
return inner as Config;
}
Create a new Config
new
pub fn new(app_key: string, app_secret: string, access_token: string, http_url: string? = nil, quote_ws_url: string? = nil, trade_ws_url: string? = nil, language: Language? = nil, enable_overnight: bool? = nil): Config
[src]
pub fn new(
app_key: string,
app_secret: string,
access_token: string,
http_url: string? = nil,
quote_ws_url: string? = nil,
trade_ws_url: string? = nil,
language: Language? = nil,
enable_overnight: bool? = nil
): Config {
let items_language: int? = nil;
if (language != nil) {
items_language = language as int;
}
let inner = _Config
.new(
app_key,
app_secret,
access_token,
http_url: http_url,
quote_ws_url: quote_ws_url,
trade_ws_url: trade_ws_url,
language: items_language,
enable_overnight: enable_overnight
);
return inner as Config;
}
Create a new Config
Create a new Config
nv,
use longport.{Config, Language};
let config = Config.new(
"app_key",
"app_secret",
"access_token",
language: Language.EN,
enable_overnight: true
);
from_env
pub fn from_env(): Config throws OpenApiError
[src]
pub fn from_env(): Config throws OpenApiError {
let inner = try _Config.from_env();
return inner as Config;
}
Create a new Config
from the given environment variables
from_env
pub fn from_env(): Config throws OpenApiError
[src]
pub fn from_env(): Config throws OpenApiError {
let inner = try _Config.from_env();
return inner as Config;
}
Create a new Config
from the given environment variables
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 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
)
nv,
use longport.Config;
let config = try! Config.from_env();