Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookkeeper Dashboard #75

Open
wants to merge 55 commits into
base: Release-0.0.7
Choose a base branch
from

Conversation

evansmj
Copy link
Contributor

@evansmj evansmj commented Oct 1, 2024

This adds 4 new features:

bookkeeper/balancesheet
bookkeeper/satsflow
bookkeeper/volume
bookkeeper/terminal

and a /bookkeeper landing page

@evansmj evansmj changed the base branch from Release-0.0.7 to Release-0.0.6 October 1, 2024 00:43
@evansmj evansmj changed the base branch from Release-0.0.6 to Release-0.0.7 October 1, 2024 00:44
@evansmj
Copy link
Contributor Author

evansmj commented Oct 21, 2024

Time granularity designs:
Screenshot 2024-10-20 at 10 45 56 PM
Screenshot 2024-10-20 at 10 43 54 PM
Screenshot 2024-10-20 at 10 45 45 PM
Screenshot 2024-10-20 at 10 44 03 PM

@evansmj evansmj force-pushed the evansmj/sats-flow branch 2 times, most recently from 5f2b6b2 to 645e506 Compare December 26, 2024 13:31
@evansmj
Copy link
Contributor Author

evansmj commented Dec 26, 2024

Screenshot 2024-12-26 at 3 39 22 PM

Landing

This commit uses the `sql` rpc command to fetch the data for the Balance Sheet.

getBalanceSheet() was added to use-http.ts as a standalone function instead of getting it via AppContext so that we can pass parameters more easily to it.  TimeGranularity represents the way we should group the data e.g. Monthly, Weekly, Daily.

The sql needs to be transformed for the balance sheet, this was done in a new file bookkeeper-transform.ts since it takes some effort.  Future transform functions such as for Sats Flow would go in this file.  transformToBalanceSheet() is complex because we are limited in what methods we can use in the `sql` rpc call, so I need to do things like grouping and aggregation of credits - debits.
…ont want sendRequest()'s in the dependency array
Refactor getPeriodKey to reusable function.
Draw net inflow line properly
Refactor calculations
@evansmj
Copy link
Contributor Author

evansmj commented Dec 26, 2024

Screenshot 2024-12-26 at 2 57 20 PM Balance Sheet

@evansmj
Copy link
Contributor Author

evansmj commented Dec 26, 2024

Screenshot 2024-12-26 at 3 25 47 PM Sats Flow

@evansmj
Copy link
Contributor Author

evansmj commented Dec 26, 2024

Volume
Screenshot 2024-12-26 at 3 29 14 PM

@evansmj
Copy link
Contributor Author

evansmj commented Dec 26, 2024

Screenshot 2024-12-26 at 3 27 05 PM Terminal

@chrisguida
Copy link

Wow! Very impressive PR, thanks for putting this together @evansmj!

Just some quick comments and ideas for future improvement:

  • The .js files should not be included, and the docs should tell the user to build the code first before running (or maybe npm install --omit dev and npm run start already do the build?)
  • I love the terminal tab! It would be great if it could display an actual table instead of raw json
    • It would also be great if you could provide some useful examples, like select account, sum(credit_msat)/1000 - sum(debit_msat)/1000 from bkpr_income group by account;
  • Relatedly to the above, it would be great if there were more grouping/filtering options in the satsflow and the balance sheet, to see exactly how much money flowed into and out of each account, not just the entire node.
  • One thing people will want this for is calculating capital gains taxes on their Lightning nodes, so it would be neat to be able to see fiat values as well (though exporting to CSV and importing to tax software could solve this as well).

Anyway this PR is already super useful, @ShahanaFarooqui what needs to happen to get this merged? :)

@ShahanaFarooqui
Copy link
Collaborator

Anyway this PR is already super useful, @ShahanaFarooqui what needs to happen to get this merged? :)

Apologies for not having reviewed it yet. I was hoping to have done so by now, but I got caught up fixing CI issues caused by updates to Poetry and Ubuntu on GitHub Actions. Hopefully, I will be able to review it by the end of this week.

@evansmj
Copy link
Contributor Author

evansmj commented Jan 21, 2025

Hey @ShahanaFarooqui, I noticed the apps/frontend/build folder has been previously committed to the repo. Is this on purpose? This means that if someone runs npm run start without knowing to first build the newer changes, they will not see the latest changes. That is what happened to @chrisguida.

@evansmj
Copy link
Contributor Author

evansmj commented Jan 21, 2025

Thanks @chrisguida I added your suggestions as issues here and will get to them in a later update.

#81
#79
#80

Regarding the csv dump, for v2 I am planning to add functionality for the remaining bookkeeper commands:
bkpr-dumpincomecsv
bkpr-channelsapy
bkpr-editdescriptionbyoutpoint
bkpr-editdescriptionbypaymentid
bkpr-inspect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants