Crate quant1x

Crate quant1x 

Source
Expand description

Quant1X Standard Library for Rust

This library provides cross-language compatible utilities for quantitative trading, with implementations in C++, Go, and Rust that maintain API consistency.

§命名空间设计

  • Crate名称: quant1x
  • 命名空间: quant1x::
  • 使用方式: use quant1x::Timestamp;

§示例

use quant1x::Timestamp;
 
let ts = Timestamp::now();
let parsed = Timestamp::parse("2022-06-15 14:30:45").unwrap();

Modules§

buffer
calendar
code
connection_pool
endpoint
session
system

Structs§

BinaryStream
CalendarDecoder
Connection
A pooled connection wrapper. The pool owns connections and returns a guard that will return the connection to the pool when dropped.
Endpoint
EndpointManager
Simple thread-safe endpoint manager, similar to the C++ EndpointManager.
FPGrowthMiner
FP-Growth 挖掘器
HeartbeatRequest
HeartbeatResponse
Hello1Request
Hello1Response
Hello2Request
Hello2Response
PooledConnection
RAII guard that returns the connection to the pool when dropped.
ProtocolHandler
Minimal client-side protocol helper mirroring C++ ProtocolHandler handshake and keepalive.
Record
RollingOnce
RollingOnce provides C++-equivalent semantics:
RuntimeStatus
TcpConnectionPool
The Mio-based TCP connection pool. This is a simplified port of the C++ TcpConnectionPool semantics: acquire returns a connection which is automatically returned on Drop.
TimeRange
Timestamp
本地时间戳,单位毫秒
TradingSession
XdxrInfo
XdxrInfoRequest
XdxrInfoResponse

Constants§

MASK_ACTIVE
MASK_CALL_AUCTION
MASK_CANCELABLE
MASK_CLOSED
MASK_CLOSING
MASK_HALT
MASK_OPENING
MASK_ORDER
MASK_TRADING
MILLISECONDS_PER_DAY
MILLISECONDS_PER_HOUR
MILLISECONDS_PER_MINUTE
MILLISECONDS_PER_SECOND
PRE_MARKET_HOUR
PRE_MARKET_MINUTE
PRE_MARKET_SECOND
SECONDS_PER_DAY
SECONDS_PER_HOUR
SECONDS_PER_MINUTE

Traits§

NetworkHandler
Trait that the user of the connection pool should implement to perform protocol-specific work: handshake and keepalive checks.

Functions§

add
assert_index_by_market_and_code
AssertIndexByMarketAndCode equivalent from C++ exchange::code.cpp
can_initialize
can_update_in_realtime
check_trading_timestamp
client
Acquire a pooled connection to a level1 server.
date_range
default_base_unit
defaultBaseUnit equivalent from C++ security_quote.h
get_calendar_filename
Return the filename used for the calendar cache (convenience wrapper around the internal config helper). This is intentionally a tiny, stable API so external tests and tools can locate the calendar cache without exposing the full config module.
get_calendar_list
get_datetime_from_u32
get_market_flag
homedir
Return the preferred home directory following C++ priority: QUANT1X_HOME, GOX_HOME, HOME (or USERPROFILE on Windows), then fallback to temp dir.
int_to_float64
is_trading_disabled
last_trading_day
next_trading_day
prev_trading_day
process_request
Send a request buffer on a blocking mio::net::TcpStream, read the level1 response header and body, and return the (possibly decompressed) body bytes. This mirrors the C++ level1::process() unzip semantics.
security_code
Build a security code string like C++ exchange::GetMarketFlag(...) + code
sequence_id
unzip
解压 zlib 压缩的数据

Type Aliases§

TimeStatus