Skip to main content

Module config

Module config 

Source
Expand description

Connector configuration: the credentials and endpoint shared by both roles (FinamApiConfig) and the settings of each role (MarketDataConfig, UserDataConfig).

§Examples

use brokapi_finam::{FinamApiConfig, MarketDataConfig, UserDataConfig};

// Secret from your own storage. The default endpoint is the real broker.
let api = FinamApiConfig::new("my-api-secret");
let md = MarketDataConfig::new(api.clone(), "finam-md");
let ud = UserDataConfig::new(api, "A12345", "finam-ud-A12345");
assert_eq!(ud.account_id, "A12345");
assert_eq!(&*md.source, "finam-md");
// `{:?}` never prints the secret.
assert!(!format!("{ud:?}").contains("my-api-secret"));

Structs§

FinamApiConfig
Connection and credentials, shared in shape by both connector roles.
MarketDataConfig
Market data connector config. Not bound to an account.
UserDataConfig
User data connector config: one connector = one account.

Functions§

api_config_from_env
Reads the config from environment variables. Meant for examples and live tests.