1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-23 15:19:38 +02: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:
Zach Gollwitzer 2024-07-16 09:26:49 -04:00 committed by GitHub
parent d0bc959bee
commit 47523f64c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 591 additions and 56 deletions

View file

@ -74,4 +74,13 @@ class AccountTest < ActiveSupport::TestCase
test "generates empty series if no balances and no exchange rate" do
assert_equal 0, @account.series(currency: "NZD").values.count
end
test "calculates shares owned of holding for date" do
account = accounts(:investment)
security = securities(:aapl)
assert_equal 10, account.holding_qty(security, date: Date.current)
assert_equal 10, account.holding_qty(security, date: 1.day.ago.to_date)
assert_equal 0, account.holding_qty(security, date: 2.days.ago.to_date)
end
end