1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-05 21:45:23 +02:00

Enhance security information retrieval and handling (#1826)

* Enhance security information retrieval and handling

- Add support for operating MIC codes in security info fetching
- Update security uniqueness validation to handle unknown securities
- Improve security creation and update logic in Plaid investment sync
- Update combobox and view components to handle operating MIC codes
- Add unknown flag for securities with incomplete information

* Update schema.rb

* Refactor the need for mic codes

* Don't fetch prices unless a security has the necessary mic code

* Deduplication

* Lint

* Update Securities and Plaid Investment Sync

- Modify PlaidInvestmentSync to return plaid_security for USD cash
- Add non-null constraint to Securities ticker column
- Update Securities fixture to use exchange_operating_mic instead of exchange_mic

---------

Signed-off-by: Josh Pigford <josh@joshpigford.com>
This commit is contained in:
Josh Pigford 2025-02-11 10:40:30 -06:00 committed by GitHub
parent fb6c6fa6bb
commit 68d7cb5de6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 203 additions and 31 deletions

View file

@ -82,12 +82,15 @@ class PlaidInvestmentSync
end
return [ nil, nil ] if plaid_security.nil? || plaid_security.ticker_symbol.blank?
return [ nil, plaid_security ] if plaid_security.ticker_symbol == "CUR:USD" # internally, we do not consider cash a security and track it separately
operating_mic = plaid_security.market_identifier_code
# Find any matching security
security = Security.find_or_create_by!(
ticker: plaid_security.ticker_symbol,
exchange_mic: plaid_security.market_identifier_code || "XNAS",
country_code: "US"
) unless plaid_security.ticker_symbol == "CUR:USD" # internally, we do not consider cash a security and track it separately
exchange_operating_mic: operating_mic
)
[ security, plaid_security ]
end