pub struct AsyncMdApi { /* private fields */ }
Expand description
异步行情API适配器
Implementations§
Source§impl AsyncMdApi
impl AsyncMdApi
Sourcepub async fn new(
flow_path: Option<&str>,
is_using_udp: bool,
is_multicast: bool,
is_production_mode: Option<bool>,
) -> CtpResult<Self>
pub async fn new( flow_path: Option<&str>, is_using_udp: bool, is_multicast: bool, is_production_mode: Option<bool>, ) -> CtpResult<Self>
创建异步行情API实例
Sourcepub async fn register_front(&self, front_address: &str) -> CtpResult<()>
pub async fn register_front(&self, front_address: &str) -> CtpResult<()>
注册前置机地址
Sourcepub async fn wait_connected(&self, timeout_secs: u64) -> CtpResult<()>
pub async fn wait_connected(&self, timeout_secs: u64) -> CtpResult<()>
等待连接建立(带超时)
Sourcepub async fn login(
&self,
req: &ReqUserLoginField,
timeout_secs: u64,
) -> CtpResult<RspUserLoginField>
pub async fn login( &self, req: &ReqUserLoginField, timeout_secs: u64, ) -> CtpResult<RspUserLoginField>
异步登录
Sourcepub async fn subscribe_market_data(
&self,
instrument_ids: &[&str],
) -> CtpResult<()>
pub async fn subscribe_market_data( &self, instrument_ids: &[&str], ) -> CtpResult<()>
订阅行情数据
Sourcepub async fn unsubscribe_market_data(
&self,
instrument_ids: &[&str],
) -> CtpResult<()>
pub async fn unsubscribe_market_data( &self, instrument_ids: &[&str], ) -> CtpResult<()>
取消订阅行情数据
Sourcepub async fn recv_event(&self) -> Option<AsyncMdEvent>
pub async fn recv_event(&self) -> Option<AsyncMdEvent>
接收下一个事件
Sourcepub async fn try_recv_event(&self) -> Result<AsyncMdEvent, TryRecvError>
pub async fn try_recv_event(&self) -> Result<AsyncMdEvent, TryRecvError>
尝试接收事件(非阻塞)
Sourcepub async fn get_state(&self) -> AsyncMdState
pub async fn get_state(&self) -> AsyncMdState
获取当前状态
Auto Trait Implementations§
impl Freeze for AsyncMdApi
impl !RefUnwindSafe for AsyncMdApi
impl Send for AsyncMdApi
impl Sync for AsyncMdApi
impl Unpin for AsyncMdApi
impl !UnwindSafe for AsyncMdApi
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