pub struct CachedSecurityInfo {Show 20 fields
pub stock_id: u64,
pub market: i32,
pub mkt_id: u32,
pub code: String,
pub name: String,
pub lot_size: i32,
pub sec_type: i32,
pub spread_table_code: u32,
pub sub_instrument_type_v2: u32,
pub list_time: String,
pub warrnt_stock_owner: u64,
pub warrant_type: i32,
pub delisting: bool,
pub exch_type: i32,
pub no_search: bool,
pub future_origin_id: u64,
pub zhuli_id: u64,
pub source: SecurityInfoSource,
pub exchange: String,
pub listed_exchange: String,
}Expand description
股票静态信息
v1.4.106 codex F5: 加 Default impl 让 caller 可用
CachedSecurityInfo { stock_id: ..., market: ..., ..Default::default() }.
现有显式 callsite 不动, 新加 callsite 可省冗余字段.
Fields§
§stock_id: u64§market: i32FTAPI QotMarket 值 (1=HK_Security, 11=US_Security, 21=CNSH, 22=CNSZ 等)
由 bridge.rs market_code_to_qot_market() 从 backend market_code
(NN_QuoteMktID) 映射而来; 用于构造 cache key "{market}_{code}"
mkt_id: u32Backend 原始 NN_QuoteMktID (market_code), 保留子交易所精度
用于 cache-first 路由决策: 比如 CME Group 子交易所 (60=NYMEX, 70=COMEX,
80=CBOT, 90=CME, 100=CBOE) 都被 market_code_to_qot_market() 统一压到
FTAPI QotMarket=11 (US_Security), 但 mkt_id 保留原始 range, 使
derive_security_type / us_futures_sub_exchange 等能做 O(1) 范围
判别, 替代 CLAUDE.md 坑 #35 的 code-pattern 启发式. SQLite 历史行无此
字段时读为 0 (默认 Unknown), 下次 upsert 自动修正.
code: String§name: String§lot_size: i32§sec_type: i32§spread_table_code: u32Backend CSStockItem.spread_table_code (field 13).
C++ Ndt_Qot_SecInfo::nSpreadCode feeds
INNBiz_Qot_Spread::AdjustPrice for snapshot priceSpread and trade
price-grid validation. 0 means unavailable in the local cache.
sub_instrument_type_v2: u32Backend CSStockItem.sub_instrument_type_v2 (field 69).
C++ exposes this as Ndt_Qot_SecInfo::enSubTypeV2. v10.6
GetCompanyProfile uses it to decide whether Trust securities route to
F10 CompanyDetail or HK ETF profile.
list_time: String§warrnt_stock_owner: u64窝轮所属正股 ID, 0 表示无
warrant_type: i32C++ internal NN_QotWarrantType from stock-list warrnt_type.
Public Qot_Common.WarrantType only exposes 1-5. C++ stock-list also
carries DLC Long/Short as 6/7, and GetReference(WARRANT) explicitly
filters those out before returning SecurityStaticInfo.
delisting: bool是否已退市
exch_type: i32交易所类型 (ExchType)
no_search: bool不可搜索标记 (对齐 C++ no_search 字段)
future_origin_id: u64v1.4.106 codex F5: 期货主连合约关联 stock_id.
主连合约 (e.g. HSImain, NQmain) 此字段非 0, 指向真实月份合约
stock_id (CMD 6747 拉真实 code 用); 普通合约此字段为 0.
来源: backend stock_list_sync CSStockItem.origin_id (proto field 41).
PlaceOrder F5 用 info.future_origin_id != 0 判 NeedPullFutureContractInfo
(对齐 C++ Ndt_Qot_SecInfo::nFutureOriginID + APIServer_Trd_PlaceOrder .cpp:36-42 NeedPullFutureContractInfo).
SQLite 历史行无此列时默认 0, 下次 stock_list sync (CMD 6746) 重新写入.
zhuli_id: u64v1.4.106 codex F5: 期货主力合约 stock_id.
主连合约持有此字段, 指向当前主力合约 stock_id (流动性最大). PlaceOrder F5 在收到 CMD 6747 响应后用此字段反查真实 code 再下单.
来源: backend CSStockItem.zhuli_id (proto field 40). 普通合约 0.
source: SecurityInfoSourcev1.4.106 codex 1148 F7 (P2): 数据来源 / 完整度标记。详见
SecurityInfoSource doc。默认 OnDemandBasic 以保守对待历史 caller
漏标场景 (能漏标的就是没填全字段, 当 partial 处理最安全)。
exchange: Stringv1.4.110 final E.5 P2#6: 交易所字符串 (proto CSStockItem.exchange field 57).
数据驱动 (pitfall #35 C++ 数据驱动 vs Rust 启发式): trade handler
derive_exchange_str 优先用此字段, 缺失时 fallback 到 code prefix /
pattern match heuristic. 取值例: “SEHK”, “NASDAQ”, “NYSE”, “SSE”, “SZSE”, “HKEX”.
listed_exchange: Stringv1.4.110 final E.5 P2#6: 上市交易所 (proto CSStockItem.listed_exchange field 74).
通常等同 exchange, dual-listed ADR / 双重主要上市等场景下可能不同.
Implementations§
Source§impl CachedSecurityInfo
impl CachedSecurityInfo
Sourcepub fn needs_mkt_id_refresh(&self) -> bool
pub fn needs_mkt_id_refresh(&self) -> bool
v1.4.89 P2-A: 判断 cache row 是否需要后台 mkt_id refresh.
场景: SQLite 历史行 (v1.4.77 Phase D 之前 upsert) 没有 mkt_id 字段,
读取时默认为 0. 这导致 cache-first 路由走 heuristic fallback (坑 #35).
返 true 即需要 refresh; 如果 mkt_id == 0 && market != 0, 是历史行
(有基本 market 但缺 sub-exchange 精度).
使用: StaticDataCache::mark_stale_mkt_id 在 get 时 opportunistic
mark stale, 背景 worker 批量 CMD 20106 refresh.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
v1.4.106 codex 1148 F7: 是否含完整静态字段 (基于 source). 调用方需要
list_time / warrnt_stock_owner / exch_type 等字段时, 应先 check
此 flag, false 时触发 backend 完整 refresh 或返 partial marker。
Trait Implementations§
Source§impl Clone for CachedSecurityInfo
impl Clone for CachedSecurityInfo
Source§fn clone(&self) -> CachedSecurityInfo
fn clone(&self) -> CachedSecurityInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CachedSecurityInfo
impl Debug for CachedSecurityInfo
Source§impl Default for CachedSecurityInfo
impl Default for CachedSecurityInfo
Source§fn default() -> CachedSecurityInfo
fn default() -> CachedSecurityInfo
Auto Trait Implementations§
impl Freeze for CachedSecurityInfo
impl RefUnwindSafe for CachedSecurityInfo
impl Send for CachedSecurityInfo
impl Sync for CachedSecurityInfo
impl Unpin for CachedSecurityInfo
impl UnsafeUnpin for CachedSecurityInfo
impl UnwindSafe for CachedSecurityInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more