Fix Quote currency in Asset and datetime parsing in csv import#578
Fix Quote currency in Asset and datetime parsing in csv import#578
Conversation
…nitial activity setup - Added useAssetProfile hook to fetch asset details when assetId is provided. - Updated initial activity construction to include asset data from the fetched profile, improving clarity and functionality.
…p for improved type safety
…et quote_ccy - Preserve case-sensitive minor-unit codes in canonicalization (GBp, GBX, ZAc) - Enforce MIC-derived quote currency for market equities/options/metals - Apply MIC currency enforcement across create/update/ensure flows - Repair existing/reused assets when stored quote_ccy or MIC is stale - Update enrichment to persist resolved quote_ccy instead of leaving it unchanged - Adjust activity asset-spec building to prefer MIC currency for market securities - Remove uppercase UI masking so GBp displays correctly in asset forms - Add tests for GBp preservation and MIC currency enforcement
…and format selection for CSV uploads
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17d8826895
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let normalized_mic = raw_mic.trim().to_uppercase(); | ||
| if !normalized_mic.is_empty() { | ||
| payload.instrument_exchange_mic = Some(normalized_mic.clone()); | ||
| if effective_quote_mode == QuoteMode::Market { | ||
| payload.quote_ccy = mic_to_currency(&normalized_mic).map(|ccy| ccy.to_string()); | ||
| } | ||
| } |
There was a problem hiding this comment.
Recompute quote currency after exchange MIC updates
When update_asset_profile receives a new instrument_exchange_mic for a market-priced asset, this branch now only normalizes/stores the MIC and never refreshes quote_ccy. Because later canonicalization is seeded with the existing currency, changing an asset from one exchange to another can leave a stale quote currency (for example USD after switching to XLON), which then drives incorrect pricing and FX conversion behavior.
Useful? React with 👍 / 👎.
| const parsed = parse(trimmed, pattern, new Date()); | ||
| if (isValid(parsed)) return parsed.toISOString(); |
There was a problem hiding this comment.
Avoid UTC day shifts when parsing configured date formats
date-fns parse() returns a local-time Date, and immediately calling toISOString() converts that local midnight/time to UTC. For date-only and naive datetime CSV values, users outside UTC can get an off-by-one calendar day in the stored import timestamp (and downstream idempotency/date matching), even when the source CSV date itself is correct.
Useful? React with 👍 / 👎.
…in activity mutation hooks and service logic
Checklist
Contributor License Agreement.
By submitting this PR, I agree to the
CLA.