1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 15:49:39 +02:00

Stock imports (#1363)

* Initial pass

* Marketstack data provider

* Marketstack data provider

* Refactor a bit
This commit is contained in:
Josh Pigford 2024-10-24 16:36:50 -05:00 committed by GitHub
parent b611dfdf37
commit aa3342b0dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 187 additions and 1 deletions

View file

@ -0,0 +1,7 @@
class AddStockExchangeReference < ActiveRecord::Migration[7.2]
def change
add_column :securities, :country_code, :string
add_reference :securities, :stock_exchange, type: :uuid, foreign_key: true
add_index :securities, :country_code
end
end

7
db/schema.rb generated
View file

@ -119,7 +119,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_10_24_142537) do
t.boolean "is_active", default: true, null: false
t.date "last_sync_date"
t.uuid "institution_id"
t.virtual "classification", type: :string, as: "\nCASE\n WHEN ((accountable_type)::text = ANY ((ARRAY['Loan'::character varying, 'CreditCard'::character varying, 'OtherLiability'::character varying])::text[])) THEN 'liability'::text\n ELSE 'asset'::text\nEND", stored: true
t.virtual "classification", type: :string, as: "\nCASE\n WHEN ((accountable_type)::text = ANY (ARRAY[('Loan'::character varying)::text, ('CreditCard'::character varying)::text, ('OtherLiability'::character varying)::text])) THEN 'liability'::text\n ELSE 'asset'::text\nEND", stored: true
t.uuid "import_id"
t.string "mode"
t.index ["accountable_id", "accountable_type"], name: "index_accounts_on_accountable_id_and_accountable_type"
@ -478,6 +478,10 @@ ActiveRecord::Schema[7.2].define(version: 2024_10_24_142537) do
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "country_code"
t.uuid "stock_exchange_id"
t.index ["country_code"], name: "index_securities_on_country_code"
t.index ["stock_exchange_id"], name: "index_securities_on_stock_exchange_id"
end
create_table "security_prices", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
@ -599,6 +603,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_10_24_142537) do
add_foreign_key "imports", "families"
add_foreign_key "institutions", "families"
add_foreign_key "merchants", "families"
add_foreign_key "securities", "stock_exchanges"
add_foreign_key "sessions", "impersonation_sessions", column: "active_impersonator_session_id"
add_foreign_key "sessions", "users"
add_foreign_key "taggings", "tags"