pub struct Config { /* private fields */ }Expand description
Configuration options for LongPort sdk
Implementations§
Source§impl Config
impl Config
Sourcepub fn new(
app_key: impl Into<String>,
app_secret: impl Into<String>,
access_token: impl Into<String>,
) -> Self
pub fn new( app_key: impl Into<String>, app_secret: impl Into<String>, access_token: impl Into<String>, ) -> Self
Create a new Config
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
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_TRADE_WS_URL- Trade websocket endpoint url (Default:wss://openapi-trade.longportapp.com)
Sourcepub fn http_url(self, url: impl Into<String>) -> Self
pub fn http_url(self, url: impl Into<String>) -> Self
Specifies the url of the OpenAPI server.
Default: https://openapi.longportapp.com
NOTE: Usually you don’t need to change it.
Sourcepub fn trade_ws_url(self, url: impl Into<String>) -> Self
pub fn trade_ws_url(self, url: impl Into<String>) -> Self
Specifies the url of the OpenAPI trade websocket server.
Default: wss://openapi-trade.longportapp.com
NOTE: Usually you don’t need to change it.
Sourcepub fn create_http_client(&self) -> HttpClient
pub fn create_http_client(&self) -> HttpClient
Create http client use the http client config
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more