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:
parent
d0bc959bee
commit
47523f64c2
32 changed files with 591 additions and 56 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue