Struct rustdx::tcp::SecurityList

source ·
pub struct SecurityList {
    pub send: Box<[u8]>,
    pub market: u16,
    pub start: u16,
    pub count: usize,
    pub response: Vec<u8>,
    pub data: Box<[SecurityListData]>,
}
Expand description

查询证券列表。对应于 pytdx 中的 GetSecurityList。

§注意:

  • 获取的数据可能同一类别内是有序的,不同类别间是顺序未知 (比如 A 股股票之后不是创业板/科创板股票);
  • 每次返回 1000 条结果。

Fields§

§send: Box<[u8]>§market: u16§start: u16§count: usize

响应信息中的列表长度。

§response: Vec<u8>§data: Box<[SecurityListData]>

Implementations§

source§

impl SecurityList

source

pub fn new(market: u16, start: u16) -> Self

参数说明:

  • market = 0 或 1,表示深市或沪市;
  • start 在 [0, n] 的范围内,其中 n 是 SecurityCount 得到的结果。 目前 market = 0 时,有 13471 条; market = 1 时,有 18065 条。

Trait Implementations§

source§

impl Clone for SecurityList

source§

fn clone(&self) -> SecurityList

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for SecurityList

source§

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

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

impl Default for SecurityList

source§

fn default() -> Self

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

impl Tdx for SecurityList

source§

const SEND: &'static [u8] = _

market = 0, start = 0 表示深市所有证券从第 0 个开始的 1000 条证券; 共 16 字节。

source§

fn parse(&mut self, v: Vec<u8>)

前 2 字节表示列表的长度,剩余字节中,每 29 字节使用 SecurityListData::parse 解析。

§

type Item = [SecurityListData]

source§

const TAG: &'static str = "股票、指数列表"

描述此次 tcp 连接的用途,目前用于记录日志。
source§

fn send(&mut self) -> &[u8]

真正发送的字节。
source§

fn result(&self) -> &Self::Item

解析后的结果。可以是引用,也可以是 owned type 。
source§

const LEN: usize = _

发送的字节的长度。每种请求所发送的字节长度是已知的。默认为 Tdx::SEND 的长度。
source§

fn recv(&mut self, tcp: &mut Tcp) -> Result<Vec<u8>>

得到响应的字节。响应的字节长度无法预测。
source§

fn recv_parsed(&mut self, tcp: &mut Tcp) -> Result<&Self::Item>

得到和解析响应的字节,并返回解析的数据。

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> 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,

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.