Normalize OCC option symbols from broker sync to compact format#738
Normalize OCC option symbols from broker sync to compact format#738triantos wants to merge 2 commits intoafadil:mainfrom
Conversation
Strip the weight suffix from metal instrument symbols before passing them to price providers. XAU-500G and XAU-1KG were being sent as-is, causing both Yahoo and Metal Price API lookups to fail with "no providers available". The weight conversion is already handled separately by metal_weight_oz().
|
[P2] Option symbol normalization is already handled downstream
This looks redundant now. If we keep any normalization at this layer, it should call the shared
**[P1] Metal weight is dropped during pricing
I don’t think the metal change is safe to merge as written.** So I agree with normalizing for provider lookup, but we also need a weight-aware adjustment before merging this, for example by scaling latest/historical metal quotes by |
contract_multiplier() now returns metal_weight_oz() for precious metals, so that weight-suffixed symbols like XAU-500G (16.075 oz) and XAU-1KG (32.151 oz) are valued correctly when priced against a per-troy-oz spot quote. Previously metal_weight_oz() existed but was never called in any valuation path.
4d9b476 to
89de31b
Compare
|
Re option normalization: OK, yes this is no longer needed now that you've merged my other change and normalize_option_symbol(). On the topic of metals, this got lost during one of my refactors. Sorry. I have fixed with an updated [trivial] commit. |
Summary
GE 270115C00340000) which creates duplicate assets when the same contract also appears in compact form (GE270115C00340000)parse_occ_symbol()utility and rebuild in compact format viabuild_occ_symbol()to ensure consistent asset identityTest plan