mirror of
https://github.com/we-promise/sure.git
synced 2026-04-22 05:24:11 +00:00
Investment Portfolio Sync (#974)
* Add investment portfolio models * Add portfolio to demo data * Setup initial tests * Rough sketch of sync logic * Clean up trade sync logic * Add trade validation * Integrate trades into sync process
This commit is contained in:
46
db/schema.rb
generated
46
db/schema.rb
generated
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_07_09_152243) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_07_10_184249) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
@@ -48,6 +48,21 @@ ActiveRecord::Schema[7.2].define(version: 2024_07_09_152243) do
|
||||
t.index ["transfer_id"], name: "index_account_entries_on_transfer_id"
|
||||
end
|
||||
|
||||
create_table "account_holdings", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.uuid "account_id", null: false
|
||||
t.uuid "security_id", null: false
|
||||
t.date "date"
|
||||
t.decimal "qty", precision: 19, scale: 4
|
||||
t.decimal "price", precision: 19, scale: 4
|
||||
t.decimal "amount", precision: 19, scale: 4
|
||||
t.string "currency"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["account_id", "security_id", "date", "currency"], name: "idx_on_account_id_security_id_date_currency_234024c8e3", unique: true
|
||||
t.index ["account_id"], name: "index_account_holdings_on_account_id"
|
||||
t.index ["security_id"], name: "index_account_holdings_on_security_id"
|
||||
end
|
||||
|
||||
create_table "account_syncs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.uuid "account_id", null: false
|
||||
t.string "status", default: "pending", null: false
|
||||
@@ -60,6 +75,15 @@ ActiveRecord::Schema[7.2].define(version: 2024_07_09_152243) do
|
||||
t.index ["account_id"], name: "index_account_syncs_on_account_id"
|
||||
end
|
||||
|
||||
create_table "account_trades", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.uuid "security_id", null: false
|
||||
t.decimal "qty", precision: 19, scale: 4
|
||||
t.decimal "price", precision: 19, scale: 4
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["security_id"], name: "index_account_trades_on_security_id"
|
||||
end
|
||||
|
||||
create_table "account_transactions", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
@@ -321,6 +345,23 @@ ActiveRecord::Schema[7.2].define(version: 2024_07_09_152243) do
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "securities", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.string "isin", null: false
|
||||
t.string "symbol"
|
||||
t.string "name"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "security_prices", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.string "isin"
|
||||
t.date "date"
|
||||
t.decimal "price", precision: 19, scale: 4
|
||||
t.string "currency", default: "USD"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "settings", force: :cascade do |t|
|
||||
t.string "var", null: false
|
||||
t.text "value"
|
||||
@@ -373,7 +414,10 @@ ActiveRecord::Schema[7.2].define(version: 2024_07_09_152243) do
|
||||
add_foreign_key "account_balances", "accounts", on_delete: :cascade
|
||||
add_foreign_key "account_entries", "account_transfers", column: "transfer_id"
|
||||
add_foreign_key "account_entries", "accounts"
|
||||
add_foreign_key "account_holdings", "accounts"
|
||||
add_foreign_key "account_holdings", "securities"
|
||||
add_foreign_key "account_syncs", "accounts"
|
||||
add_foreign_key "account_trades", "securities"
|
||||
add_foreign_key "account_transactions", "categories", on_delete: :nullify
|
||||
add_foreign_key "account_transactions", "merchants"
|
||||
add_foreign_key "accounts", "families"
|
||||
|
||||
Reference in New Issue
Block a user