pub struct UserDataConfig {
pub bcs: BcsConfig,
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.
For a connector that sends orders the bcs config must be built with with_write(true).
§Examples
use brokapi_bcs_protocol::config::BcsConfig;
use brokapi_bcs::UserDataConfig;
let bcs = BcsConfig::new("refresh-token".into()).with_write(true);
let mut cfg = UserDataConfig::new(bcs, "bcs-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§
§bcs: BcsConfigClient settings of the BCS API: refresh token, timeouts, endpoints, write switch.
source: Arc<str>Envelope source label, e.g. "bcs-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, as at T-Bank and Finam).
reconnect_max: DurationUpper bound of the pause (default 30 s). The pause returns to reconnect_min once a connection
has lived 10 seconds.
subscribe_ack_timeout: DurationHow long a subscribe_* call waits for the WebSocket of its channel to be open (default 3 s). The
call returns when the socket is open: an order placed right after it is not missed. If the socket does
not open in time, the call fails with Transport and the subscription is taken back, so the call can
be repeated.
price_grid: PriceGridPrice steps the connector checks order prices against (default: empty, nothing is checked).
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