1
0
Fork 0
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:
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

@ -0,0 +1,6 @@
class AddExchangeOperatingMicToSecurities < ActiveRecord::Migration[7.2]
def change
add_column :securities, :exchange_operating_mic, :string
add_index :securities, :exchange_operating_mic
end
end

View file

@ -0,0 +1,6 @@
class AdjustSecuritiesIndexes < ActiveRecord::Migration[7.2]
def change
remove_index :securities, name: "index_securities_on_ticker_and_exchange_mic"
add_index :securities, [ :ticker, :exchange_operating_mic ], unique: true
end
end

View file

@ -0,0 +1,5 @@
class MakeTickerNotNull < ActiveRecord::Migration[7.2]
def change
change_column_null :securities, :ticker, false
end
end

8
db/schema.rb generated
View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.2].define(version: 2025_02_07_014022) do
ActiveRecord::Schema[7.2].define(version: 2025_02_11_161238) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
@ -542,7 +542,7 @@ ActiveRecord::Schema[7.2].define(version: 2025_02_07_014022) do
end
create_table "securities", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "ticker"
t.string "ticker", null: false
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
@ -550,8 +550,10 @@ ActiveRecord::Schema[7.2].define(version: 2025_02_07_014022) do
t.string "exchange_mic"
t.string "exchange_acronym"
t.string "logo_url"
t.string "exchange_operating_mic"
t.index ["country_code"], name: "index_securities_on_country_code"
t.index ["ticker", "exchange_mic"], name: "index_securities_on_ticker_and_exchange_mic", unique: true
t.index ["exchange_operating_mic"], name: "index_securities_on_exchange_operating_mic"
t.index ["ticker", "exchange_operating_mic"], name: "index_securities_on_ticker_and_exchange_operating_mic", unique: true
end
create_table "security_prices", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|