pub struct UserDataConfig {
pub bybit: BybitConfig,
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 contour (main or demo) and the category come from the bybit config.
§Examples
use brokapi_bybit_protocol::config::BybitConfig;
use brokapi_bybit::UserDataConfig;
let mut cfg = UserDataConfig::new(BybitConfig::new("key", "secret"), "bybit-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§
§bybit: BybitConfigClient settings of the Bybit API: key pair, contour, receive window, endpoints.
source: Arc<str>Envelope source label, e.g. "bybit-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