1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 23:59:40 +02:00

feat: add crypto account type to demo data (#555)

* feat: add crypto account type to demo data

* fix: set currency to BTC, revert schema migration change and fix tests

* fix: update dates in time_series tests
This commit is contained in:
Juan B. Rodriguez 2024-03-19 14:34:35 -05:00 committed by GitHub
parent f904d9d062
commit 49d1fe0e11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 55 additions and 4 deletions

View file

@ -219,6 +219,24 @@ namespace :demo_data do
brokerage.sync
crypto = Account.find_or_create_by(name: "Bitcoin Account") do |a|
a.family = family
a.accountable = Account::Crypto.new
a.currency = "BTC"
a.balance = 0.1
end
crypto_valuations = [
{ date: 1.year.ago.to_date, value: 0.05, currency: "BTC" },
{ date: 200.days.ago.to_date, value: 0.06, currency: "BTC" },
{ date: 100.days.ago.to_date, value: 0.08, currency: "BTC" },
{ date: 20.days.ago.to_date, value: 0.1, currency: "BTC" }
]
crypto.valuations.upsert_all(crypto_valuations, unique_by: :index_valuations_on_account_id_and_date)
crypto.sync
mortgage = Account.find_or_create_by(name: "Demo Mortgage") do |a|
a.family = family
a.accountable = Account::Loan.new