mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-03 04:25:21 +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:
parent
fb6c6fa6bb
commit
68d7cb5de6
15 changed files with 203 additions and 31 deletions
|
@ -145,6 +145,7 @@ class Provider::Synth
|
|||
logo_url: security.dig("logo_url"),
|
||||
exchange_acronym: security.dig("exchange", "acronym"),
|
||||
exchange_mic: security.dig("exchange", "mic_code"),
|
||||
exchange_operating_mic: security.dig("exchange", "operating_mic_code"),
|
||||
country_code: security.dig("exchange", "country_code")
|
||||
}
|
||||
end
|
||||
|
@ -155,9 +156,10 @@ class Provider::Synth
|
|||
raw_response: response
|
||||
end
|
||||
|
||||
def fetch_security_info(ticker:, mic_code:)
|
||||
def fetch_security_info(ticker:, mic_code: nil, operating_mic: nil)
|
||||
response = client.get("#{base_url}/tickers/#{ticker}") do |req|
|
||||
req.params["mic_code"] = mic_code
|
||||
req.params["mic_code"] = mic_code if mic_code.present?
|
||||
req.params["operating_mic"] = operating_mic if operating_mic.present?
|
||||
end
|
||||
|
||||
parsed = JSON.parse(response.body)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue