Skip to main content

ek_data/
history_request.rs

1//! 历史数据查询请求(`object.py:607-621`)。
2
3use crate::constant::{Exchange, Interval};
4use crate::time::DtNs;
5
6/// 发往网关的历史数据请求。
7#[derive(Debug, Clone, PartialEq, Default)]
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9pub struct HistoryRequest {
10    /// 合约代码
11    pub symbol: String,
12    /// 交易所
13    pub exchange: Exchange,
14    /// 起点(UTC 纪元纳秒)
15    pub start: DtNs,
16    /// 终点(缺省 None)
17    pub end: Option<DtNs>,
18    /// K 线间隔(缺省 None)
19    pub interval: Option<Interval>,
20}
21
22impl HistoryRequest {
23    /// `en_symbol`(派生方法)。
24    pub fn en_symbol(&self) -> String {
25        crate::symbol::vt_symbol(&self.symbol, self.exchange)
26    }
27}