Skip to main content

TickData

Struct TickData 

Source
pub struct TickData {
Show 42 fields pub gateway_name: String, pub symbol: String, pub exchange: Exchange, pub datetime: DtNs, pub trading_day: Option<i32>, pub action_day: Option<i32>, pub update_time: String, pub update_millisec: i64, pub name: String, pub volume: f64, pub turnover: f64, pub open_interest: f64, pub last_price: f64, pub last_volume: f64, pub limit_up: f64, pub limit_down: f64, pub open_price: f64, pub high_price: f64, pub low_price: f64, pub pre_close: f64, pub pct_change: f64, pub bid_price_1: f64, pub bid_price_2: f64, pub bid_price_3: f64, pub bid_price_4: f64, pub bid_price_5: f64, pub ask_price_1: f64, pub ask_price_2: f64, pub ask_price_3: f64, pub ask_price_4: f64, pub ask_price_5: f64, pub bid_volume_1: f64, pub bid_volume_2: f64, pub bid_volume_3: f64, pub bid_volume_4: f64, pub bid_volume_5: f64, pub ask_volume_1: f64, pub ask_volume_2: f64, pub ask_volume_3: f64, pub ask_volume_4: f64, pub ask_volume_5: f64, pub localtime: Option<DtNs>,
}
Expand description

Tick 数据:最后成交、盘口快照、日内统计。

字段与 Python TickData 同名同义(snake_case);缺省值同 Python(0 / “”)。

Fields§

§gateway_name: String

上游网关名(BaseData.gateway_name,object.py:31)

§symbol: String

合约代码

§exchange: Exchange

交易所

§datetime: DtNs

时间戳(UTC 纪元纳秒;Python 为本地 naive datetime)

§trading_day: Option<i32>

交易日(缺省 None;Python 缺省空串)

§action_day: Option<i32>

行动日/自然日(缺省 None;Python 缺省空串)

§update_time: String

原始 HH:MM:SS 文本(上游原样)

§update_millisec: i64

毫秒段

§name: String

合约中文名

§volume: f64

当日累计成交量

§turnover: f64

当日累计成交额

§open_interest: f64

持仓量/流通量

§last_price: f64

最新价

§last_volume: f64

本笔成交量

§limit_up: f64

涨停价

§limit_down: f64

跌停价

§open_price: f64

今开

§high_price: f64

最高

§low_price: f64

最低

§pre_close: f64

昨收

§pct_change: f64

涨跌幅(%)

§bid_price_1: f64

买一价

§bid_price_2: f64

买二价

§bid_price_3: f64

买三价

§bid_price_4: f64

买四价

§bid_price_5: f64

买五价

§ask_price_1: f64

卖一价

§ask_price_2: f64

卖二价

§ask_price_3: f64

卖三价

§ask_price_4: f64

卖四价

§ask_price_5: f64

卖五价

§bid_volume_1: f64

买一量

§bid_volume_2: f64

买二量

§bid_volume_3: f64

买三量

§bid_volume_4: f64

买四量

§bid_volume_5: f64

买五量

§ask_volume_1: f64

卖一量

§ask_volume_2: f64

卖二量

§ask_volume_3: f64

卖三量

§ask_volume_4: f64

卖四量

§ask_volume_5: f64

卖五量

§localtime: Option<DtNs>

本地收包时间(UTC 纪元纳秒;Python 缺省 None)

Implementations§

Source§

impl TickData

Source

pub fn en_symbol(&self) -> String

en_symbol(Python __post_init__ 暂存字段的派生方法化;分配一次)。

Source

pub fn en_symbol_into(&self, buf: &mut String)

零分配版本:追加到复用缓冲(逐 tick 热路径;每笔行情少一次堆分配)。

Source

pub fn reach_limit_up(&self, diff_price: f64) -> bool

tick 是否触及涨停(object.py:99;diff 为容差,非负向给)。

注意原作怪癖(字节级保留):tick 缺省字段(0.0/0.0)时 bid_price_1(0) + 0 >= limit_up(0) 成立 → 返回 true; 使用方须先落真实价格再作判,或自行先校验 limit_up>0。

Source

pub fn reach_limit_down(&self, diff_price: f64) -> bool

tick 是否触及跌停(object.py:105)。

Source

pub fn reach_limit(&self, diff_price: f64) -> bool

触及涨停或跌停(object.py:111)。

Trait Implementations§

Source§

impl Clone for TickData

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 TickData

Source§

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

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

impl Default for TickData

Source§

fn default() -> Self

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

impl PartialEq for TickData

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 TickData

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.