pub struct RithmicConfig {
pub account_id: String,
pub fcm_id: String,
pub ib_id: String,
pub url: String,
pub beta_url: String,
pub user: String,
pub password: String,
pub system_name: String,
pub env: RithmicEnv,
}Expand description
Configuration for Rithmic connections.
This struct contains both account information and connection details.
§Fields
- Account-related:
account_id,fcm_id,ib_id - Connection-related:
url,beta_url,user,password,system_name,env
Fields§
§account_id: String§fcm_id: String§ib_id: String§url: String§beta_url: String§user: String§password: String§system_name: String§env: RithmicEnvImplementations§
Source§impl RithmicConfig
impl RithmicConfig
Sourcepub fn from_env(env: RithmicEnv) -> Result<Self, ConfigError>
pub fn from_env(env: RithmicEnv) -> Result<Self, ConfigError>
Create a configuration by loading values from environment variables.
See examples/.env.blank
for a template of all required environment variables.
§Required environment variables
For Demo environment:
RITHMIC_DEMO_ACCOUNT_ID: Demo account IDRITHMIC_DEMO_FCM_ID: Demo FCM (Futures Commission Merchant) IDRITHMIC_DEMO_IB_ID: Demo IB (Introducing Broker) IDRITHMIC_DEMO_USER: Demo usernameRITHMIC_DEMO_PW: Demo passwordRITHMIC_DEMO_URL: Demo WebSocket URLRITHMIC_DEMO_ALT_URL: Demo alternative/beta WebSocket URL
For Live environment:
RITHMIC_LIVE_ACCOUNT_ID: Live account IDRITHMIC_LIVE_FCM_ID: Live FCM (Futures Commission Merchant) IDRITHMIC_LIVE_IB_ID: Live IB (Introducing Broker) IDRITHMIC_LIVE_USER: Live usernameRITHMIC_LIVE_PW: Live passwordRITHMIC_LIVE_URL: Live WebSocket URLRITHMIC_LIVE_ALT_URL: Live alternative/beta WebSocket URL
For Test environment:
RITHMIC_TEST_ACCOUNT_ID: Test account IDRITHMIC_TEST_FCM_ID: Test FCM (Futures Commission Merchant) IDRITHMIC_TEST_IB_ID: Test IB (Introducing Broker) IDRITHMIC_TEST_USER: Test usernameRITHMIC_TEST_PW: Test passwordRITHMIC_TEST_URL: Test WebSocket URLRITHMIC_TEST_ALT_URL: Test alternative/beta WebSocket URL
§Example
use rithmic_rs::config::{RithmicConfig, RithmicEnv};
// Load from environment variables
let config = RithmicConfig::from_env(RithmicEnv::Demo)?;Sourcepub fn builder(env: RithmicEnv) -> RithmicConfigBuilder
pub fn builder(env: RithmicEnv) -> RithmicConfigBuilder
Create a builder for programmatic configuration.
Use this to set configuration values directly in code.
§Example
use rithmic_rs::config::{RithmicConfig, RithmicEnv};
let config = RithmicConfig::builder(RithmicEnv::Demo)
.account_id("my_account")
.fcm_id("my_fcm")
.ib_id("my_ib")
.user("my_user")
.password("my_password")
.build()?;Trait Implementations§
Source§impl Clone for RithmicConfig
impl Clone for RithmicConfig
Source§fn clone(&self) -> RithmicConfig
fn clone(&self) -> RithmicConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RithmicConfig
impl RefUnwindSafe for RithmicConfig
impl Send for RithmicConfig
impl Sync for RithmicConfig
impl Unpin for RithmicConfig
impl UnwindSafe for RithmicConfig
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