Bitcoin Forum
May 05, 2024, 12:59:50 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [ANN] bitprices : a price history reporting and auditing tool.  (Read 1297 times)
danda (OP)
Full Member
***
Offline Offline

Activity: 201
Merit: 157


View Profile WWW
February 10, 2016, 06:21:40 PM
Last edit: February 11, 2016, 07:28:03 AM by danda
 #1

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.



mybitprices.info - wallet auditing   |  hd-wallet-derive - derive keys locally |  hd-wallet-addrs - find used addrs
lightning-nodes - list of LN nodes  |  coinparams - params for 300+ alts  |  jsonrpc-cli - cli jsonrpc client
subaddress-derive-xmr - monero offline wallet tool
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714913990
Hero Member
*
Offline Offline

Posts: 1714913990

View Profile Personal Message (Offline)

Ignore
1714913990
Reply with quote  #2

1714913990
Report to moderator
danda (OP)
Full Member
***
Offline Offline

Activity: 201
Merit: 157


View Profile WWW
February 10, 2016, 06:43:12 PM
 #2

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.




mybitprices.info - wallet auditing   |  hd-wallet-derive - derive keys locally |  hd-wallet-addrs - find used addrs
lightning-nodes - list of LN nodes  |  coinparams - params for 300+ alts  |  jsonrpc-cli - cli jsonrpc client
subaddress-derive-xmr - monero offline wallet tool
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
February 10, 2016, 08:07:19 PM
 #3

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.


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
danda (OP)
Full Member
***
Offline Offline

Activity: 201
Merit: 157


View Profile WWW
February 11, 2016, 12:00:22 AM
 #4

Thanks for the encouraging words.

mybitprices.info - wallet auditing   |  hd-wallet-derive - derive keys locally |  hd-wallet-addrs - find used addrs
lightning-nodes - list of LN nodes  |  coinparams - params for 300+ alts  |  jsonrpc-cli - cli jsonrpc client
subaddress-derive-xmr - monero offline wallet tool
danda (OP)
Full Member
***
Offline Offline

Activity: 201
Merit: 157


View Profile WWW
February 14, 2016, 05:55:07 PM
 #5

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.

mybitprices.info - wallet auditing   |  hd-wallet-derive - derive keys locally |  hd-wallet-addrs - find used addrs
lightning-nodes - list of LN nodes  |  coinparams - params for 300+ alts  |  jsonrpc-cli - cli jsonrpc client
subaddress-derive-xmr - monero offline wallet tool
xqus
Full Member
***
Offline Offline

Activity: 172
Merit: 100



View Profile
February 14, 2016, 06:03:57 PM
 #6

Perfect! Great work! Added to my toolbox as well.

PGP fingerprint: B17233A1 || Bitrated user: xqus ≡ Free trust agent || LocalBitcoins ≡ Buy bitcoins locally
Wallet and Exchange security ≡ A security overview of wallets and exchanges. (forum thread)
batesresearch
Legendary
*
Offline Offline

Activity: 2424
Merit: 1147


View Profile WWW
February 18, 2016, 04:37:38 PM
 #7

wow - great work!!

Very easy to use, straight forward. It is good to look over the famous Bitcoin addresses Smiley

Visit Satoshi's Place, a Bitcoin Hub based in Bury, Manchester, UK.
Website: https://satoshisplace.co.uk
Goals: Educate & Onboard users in to Bitcoin. Lightning network⚡️
danda (OP)
Full Member
***
Offline Offline

Activity: 201
Merit: 157


View Profile WWW
February 18, 2016, 04:49:46 PM
 #8

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".


mybitprices.info - wallet auditing   |  hd-wallet-derive - derive keys locally |  hd-wallet-addrs - find used addrs
lightning-nodes - list of LN nodes  |  coinparams - params for 300+ alts  |  jsonrpc-cli - cli jsonrpc client
subaddress-derive-xmr - monero offline wallet tool
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
February 18, 2016, 11:18:35 PM
 #9

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.


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
danda (OP)
Full Member
***
Offline Offline

Activity: 201
Merit: 157


View Profile WWW
February 18, 2016, 11:56:58 PM
 #10

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. 



mybitprices.info - wallet auditing   |  hd-wallet-derive - derive keys locally |  hd-wallet-addrs - find used addrs
lightning-nodes - list of LN nodes  |  coinparams - params for 300+ alts  |  jsonrpc-cli - cli jsonrpc client
subaddress-derive-xmr - monero offline wallet tool
danda (OP)
Full Member
***
Offline Offline

Activity: 201
Merit: 157


View Profile WWW
April 08, 2016, 08:53:33 PM
 #11

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

mybitprices.info - wallet auditing   |  hd-wallet-derive - derive keys locally |  hd-wallet-addrs - find used addrs
lightning-nodes - list of LN nodes  |  coinparams - params for 300+ alts  |  jsonrpc-cli - cli jsonrpc client
subaddress-derive-xmr - monero offline wallet tool
Patatas
Legendary
*
Offline Offline

Activity: 1750
Merit: 1115

Providing AI/ChatGpt Services - PM!


View Profile
April 08, 2016, 10:18:18 PM
 #12

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!
danda (OP)
Full Member
***
Offline Offline

Activity: 201
Merit: 157


View Profile WWW
April 08, 2016, 11:23:37 PM
 #13

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!

mybitprices.info - wallet auditing   |  hd-wallet-derive - derive keys locally |  hd-wallet-addrs - find used addrs
lightning-nodes - list of LN nodes  |  coinparams - params for 300+ alts  |  jsonrpc-cli - cli jsonrpc client
subaddress-derive-xmr - monero offline wallet tool
danda (OP)
Full Member
***
Offline Offline

Activity: 201
Merit: 157


View Profile WWW
April 08, 2016, 11:35:16 PM
 #14

@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

mybitprices.info - wallet auditing   |  hd-wallet-derive - derive keys locally |  hd-wallet-addrs - find used addrs
lightning-nodes - list of LN nodes  |  coinparams - params for 300+ alts  |  jsonrpc-cli - cli jsonrpc client
subaddress-derive-xmr - monero offline wallet tool
BellaBitBit
Hero Member
*****
Offline Offline

Activity: 756
Merit: 500


View Profile
April 09, 2016, 03:12:07 AM
 #15

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.

I love Bitcoin
danda (OP)
Full Member
***
Offline Offline

Activity: 201
Merit: 157


View Profile WWW
April 10, 2016, 01:13:16 AM
 #16

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.

mybitprices.info - wallet auditing   |  hd-wallet-derive - derive keys locally |  hd-wallet-addrs - find used addrs
lightning-nodes - list of LN nodes  |  coinparams - params for 300+ alts  |  jsonrpc-cli - cli jsonrpc client
subaddress-derive-xmr - monero offline wallet tool
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!