pub struct UserDataConfig {
pub alor: AlorConfig,
pub source: Arc<str>,
pub order_state_buffer: usize,
pub reconnect_min: Duration,
pub reconnect_max: Duration,
pub subscribe_ack_timeout: Duration,
pub price_grid: PriceGrid,
}Expand description
Settings of UserDataConnector.
The portfolio and the exchange come from the alor config: see
AlorConfig::portfolio.
§Examples
use brokapi_alor_protocol::config::AlorConfig;
use brokapi_alor::UserDataConfig;
let alor = AlorConfig::new("refresh-token".into()).with_portfolio("D12345");
let mut cfg = UserDataConfig::new(alor, "alor-ud");
assert_eq!(cfg.order_state_buffer, 1024);
// A bigger buffer gives a slow bot more room before an overflow closes the trading gate.
cfg.order_state_buffer = 4096;Fields§
§alor: AlorConfigClient settings of the ALOR API: refresh token, contour, timeouts, endpoints, portfolio, exchange.
source: Arc<str>Envelope source label, e.g. "alor-ud".
order_state_buffer: usizeCapacity of the lossless buffer of each order state and execution subscription (default 1024 events).
When it is full, the subscription reports an overflow and the connector becomes degraded: commands are
refused until the next successful reconcile.
reconnect_min: DurationPause before the first reconnect of the WebSocket, doubling up to reconnect_max (default 0.5 s).
reconnect_max: DurationUpper bound of the pause (default 30 s).
subscribe_ack_timeout: DurationHow long a subscribe_* call waits for the broker to confirm the subscription (default 3 s), see
MarketDataConfig::subscribe_ack_timeout.
price_grid: PriceGridPrice steps and lot sizes the connector checks orders against (default: empty, only the lot sizes the
connector reads from the broker). Fill it with [PriceGrid::learn] from the trading parameters of the
instruments you trade. A price off the step is then refused with Rejected (price_off_step) before
anything is sent.
Implementations§
Trait Implementations§
Source§impl Clone for UserDataConfig
impl Clone for UserDataConfig
Source§fn clone(&self) -> UserDataConfig
fn clone(&self) -> UserDataConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more