mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-06 14:05:20 +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
|
@ -8,6 +8,7 @@ module Security::Price::Provided
|
|||
|
||||
def fetch_price_from_provider(security:, date:, cache: false)
|
||||
return nil unless security_prices_provider.present?
|
||||
return nil unless security.has_prices?
|
||||
|
||||
response = security_prices_provider.fetch_security_prices \
|
||||
ticker: security.ticker,
|
||||
|
@ -32,6 +33,7 @@ module Security::Price::Provided
|
|||
def fetch_prices_from_provider(security:, start_date:, end_date:, cache: false)
|
||||
return [] unless security_prices_provider.present?
|
||||
return [] unless security
|
||||
return [] unless security.has_prices?
|
||||
|
||||
response = security_prices_provider.fetch_security_prices \
|
||||
ticker: security.ticker,
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
class Security::SynthComboboxOption
|
||||
include ActiveModel::Model
|
||||
|
||||
attr_accessor :symbol, :name, :logo_url, :exchange_acronym, :exchange_mic, :exchange_country_code
|
||||
attr_accessor :symbol, :name, :logo_url, :exchange_acronym, :exchange_country_code, :exchange_operating_mic
|
||||
|
||||
def id
|
||||
"#{symbol}|#{exchange_mic}|#{exchange_acronym}|#{exchange_country_code}" # submitted by combobox as value
|
||||
"#{symbol}|#{exchange_operating_mic}" # submitted by combobox as value
|
||||
end
|
||||
|
||||
def to_combobox_display
|
||||
"#{symbol} - #{name} (#{exchange_acronym})" # shown in combobox input when selected
|
||||
display_code = exchange_acronym.presence || exchange_operating_mic
|
||||
"#{symbol} - #{name} (#{display_code})" # shown in combobox input when selected
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue