mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +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
|
@ -6,7 +6,7 @@ class Security < ApplicationRecord
|
|||
has_many :prices, dependent: :destroy
|
||||
|
||||
validates :ticker, presence: true
|
||||
validates :ticker, uniqueness: { scope: :exchange_mic, case_sensitive: false }
|
||||
validates :ticker, uniqueness: { scope: :exchange_operating_mic, case_sensitive: false }
|
||||
|
||||
class << self
|
||||
def search(query)
|
||||
|
@ -30,11 +30,15 @@ class Security < ApplicationRecord
|
|||
name: name,
|
||||
logo_url: logo_url,
|
||||
exchange_acronym: exchange_acronym,
|
||||
exchange_mic: exchange_mic,
|
||||
exchange_operating_mic: exchange_operating_mic,
|
||||
exchange_country_code: country_code
|
||||
)
|
||||
end
|
||||
|
||||
def has_prices?
|
||||
exchange_operating_mic.present?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def upcase_ticker
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue