MoneyTools / MyMoney.Net

MyMoney is a rich client .NET ClickOnce application for managing your personal finances. It is written entirely in C# and is designed for programmers who want easy access to their data and who want to quickly and easily add their own features. Your data will not be locked up in some proprietary format, it is yours to do with as you like.
https://moneytools.github.io/MyMoney.Net/
68 stars 21 forks source link

Historical view #28

Closed andreva7 closed 2 years ago

andreva7 commented 2 years ago

Add support to view the value of the whole portfolio and accounts at a date in the past.

A dynamic implementation would likely be very hard. But a simple solution that solves the immediate problem would be to support a filter date when opening a database. When a date is set, all transactions after that date are simply not loaded. The other feature necessary would be to set all the stock prices based o that filter date. That would work as I believe we keep the whole stock price history for each stock. As a safety, this mode could possibly automatically disable the save option so people don't accidentally through away years of recent transactions.

clovett commented 2 years ago

Great idea, I've wanted to do this also, should not be difficult now that we have stock quote history and we already have a class that can compute the value of the portfolio at a given date based on this, just need the UI for it...

andreva7 commented 2 years ago

Would still be very useful to me as I am working on financial deliverables to my lawyer

clovett commented 2 years ago

See https://github.com/clovett/MyMoney.Net/pull/53

Let me know if you can try it out before I publish a new version in case there's any bugs...

@jpdup might be interested in this PR also.

andreva7 commented 2 years ago

28 was to solve a different problem.

For example, I want to see how many shares I owned in an account as a particular date. The bigger picture, which I what I need, is to show all the shares I owned and all the cash I had across all accounts on a particular date. Essentially, net worth, on a specific day in the past. But then I want to see it by account also. And ideally, I don't want see anything that happened after that date.

Basically, I want to see the state of the world on some day in 2012.

I think the simple approach is to trim all transactions that happen after that day. A cooler approach would be to create a filter on the transaction reader, but that may be complicated to plum across all the code that enumerates through all transactions, unless there is a way to put that deep in the enumeration method.

-Andre

From: Chris Lovett @.> Sent: August 11, 2022 12:07 AM To: clovett/MyMoney.Net @.> Cc: andreva7 @.>; Author @.> Subject: Re: [clovett/MyMoney.Net] Historical view (Issue #28)

Closed #28https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fclovett%2FMyMoney.Net%2Fissues%2F28&data=05%7C01%7C%7C3b69fb57461245a825d908da7b680c41%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637957984065580804%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=55ZGm0SJL08njs%2FpAwsVcAjl0zwqeq63sXn9d4gHJJ8%3D&reserved=0 as completed via #53https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fclovett%2FMyMoney.Net%2Fpull%2F53&data=05%7C01%7C%7C3b69fb57461245a825d908da7b680c41%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637957984065580804%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=zVruoaBYJA6dSQWCSDIOJknGuy5r8VO82riujn8D32E%3D&reserved=0.

- Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fclovett%2FMyMoney.Net%2Fissues%2F28%23event-7169208116&data=05%7C01%7C%7C3b69fb57461245a825d908da7b680c41%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637957984065580804%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=U2zQCqk2wBXgmsUoFzMIsyMjkIe9nDn8HOIon1RsyD0%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJBV66GWGZWELEQOAYD4FRLVYSRAHANCNFSM5O35RJWQ&data=05%7C01%7C%7C3b69fb57461245a825d908da7b680c41%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637957984065580804%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ON3ZnKuWI0rVgE1YM8ZRyyCE9TnWOVtHf4pHiSvqAe8%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

lovettchris commented 2 years ago

Yes, I don't have it across all accounts, but the new TrendGraph on investment accounts, if you export it to .csv will give you the exact market value of the account on each date you care to look at in that .csv file.

clovett commented 2 years ago

But yes, I can add some options on the Reports so that you can view the state of your portfolio at a given date...

clovett commented 2 years ago

@andreva7, See https://github.com/clovett/MyMoney.Net/pull/54 for a work in progress... if you have a way of coroborating the numbers reported there with some other documents you have it would be a great test.

andreva7 commented 2 years ago

Debugging without looking at the code … 😊

I am guessing the networth report start with all accounts with a non-zero value, and then figures out their value at that earlier date. I have many accounts that have zero value today, but had a value back then.

-Andre

From: Chris Lovett @.> Sent: August 11, 2022 9:47 PM To: clovett/MyMoney.Net @.> Cc: andreva7 @.>; Mention @.> Subject: Re: [clovett/MyMoney.Net] Historical view (Issue #28)

@andreva7https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fandreva7&data=05%7C01%7C%7C3b3216e91f5e4268661008da7c1db8f9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637958764338470854%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ba9TQKzezHaFgjo%2B86E4gmZZU1V8LcfV7wrNDQTaU1g%3D&reserved=0, See #54https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fclovett%2FMyMoney.Net%2Fpull%2F54&data=05%7C01%7C%7C3b3216e91f5e4268661008da7c1db8f9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637958764338470854%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NxZvRKKMzHINO0a1XoTeZWFpWu%2BQB3%2ByIm0yTh8ywBQ%3D&reserved=0 for a work in progress... if you have a way of coroborating the numbers reported there with some other documents you have it would be a great test.

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fclovett%2FMyMoney.Net%2Fissues%2F28%23issuecomment-1212725708&data=05%7C01%7C%7C3b3216e91f5e4268661008da7c1db8f9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637958764338470854%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=FdmRdFbvoKq%2FpnbNCBFocfE1SzOq00vhnOT3xj1l%2FLs%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJBV66AA5ZLG747KOSKDITDVYXJNBANCNFSM5O35RJWQ&data=05%7C01%7C%7C3b3216e91f5e4268661008da7c1db8f9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637958764338470854%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=BOdqlDv6u1stP5bSJaqmiR8sFHelQqjAHXX4yVAG5fs%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

clovett commented 2 years ago

It always has to start with the oldest transactions and move forwards so that it can apply stock splits at the right time on the remaining units at the point of the stock split, the change in the PR then is to simply stop at the given date rather than going all the way through to today, then also lookup the stock prices for that date rather than using the latest stock prices.

andreva7 commented 2 years ago

I bought a house in 2010, sold it in 2021. The value of that account is now $0. When I select net worth for 2012, the house does not show up on the list of Assets.

clovett commented 2 years ago

I just pushed a possible fix, there was a check that the asset account balance was > 0, it now checks >= 0

jpdup commented 2 years ago

Yes nice feature to have

clovett commented 2 years ago

@jpdup I pushed some fixes to how I was computing historical value of loan accounts, I had to refactor some stuff in Money_loan.cs. I added a new abstraction named "Loan" so that I can avoid having to do the very expensive GetLoanPaymentsAggregation too many times.

jpdup commented 2 years ago

@clovett thanks for the refactor

andreva7 commented 2 years ago

Looks good

andreva7 commented 2 years ago

I am testing with this change.

I am comparing this version vs the published version. For some reason, without applying any filter, the two versions report a different number for "liabilities ->credit". I am trying to go through all the balances of my accounts to figure out if there is another liability somewhere, which is where I hit the "balance column" missing.

-Andre

From: Chris Lovett @.> Sent: August 12, 2022 1:00 AM To: clovett/MyMoney.Net @.> Cc: andreva7 @.>; Mention @.> Subject: Re: [clovett/MyMoney.Net] Historical view (Issue #28)

I just pushed a possible fix, there was a check that the asset account balance was > 0, it now checks >= 0

- Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fclovett%2FMyMoney.Net%2Fissues%2F28%23issuecomment-1212837905&data=05%7C01%7C%7C37e05e98fb134ae37cd708da7c38a3f7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637958879959757082%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=GVDZ6DVt2HjzzJo6ryBX8Ba%2FXfiLCX3MsBRwa6VntrY%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJBV66CFF4GA6ROT7TJXTVTVYX77TANCNFSM5O35RJWQ&data=05%7C01%7C%7C37e05e98fb134ae37cd708da7c38a3f7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637958879959757082%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=6UYFDtIbyP7MHdWXsz3KCJhY6MmGUhXPvoOMV4NJMpQ%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>