feat: reject non-standard symbols (missing CODE.MARKET format) - #556
Closed
hogan-yuan wants to merge 2 commits into
Closed
feat: reject non-standard symbols (missing CODE.MARKET format)#556hogan-yuan wants to merge 2 commits into
hogan-yuan wants to merge 2 commits into
Conversation
Add validate_symbol() to rust/src/utils/counter.rs and apply it to: - All 9 US fundamental methods (us_company_overview, us_valuation_overview, us_financial_overview, us_financial_statement, us_key_financial_metrics, us_analyst_consensus, us_etf_dividend_info, us_company_dividends, us_etf_files) - us_crypto_overview (quote context) - us_query_orders optional symbol filter (trade context) Bare tickers like "AXTI" now return InvalidSecuritySymbol error. Blocking wrappers inherit validation via async delegation.
Add validate_and_convert() to counter.rs. Apply to: - All 28 non-US fundamental methods - 8 quote methods (depth, brokers, trades, intraday, candlesticks, etc.) - 2 trade methods (margin_ratio, us_query_orders)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
validate_symbol/validate_and_converttorust/src/utils/counter.rsand apply to all SDK methods that accept a single symbol parameter.Bare tickers like
"AXTI"that are missing the requiredCODE.MARKETformat are now rejected with a clear error, instead of silently being passed as-is to the API.Changes
rust/src/utils/counter.rs: newvalidate_symbol(&str) -> Result<()>andvalidate_and_convert(impl Into<String>) -> Result<String>rust/src/fundamental/context.rs: all 37 methods with symbol param (9 US + 28 non-US)rust/src/quote/context.rs: 9 methods (depth, brokers, trades, candlesticks, option_volume, etc.)rust/src/trade/context.rs: margin_ratio + us_query_orders optional symbol filterPython/Node.js/Java inherit validation automatically via Rust delegation.
Error
Test plan
AXTI,AAPL,"") → rejected before any network callAAPL.US,700.HK) → acceptedus_query_orderswith no symbol still works (optional field)