Struct UserDataConfig
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§
§impl UserDataConfig
impl UserDataConfig
Trait Implementations§
§impl Clone for UserDataConfig
impl Clone for UserDataConfig
§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 moreAuto Trait Implementations§
impl Freeze for UserDataConfig
impl RefUnwindSafe for UserDataConfig
impl Send for UserDataConfig
impl Sync for UserDataConfig
impl Unpin for UserDataConfig
impl UnsafeUnpin for UserDataConfig
impl UnwindSafe for UserDataConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].