pub struct AsyncTraderApi { /* private fields */ }
Expand description
异步交易API适配器
Implementations§
Source§impl AsyncTraderApi
impl AsyncTraderApi
Sourcepub async fn new(
flow_path: Option<&str>,
is_production_mode: Option<bool>,
) -> CtpResult<Self>
pub async fn new( flow_path: Option<&str>, 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 authenticate(
&self,
req: &ReqAuthenticateField,
timeout_secs: u64,
) -> CtpResult<RspAuthenticateField>
pub async fn authenticate( &self, req: &ReqAuthenticateField, timeout_secs: u64, ) -> CtpResult<RspAuthenticateField>
异步认证
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 order_insert(
&self,
req: &InputOrderField,
timeout_secs: u64,
) -> CtpResult<AsyncTraderEvent>
pub async fn order_insert( &self, req: &InputOrderField, timeout_secs: u64, ) -> CtpResult<AsyncTraderEvent>
异步报单录入
Sourcepub async fn order_action(
&self,
req: &InputOrderActionField,
timeout_secs: u64,
) -> CtpResult<AsyncTraderEvent>
pub async fn order_action( &self, req: &InputOrderActionField, timeout_secs: u64, ) -> CtpResult<AsyncTraderEvent>
异步报单操作
Sourcepub async fn qry_trading_account(
&self,
req: &QryTradingAccountField,
timeout_secs: u64,
) -> CtpResult<Vec<TradingAccountField>>
pub async fn qry_trading_account( &self, req: &QryTradingAccountField, timeout_secs: u64, ) -> CtpResult<Vec<TradingAccountField>>
异步查询交易账户
Sourcepub async fn qry_investor_position(
&self,
req: &QryInvestorPositionField,
timeout_secs: u64,
) -> CtpResult<Vec<InvestorPositionField>>
pub async fn qry_investor_position( &self, req: &QryInvestorPositionField, timeout_secs: u64, ) -> CtpResult<Vec<InvestorPositionField>>
异步查询投资者持仓
Sourcepub async fn recv_event(&self) -> Option<AsyncTraderEvent>
pub async fn recv_event(&self) -> Option<AsyncTraderEvent>
接收下一个事件
Sourcepub async fn try_recv_event(&self) -> Result<AsyncTraderEvent, TryRecvError>
pub async fn try_recv_event(&self) -> Result<AsyncTraderEvent, TryRecvError>
尝试接收事件(非阻塞)
Sourcepub async fn get_state(&self) -> AsyncTraderState
pub async fn get_state(&self) -> AsyncTraderState
获取当前状态
Auto Trait Implementations§
impl Freeze for AsyncTraderApi
impl !RefUnwindSafe for AsyncTraderApi
impl Send for AsyncTraderApi
impl Sync for AsyncTraderApi
impl Unpin for AsyncTraderApi
impl !UnwindSafe for AsyncTraderApi
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