Skip to content

Generate a beancount file with transaction history for a descriptor - #58

Merged
ChristopherA merged 24 commits into
BlockchainCommons:masterfrom
nochiel:beancounter
May 3, 2022
Merged

Generate a beancount file with transaction history for a descriptor#58
ChristopherA merged 24 commits into
BlockchainCommons:masterfrom
nochiel:beancounter

Conversation

@nochiel

@nochielnochiel commented Apr 27, 2022

Copy link
Copy Markdown
Contributor

This PR builds on #55.

Given an output descriptor, we would like to:

  • Generate addresses derived from that descriptor up to some gap size.
  • Obtain a transaction history for the generated addresses.
  • Output a beancount report file with transaction ('trading') history. The beancount transactions should have fiat amounts for the bitcoin transactions at the exchange rate at the time the transaction was made.

TODO (In subsequent PRs after this is merged)

  • Blockchain Commons and @ChristopherA should confirm what additional accounting data should be in the beancount file.

  • Tests for each descriptor type. Ensure that Spotbit can generate valid addresses supported by BDK.

    • Ensure that Spotbit can generate addresses from descriptors used by Bitcoin Core.
  • UI: Add beancount UX to web front-end.

  • Package spotbit as an executable.

Example:

python app.py beancount "wpkh(tpubD9hudZxy8Uj3453QrsEbr8KiyXTYC5ExHjJ5sNDVW7yKJ8wc7acKQcpdbvZX6dFerHK6MfVvs78VvGfotjN28yC4ij6nr4uSVhX2qorUV8V/0/*)"

Outputs: spotbit.beancount

2008-10-31 commodity BTC
name: "Bitcoin"
asset-class: "cryptocurrency"
2018-04-02 open Assets:BTC	BTC
2018-04-02 open Liabilities:Cash:USDT	USDT
2018-04-02 * "tb1qcrekknrspx28t9vl53ltsag5gqgqdj066ydf75" "Transaction hash: 2a2f7f24761fa54cb6e559efea5678415d9cbbabc42e6a4e2ce463ee3c446230"
Assets:BTC 1.00000000 BTC { 6935.16 USDT }
Liabilities:Cash:USDT	- 6935.16 USDT 2018-04-02 * "tb1q45whzx3emntntnpzjdx3gzj6z5cgxakkg7s3sa" "Transaction hash: 387123efcaa707759a4af8159cb1309fae86b793d26b5fd8bba42637852dde89"
Assets:BTC	- 0.36300616 BTC @ 6935.16 USDT Liabilities:Cash:USDT 2517.51 USDT 2018-04-02 * "tb1qgv5484m83e2mzz3n8tf4snvnwj5qgqgampnhvv" "Transaction hash: 387123efcaa707759a4af8159cb1309fae86b793d26b5fd8bba42637852dde89"
Assets:BTC	- 0.63699243 BTC @ 6935.16 USDT Liabilities:Cash:USDT 4417.64 USDT 2018-04-02 * "tb1q45whzx3emntntnpzjdx3gzj6z5cgxakkg7s3sa" "Transaction hash: 387123efcaa707759a4af8159cb1309fae86b793d26b5fd8bba42637852dde89"
Assets:BTC 0.36300616 BTC { 6935.16 USDT }
Liabilities:Cash:USDT	- 2517.51 USDT 

References

@nochielnochiel changed the title WIP: Generate a beancount file with transaction histories for a descriptorWIP: Generate a beancount file with transaction history for a descriptorApr 27, 2022
Propagate a useful error to the command line.
Raise an error from get_candles_at_dates if ccxt doesn't return any data
for a request.
@nochiel

Copy link
Copy Markdown
ContributorAuthor

@icculp If you have time, here's another PR that could benefit from your review. 😄

@ChristopherA

Copy link
Copy Markdown
Contributor

@nochiel Ready for merge?

@nochielnochiel changed the title WIP: Generate a beancount file with transaction history for a descriptorGenerate a beancount file with transaction history for a descriptorMay 3, 2022
@nochiel

Copy link
Copy Markdown
ContributorAuthor

@nochiel Ready for merge?

Yes, it is. Thanks. 👍🏾

@ChristopherAChristopherA left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR was reviewed by an external volunteer, @hanhungsoo. As this project is still technically still "Late Alpha" and the current online version is unstable, I am going ahead and committing this PR to the master branch without additional review.

@shannona — we should tag this commit.

@ChristopherA
ChristopherA merged commit c62901b into BlockchainCommons:masterMay 3, 2022
@nochielnochiel mentioned this pull request May 3, 2022
23 tasks
Sign up for freeto 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.

2 participants

@nochiel@ChristopherA