Add symbol_meta reader for per-symbol geometry sidecars
Implements #3: DataServer::symbol_meta(symbol) -> Option<InstrumentGeometry> loads a <SYMBOL>.meta.json sidecar from the owned data directory and returns neutral, broker-agnostic price geometry (digits, pip_size, tick_size, lot_size, base, quote). A consumer can now obtain a symbol's bars and its price-interpretation geometry from one server. Design (forks logged on #3): - Neutral output is the struct's shape/semantics, not currency-code normalization: base/quote pass through verbatim. The live sidecars carry wildly heterogeneous base codes (ISO, index codes, descriptive names, stock tickers) with no definable neutral target; the downstream consumer cross-checks them against its own vetted table. - Format quirks are absorbed in a pure parser (meta::from_sidecar_bytes): scientific notation parses natively; a null / non-finite / missing core field or an unsupported schemaVersion yields None, never a partial struct. - A missing sidecar is a normal None (silent); a present-but-unusable one warns to stderr, matching the existing loader's degrade-and-warn style. - serde_json (Value extraction, no derive) is the new direct dependency, chosen over a hand-rolled parser for robust number/escape handling; the README dependency statement is updated to match. - No caching and no Arc<Self>: geometry files are tiny and read rarely, and the read needs no prefetch. Lookup is not gated on bar-index membership. Verified: cargo build and clippy clean (0 warnings); full suite green (7 parser unit tests + 5 symbol_meta integration tests pin each absorbed quirk and the index-independent lookup). Cargo.lock stays untracked per the library convention. closes #3
This commit is contained in:
@@ -7,6 +7,7 @@ description = "High-performance, thread-safe loader and cache for binary market
|
||||
[dependencies]
|
||||
chrono = "0.4"
|
||||
regex = "1.10"
|
||||
serde_json = "1"
|
||||
zip = "2"
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
Reference in New Issue
Block a user