Author

Topic: [ANN] bitprices : a price history reporting and auditing tool. (Read 1297 times)

full member
Activity: 201
Merit: 157
thx, if you get a chance please try it out with a real wallet (all addresses in wallet) and let me know how it goes for you.

Very cool project. I tried the pizza address and that is crazy to see the history.  I tried one of mine and it worked well.  Nice work.
hero member
Activity: 756
Merit: 500
Very cool project. I tried the pizza address and that is crazy to see the history.  I tried one of mine and it worked well.  Nice work.
full member
Activity: 201
Merit: 157
@patatas  I almost forgot.  I was messing around with toshi for a while before I settled on btcd, and I actually implemented a patch for filtering by address in toshi.   I submitted it but they wanted some changes I haven't had time to make, so for now the only way to get it is from my forked repo here:

https://github.com/dan-da/toshi

The pull request is here:
https://github.com/coinbase/toshi/pull/208
full member
Activity: 201
Merit: 157
Is the API Restful?

The only APIs referred to are those of bitcoin API providers such as blockchain.info, blockr.io, insight.bitpay.com, btcd, etc.  Each API differs, but for the most part they are RESTful, yes.

Quote
What about the scalability?

The bitprices CLI utility is a single threaded, single process program written in PHP.  It queries API providers for transaction history and queries bitcoinaverage.com for BTC price history.

Transaction history is normally queried once per input address.  ( though the internal interfaces support multiple addresses if the provider API does ).  The fastest and most scaleable way to run it is to query a local instance of btcd, which has been optimized for this use case in the latest release and supports filtering returned transaction inputs/outputs by the input address.   Even still, for addresses with thousands of transactions the queries can take some time.

The bitcoinaverage data is cached on disk after the first request each day, so is quite fast.

Quote
The command line interface could be used with default C++'s compiler?

I'm not sure what you mean.   The bitprices CLI is written in PHP and can be executed from any shell environment with a recent version of PHP installed.   See the included README.

Quote
I'm looking for an alternative to Toshi Fork ,having the unrelated inputs.outputs filtered is my first priority.

Then you will probably want to take a close look at btcd.  Specifically the searchrawtransactions API.  I submitted a patch that includes a new parameter filteraddrs which is a list of addresses.  Any inputs or outputs unrelated to those addresses will be filtered out.   The patch was included in btcd v0.12.0-beta.   Depending on your needs, it might help you.

Quote
Good project there man!

thx!
legendary
Activity: 1750
Merit: 1115
Providing AI/ChatGpt Services - PM!
Is the API Restful ? What about the scalability ? The analyzied patterns seem quite good.The command line interface could be used with default C++'s compiler ? I'm looking for an alternative to Toshi Fork ,having the unrelated inputs.outputs filtered is my first priority.Good project there man!
full member
Activity: 201
Merit: 157
New Release.

https://github.com/dan-da/bitprices/releases/tag/bitprices-v1.0.7

Minor bugfix release.

Changes:
539ef2b bump version to bitprices-v1.0.7
5d12f7e fix label of fiatinnow and fiatoutnow columns
full member
Activity: 201
Merit: 157
thx for the report.  yeah single address is a simple case and I wouldn't expect any issues.

It gets more involved when dealing with all of a wallet's addresses including change addresses and detecting intra-wallet transfers.  Particularly when multiple inputs (vin) are used in a transaction.

The main things to verify are that:

1) the report totals are the same whether --disable-transfer flag is present or not.   If they ever do not match, that would indicate a bug.

2) The total of the BTC amount column should match your wallet software's present balance.  For this to work, bitprices must be supplied with *all* of your wallet's addresses, including change addresses.


Along these lines, I'm actually looking for more real-world test cases.

If anyone has a set of wallet addresses from an old (maybe empty now) wallet you can share, that would be helpful.  You can PM me with them, or post, whichever.  If it's an HD wallet, just provide the master XPub.  Please include the final balance as reported by your wallet software. 


legendary
Activity: 1064
Merit: 1000
thanks.

Has anyone tried it with their own wallet addresses yet?

I'd like to get some reports of "yeah everything looks correct" or "hey I noticed a discrepancy".



Looks fine with a spare addy I am using, though I haven't done "extensive" testing yet.
full member
Activity: 201
Merit: 157
thanks.

Has anyone tried it with their own wallet addresses yet?

I'd like to get some reports of "yeah everything looks correct" or "hey I noticed a discrepancy".

legendary
Activity: 2424
Merit: 1147
wow - great work!!

Very easy to use, straight forward. It is good to look over the famous Bitcoin addresses Smiley
full member
Activity: 172
Merit: 100
Perfect! Great work! Added to my toolbox as well.
full member
Activity: 201
Merit: 157
I've introduced important new functionality in bitprices-v1.0.6.    ( and mybitprices.info )

The default reports include movements into and out of your wallet only.

In particular, movements to change addresses are not shown.  This greatly simplifies the reports and makes them look more like a bank statement.

bitprices splits rows where necessary to indicate 3rd party payments vs wallet transfers.  In other words it does calculations to determine how much of each transaction went to wallet addresses vs to external addresses.

The --include-transfer flag can be used to include the wallet transfers in reports. They will not be used in realized gain calculations (FIFO/LIFO) but will be included in column totals.

A new column "type" has been added that identifies movements as "purchase", "sale", or "transfer". 

