Bitcoin Forum
May 08, 2024, 03:10:34 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [ALPHA]CryptoProfIT: A Free Tool for Calculating Taxes / Profits / Holding times  (Read 75 times)
lucidskywalker91 (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
April 20, 2018, 09:59:03 AM
 #1

Hi together!
I created a Free Python Script to process your trade histories.


I used the outputfile of this tool for my tax declaration, and thought it might help many people as well.
Therefore it would be great if this will result in a community project which everybody involved in Cryptos can use for FREE.

The logic & functionality should be ready and next steps would be:
  • testing
  • creating gui or webapplication
  • adding features

It would be awesome if this could become some kind of community project, on which we build together a more complex, easier to use, tool for everybody (that does not know how to use python Wink

Follow the HOWTO (below) and to calculate your profits etc.! If you run into any problems or if you need more exchanges write it in the comments and I will add them!
(I could only integrate the ones I use, cause I only got csv files from there)

The tool is working fine for me and I could perfectly calculate my profit, payed fees and last buy times to determine the 12 month holding time.
The code is not that complex, so take a look at it and feel free to add, correct or modify stuff and make sure to push it Smiley

--------------------------------------------------------------------------------------------------------------------

CryptoProfIT (Alpha Version)
https://github.com/LucidSkyWalker/CryptoProfIT (Download here)

(Read here for nicer formatting)
https://github.com/LucidSkyWalker/CryptoProfIT/blob/master/README.md

The profit result can be used to calculate the tax on your crypto.
The output are two csv-files. Example Screenshots can be found below.

The output files contain:
- Sorted full trade history (converts all exchange exports to the same formatting)
- Fees per Trade (inklusive Overall Payed fees)
- Profit per trade (Overall profit. This can be used to easily calculate your personal capital taxes)
- Profit can be calculated in EUR or USD. (Data from European Central Bank)
- Amount of your Cryptocurrencies
- Display the different BUY-INs by amount and date. So you can control the 12 month holding period.

Supported Exchanges: Binance, Bitfinex, Bittrex, Kraken, Mercatox, Poloniex, Costum*

*A dummy file is included that can be used to easily add trades of other exchanges.
If you give me a csv-file export from other exchanges (you can modify the digits for privacy) I will add them.

PLEASE READ: I wrote this tool to calculate my taxes and it did the job fine! Nevertheless it is not well tested yet. If you run into trouble, please write an issue and I will fix it! Thank you Smiley
Screenshots

https://user-images.githubusercontent.com/19948182/37256193-9a14af4a-2557-11e8-9844-2d3045653609.png
Screenshot of the output.csv. The data of all exchanges is formatted in its specific ways and displayed in a uniform style.
Type always refers to the first token of the pair! (First transaction shows buying XRP by BTC)
Base Price always refers to the second token of the pair.
Base Price in USD shows the price of the second token in USD.

https://user-images.githubusercontent.com/19948182/37256327-48d9386a-2559-11e8-9798-2d31e0ecc703.png
Screenshot of the holding_output.csv. This file can be used to specify your remaining holding times,
as Capital gains do not need to be taxed in many countries after 12 month
The picture shows (in red), that the first of the remaining ETH were bought on 2017-06-02, meaning that this amount is tax-free one year later.
The blue frame shows the date for the next tokens...

https://user-images.githubusercontent.com/19948182/37256205-bd9a468c-2557-11e8-9853-90d2f1daaa08.png
Console output of the Python script (Not my real data Wink )


Requirements

For now, there is no Gui so you have to use the python script.
If some dev likes to help, making a gui or a brython version would be neat.

HOWTO:

Setting up Python:

    -Install Python 3.x (https://www.python.org/downloads/)
    -Make sure to mark "ADD PATH" in the installer
    -Open commandline
    -Type: "python --version", this should display "Python 3.x"
    -Install package: "requests" (type: "pip3 install requests", hit ENTER) (if applicable, run commandline as admin)
    -Install package: "pandas" (type: "pip3 install pandas", hit ENTER)
    -Install package: "currencyconverter" (type: "pip3 install currencyconverter", hit ENTER)*
    -Install package: "tables" (type: "pip3 install tables", hit ENTER)

Using the script:

    -Download or clone this git
    -Download the historical price data file (https://drive.google.com/open?id=1aiW2fq6sul4svVQp5iTqVXTdHn7vMMTh)
    -Copy the file into the BTC_Data folder and overwrite existing fixed.hdf5
    -Download the csv-file exports and copy them into the folder "trade_history_files"
      Note: Binance will give you an excel file. Open that and save it as binance.csv
      Note: For Kraken, use "trade" (not ledger) and mark "all"
    -Rename the csv-files into the exchange names with lowercase. E.g. "kraken.csv", "binance.csv"...
    -For further trades, copy the "dummy.csv" file from the "costum folder" into "trade_history_files".
      (See section "Using a costum file". I used it for Anycoin and Liqui, as I could not get csv files there)
    -Start the "main.py"
      (Detailed: navigate via commandline into the "CryptoTaxator" folder
      e.g type: "cd C:/CryptoTaxator", hit Enter, type: "Python3 main.py")
      If you choose EUR, decimals in the output will be seperated with ",", for USD with "." (For proper Excel display)
    -Forks are displayed with a warning, as you try to sell tokens you never bought before. Please read the Fork information if your trade history contains forks.

* This package uses the European Central Bank as source for EUR/USD to get the historical exchange rates.
Author: Alex Prengère
Home Page: https://github.com/alexprengere/currencyconverter
Fork information:

A tax accountant told me, you need to pay taxes on the profit of your received forked coins as soon as you get them.
Therefore a "dummy" trade needs to be manually added to one of the csv export files in "trade_history_files".
* Add a "Buy" transaction at the moment you reveived the coins. (with price "0")
* Add a "Sell" transaction a few seconds later (price = initial price of forked coin) --> you made the inital profit.
* Add a "Buy" transaction a few seconds later than before (price = initial price) --> Because you know still got the coins
Simplifing this could be a feature in a future version...


Using the dummy-file:

You can use this file to add trades from exchanges that do not provide trade history exports.
Important: You have to use the same formatting like the sample data in the file.
Ensure the right date formatting, and use "." for decimals.

Other Information:

    -For receiving the minute price data of bitcoin, the historical data of coinbase is used.
    -For receiving the ETH price data, the poloniex API is used ( ~ 5min accuracy )
    -For the USD/EUR exchange rate, the european central bank data is used.
    -If you try to sell something you should not have it is displayed in the console.
    -You can choose to continue or abort. If you sell a coin you received from a fork, this message will show up as you should not have that coin. Read "Fork information" for more info.

Disclaimer:


I wrote this tool to calculate my taxes and thought I share it.
I do not guarantee that the results are 100% accurate, but the script might help you
getting a well formatted output csv you can work with.

If you run into any problems, don't hesitate to contact me at any time.

Donations: xrb_3mwnrhq1d4pdcrgegyygic1a1wpcbnsaj6pd5656dg3yxio3cyg1rn4u1umx
1715181034
Hero Member
*
Offline Offline

Posts: 1715181034

View Profile Personal Message (Offline)

Ignore
1715181034
Reply with quote  #2

1715181034
Report to moderator
"You Asked For Change, We Gave You Coins" -- casascius
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715181034
Hero Member
*
Offline Offline

Posts: 1715181034

View Profile Personal Message (Offline)

Ignore
1715181034
Reply with quote  #2

1715181034
Report to moderator
Patatas
Legendary
*
Offline Offline

Activity: 1750
Merit: 1115

Providing AI/ChatGpt Services - PM!


View Profile
April 20, 2018, 10:19:58 AM
 #2

Very Nice! It's good to see such projects are being open-sourced instead of selling them for  a few satoshis! We need more projects like this and obviously kinda hearted nerds like you!  Wink

Is it compatible with python 2.X or python 3 is a mandatory ?

If anyone needs help setting this up locally or any other help related to script,don't hesitate to send me a message.Pretty sure lot of non-tech heads will find it complicated to set this up!
lucidskywalker91 (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
April 20, 2018, 11:30:00 AM
 #3

Thank you!

It is only compatible with Python 3.

It would be great if people try to use the tool!

I implemented all exchanges I used so far (which are alot Cheesy) but as I could only process my own
trade history files, it is likely that there might be bugs...

I have alot of feature ideas, like adding forks properly ....
but as my own calculations work I will only implement my ideas, if there's demand and people actually use the 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!