Skip to main content

GatewayStatus

Struct GatewayStatus 

Source
pub struct GatewayStatus {
Show 26 fields pub gateway: String, pub sampled_ms: i64, pub td_handle_up: bool, pub td_logged_in: bool, pub td_login_failed: bool, pub td_auth_ok: bool, pub td_auth_failed: bool, pub td_front_id: i64, pub td_session_id: i64, pub td_disconnects: u32, pub td_last_login_ok_ms: Option<i64>, pub td_last_account_ms: Option<i64>, pub td_last_position_ms: Option<i64>, pub td_query_rejects: u32, pub td_query_reject_streak: u32, pub td_instrument_rejects: u32, pub td_rotation_armed: bool, pub td_last_error: Option<String>, pub md_handle_up: bool, pub md_logged_in: bool, pub md_disconnects: u32, pub md_last_login_ok_ms: Option<i64>, pub md_last_tick_ms: Option<i64>, pub md_sub_rejects: u32, pub md_last_error: Option<String>, pub md_subscribed: usize,
}
Expand description

网关状态读数(0.9.0 新增;{gw}.status 的返回体 = 界面状态机的唯一事实源)。

口径边界(消费侧文案必须照这个说,不得越界):

  • *_handle_up = API 句柄已建并 registerFront,不等于在线(掉线时这一位仍为真);
  • *_logged_in = 最近一次登录成功且未断开 —— 「在线/掉线」的唯一硬证据;
  • 「查询断供」= td_query_reject_streak 达阈 或 距 td_last_account_ms 超时; 阈值归消费侧(ek-ui)配置,网关只给原料不裁决(它不知道界面多久刷一次)。 0.9.1 起合约查询被拒也进同一条连续串(消费侧要的是「查询这条路连续被拒几次」, 不分路);要分路看 td_instrument_rejects 这个分项。
  • 计数与「最近时刻」跨重连保留:掉过几次线是历史事实,不因重连清零;
  • 从未发生过 = None(界面须显示「无证据」,不得显示 0 秒前)。

Fields§

§gateway: String

网关注册名(派生名 ctp_<broker>_<账号>)

§sampled_ms: i64

读数时刻(纪元毫秒;消费侧据此算「距最后一次回报多久」)

§td_handle_up: bool

TD 句柄已建(不等于在线)

§td_logged_in: bool

TD 已登录

§td_login_failed: bool

最近一次 TD 登录失败(成功后清零)

§td_auth_ok: bool

TD 认证通过

§td_auth_failed: bool

TD 认证失败

§td_front_id: i64

登录回报带的 FrontID(0 = 从未登录成功)

§td_session_id: i64

登录回报带的 SessionID

§td_disconnects: u32

TD 断开累计次数

§td_last_login_ok_ms: Option<i64>

最近一次 TD 登录成功时刻

§td_last_account_ms: Option<i64>

最近一次资金回报时刻

§td_last_position_ms: Option<i64>

最近一次持仓回报时刻

§td_query_rejects: u32

查询被拒累计次数(合约/持仓/资金三条查询路,0.9.1 起含合约)

§td_query_reject_streak: u32

连续被拒次数(成功回报清零)

§td_instrument_rejects: u32

合约查询被拒累计次数(0.9.1;td_query_rejects 的分项,不是另一本账)

§td_rotation_armed: bool

查询轮转闸门(未 arm = 一条轮转查询都不会发)

§td_last_error: Option<String>

最近一次 TD 错误回报

§md_handle_up: bool

MD 句柄已建(不等于在线)

§md_logged_in: bool

MD 已登录

§md_disconnects: u32

MD 断开累计次数

§md_last_login_ok_ms: Option<i64>

最近一次 MD 登录成功时刻

§md_last_tick_ms: Option<i64>

最近一条行情回报时刻

§md_sub_rejects: u32

订阅被拒累计次数

§md_last_error: Option<String>

最近一次 MD 错误回报

§md_subscribed: usize

已登记订阅数(断开不清订阅集)

Trait Implementations§

Source§

impl Clone for GatewayStatus

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GatewayStatus

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GatewayStatus

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for GatewayStatus

Source§

impl PartialEq for GatewayStatus

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GatewayStatus

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.