If desired, the legacy behavior can be obtained by using the --disable-transfer flag. In this mode, wallet transfers will not be detected and rows will not be split.   This mode is useful for viewing exactly the inputs and outputs to each transaction, as they would appear on a block explorer.
full member
Activity: 201
Merit: 157
Thanks for the encouraging words.
legendary
Activity: 1064
Merit: 1000
Once again, amazing work. Being a person that generally does everything in CLI, I have nothing bad at all to say about it - does precisely what is printed on the tin and is sure to be yet another go-to tool in my box.
full member
Activity: 201
Merit: 157
I should also note that the tool can use multiple blockchain API services.  See the --api flag.   Toshi, Insight and btcd are supported.

btcd is the fastest and must be installed locally.  btcd v0.12.0-beta or higher is required, as they recently accepted a couple patches of mine.  thanks btcd guys!

toshi and insight are comparable (slow for large TX) and may be installed locally or accessed as a 3rd party service (default).  I submitted a pull request for a toshi optimization, but apparently it needs some more work before they will accept it.

bitcoin-core can not be used unfortunately because it does not provide any API for looking up addresses external to the local wallet.

By default bitprices uses https://bitcoin.toshi.io (3rd party service).

The mybitprices.info website uses a local btcd instance for fastest lookups.

Users concerned about privacy should use one of the local install options.



full member
Activity: 201
Merit: 157
bitprices is a command-line tool that generates transaction reports with the USD (fiat) value on the date of each transaction. As well as FIFO/LIFO disposal reports.  A web frontend is available.

I appreciate any testing, feedback, suggestions you can provide.

GitHub: https://github.com/dan-da/bitprices
Web Frontend: https://mybitprices.info/

I initially wrote this utility to find historic prices so that I could provide these to an accountant.  And it grew a bit from there.

Let's see a couple examples, shall we?

Price History Report

Code:
./bitprices.php --addresses=1M8s2S5bgAzSSzVTeL7zruvMPLvzSkEAuv -g

+------------+------------+------------------+-----------+-------------+----------------+---------------+
| Date       | Addr Short | BTC Amount       | USD Price | USD Amount  | USD Amount Now | USD Gain      |
+------------+------------+------------------+-----------+-------------+----------------+---------------+
| 2011-11-16 | 1M8..Auv   |  500000.00000000 |      2.46 |  1230000.00 |   188355000.00 |  187125000.00 |
| 2011-11-16 | 1M8..Auv   | -500000.00000000 |      2.46 | -1230000.00 |  -188355000.00 | -187125000.00 |
| 2013-11-26 | 1M8..Auv   |       0.00011000 |    913.95 |        0.10 |           0.04 |         -0.06 |
| 2013-11-26 | 1M8..Auv   |      -0.00011000 |    913.95 |       -0.10 |          -0.04 |          0.06 |
| 2014-11-21 | 1M8..Auv   |       0.00010000 |    351.95 |        0.04 |           0.04 |          0.00 |
| 2014-12-09 | 1M8..Auv   |       0.00889387 |    353.67 |        3.15 |           3.35 |          0.20 |
| 2015-06-05 | 1M8..Auv   |       0.44520000 |    226.01 |      100.62 |         167.71 |         67.09 |
| 2015-06-07 | 1M8..Auv   |       0.44917576 |    226.02 |      101.52 |         169.21 |         67.69 |
| 2015-10-17 | 1M8..Auv   |       0.00010000 |    270.17 |        0.03 |           0.04 |          0.01 |
| 2015-11-05 | 1M8..Auv   |       0.00010000 |    400.78 |        0.04 |           0.04 |          0.00 |
| Totals:    |            |       0.90356963 |           |      205.40 |         340.39 |        134.99 |
+------------+------------+------------------+-----------+-------------+----------------+---------------+

Many more columns and also column templates are available for this report.  Or specify your own columns in your own order.

note: This address was chosen for the example because it is a well known address listed on theopenledger.com as having the largest transaction ever.

Disposal Report

This is a disposal report for the same address as above. Default cost method (FIFO) is used.

Code:
./bitprices.php --addresses=1M8s2S5bgAzSSzVTeL7zruvMPLvzSkEAuv --report-type=schedule_d -g

+--------------------------+---------------+--------------------+------------+------------+-----------+-----------------+
| Description              | Date Acquired | Date Sold/Disposed | Proceeds   | Cost Basis | Gain/Loss | Short/Long-term |
+--------------------------+---------------+--------------------+------------+------------+-----------+-----------------+
| 500000.00000000 Bitcoins | 2011-11-16    | 2011-11-16         | 1230000.00 | 1230000.00 |      0.00 | Short           |
| 0.00011000 Bitcoins      | 2013-11-26    | 2013-11-26         |       0.10 |       0.10 |      0.00 | Short           |
|                          |               | Net Summary Long:  |       0.00 |       0.00 |      0.00 |                 |
|                          |               | Net Summary Short: | 1230000.10 | 1230000.10 |      0.00 |                 |
+--------------------------+---------------+--------------------+------------+------------+-----------+-----------------+


Daily exchange rates are obtained from bitcoinaverage.com. All fiat currencies supported by bitcoinaverage.com may be reported, not only USD.

Historic transaction data for each address is obtained from a blockchain API service provider, which can be either a third party service or something you run locally.

plenty more info at above links...

Disclaimer:

Use at your own risk.

The author makes no claims or guarantees of correctness. This software has not been reviewed or certified by a CPA.

The schedule D report is provided for informational purposes only and may not be accurate or applicable to your situation. You should NOT present these results to tax authorities. Instead, consult with a tax professional.


Jump to: