Skip to main content

PositionData

Struct PositionData 

Source
pub struct PositionData {
Show 16 fields pub gateway_name: String, pub symbol: String, pub exchange: Exchange, pub direction: Direction, pub volume: f64, pub frozen: f64, pub price: f64, pub pnl: f64, pub yd_volume: f64, pub name: String, pub can_use_volume: f64, pub market_value: f64, pub on_road_volume: f64, pub avg_price: f64, pub last_price: f64, pub profit_rate: f64,
}
Expand description

逐向持仓数据。

Fields§

§gateway_name: String

上游网关名

§symbol: String

合约代码

§exchange: Exchange

交易所

§direction: Direction

方向(Python 必填;Rust Default 为 Direction::NET,见 constant.rs 说明)

§volume: f64

持仓量

§frozen: f64

冻结量

§price: f64

持仓均价(网关侧口径)

§pnl: f64

持仓盈亏

§yd_volume: f64

隔夜仓量(Yesterday)

§name: String

证券名称

§can_use_volume: f64

可用数量

§market_value: f64

市值

§on_road_volume: f64

在途股份

§avg_price: f64

成本价

§last_price: f64

最新价

§profit_rate: f64

盈亏比例

Implementations§

Source§

impl PositionData

Source

pub fn en_symbol(&self) -> String

en_symbol(派生方法;分配一次)。

Source

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

零分配版本:追加到复用缓冲。

Source

pub fn en_positionid(&self) -> String

en_positionid = "{gateway_name}.{en_symbol}.{direction 线值}"(object.py:262-264)。

注意:Python 版第三段用中文线值("多"),Rust 版依线值决定 3 用英文 ("LONG"/"SHORT"/"NET";DESIGN.md 决定 3)。

Trait Implementations§

Source§

impl Clone for PositionData

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 PositionData

Source§

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

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

impl Default for PositionData

Source§

fn default() -> Self

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

impl PartialEq for PositionData

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 PositionData

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.