use std::collections::HashMap;
#[derive(Clone)]
pub struct FutuAuth {
pub host: String,
pub port: u16,
pub trade_password: Option<String>,
pub rsa_key: Option<String>,
}
impl FutuAuth {
pub fn from_env() -> Self {
Self {
host: std::env::var("FUTU_OPEND_HOST")
.unwrap_or_else(|_| "127.0.0.1".to_string()),
port: std::env::var("FUTU_OPEND_PORT")
.ok()
.and_then(|p| p.parse().ok())
.unwrap_or(11111),
trade_password: std::env::var("FUTU_TRADE_PASSWORD").ok(),
rsa_key: std::env::var("FUTU_RSA_KEY").ok(),
}
}
pub fn new(host: impl Into<String>, port: u16) -> Self {
Self {
host: host.into(),
port,
trade_password: None,
rsa_key: None,
}
}
pub fn with_trade_password(mut self, password: impl Into<String>) -> Self {
self.trade_password = Some(password.into());
self
}
pub fn sign_headers(&self, _headers: &mut HashMap<String, String>) {
}
}