Giter Club home page Giter Club logo

cointaxes's Introduction

CoinTaxes

This will fill out IRS form 8949 for the following exchanges:

  • Coinbase
  • GDAX
  • Bittrex data

It assumes all short term sales and will use the highest cost buy order for cost basis. This will lower the amount of taxes you will have to pay. It will make a .txf that you can import into TurboTax, and it will fill out the IRS form 8949. This has only been tested on Windows.

Enhancements

This project was forked off of CryptoTaxes by gsugar87.

  • Cleaned up documentation
  • Converted credentials.py to config.yml
  • Fixed code
    • Updated old api functions to new ones
    • Added cross platform code so it works on Windows, OSX, and Linux
    • Made structure more flexible by adding exchanges package
    • Added code docs
  • Renamed so pip package wouldn't confuse with the original project
  • Added an open license
  • See TODO.md for more details

Dependencies

pip dependencies

Using the recommended pipenv

pipenv install

pdf toolkit

Install pdftk from a binary and make sure the command pdftk is in the path.

If using Ubuntu it's easier to install.

apt-get install pdftk 

Instructions

Assuming you have API keys for the exchanges you want. Edit config.yml and uncomment the exchanges and insert keys, secrets, and passphrases. Fill out your name and social in the file to have that written into the PDF.

Then finally, run the script

python CoinTaxes.py

If you have a separate configuration file:

python CoinTaxes.py --input randy.yml

Get the API credentials

Coinbase

  1. Sign into your Coinbase account

  2. Go to the API page and click on New API Key

  3. In the popup window check all under Accounts:

    • wallet:accounts:read
    • wallet:addresses:read
    • wallet:buys:read
    • wallet:deposits:read
    • wallet:sells:read
    • wallet:transactions:read
    • wallet:user:read
  4. Click Create to see the API key and secret.

  5. Insert the API Key into the correct variables in config.yml e.g.

     coinbase:
         key: 'abcdefg1234'
         secret: 'zxcvbasdf1234qwer'
    

GDAX

  1. Sign into GDAX

  2. Go to API page and under Permissions, check View and then click Create API Key.

  3. Enter the two-factor authentication code if you are asked for it

  4. Insert the API creds into the correct variables in config.yml e.g.

     gdax:
         key: 'qwerty123'
         secret: 'poiuyt999'
         passphrase: 'mnbvc000'
    

Bittrex

Unfortunately, the Bittrex API does not let you get your entire transaction history via an API. In order to get your entire history, you must login to your Bittrex account, go to https://bittrex.com/History, and then click on "Load All." This will download your entire history in a csv file called "fullOrders.csv". Move this file into the CryptoTaxes directory, and it will be read in.

Donate

If you find this code useful, feel free to donate!

me

  • BTC: 1LENSt469CoAmZBp1zSvdbSKtCacjSez3i
  • LTC: LbweDjdHMaHZJtkjmP11rpC7ftXYfFPKop
  • ETH: 0x13fc2D16fC97877Cf6C35A56F8d2e646152cc2e6
  • Doge: AEztxkBZ1qBDrye6o3UYphRWPNQHDUYmoW
  • BCH: qrf0rve9wjajr4g8h24ed3ff9kx0zqn86vlvmkyn7g

gsugar87

Original developer's crypto wallets are at the bottom of his repo.

cointaxes's People

Contributors

coolspot avatar gsugar87 avatar nitrocode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cointaxes's Issues

Generates invalid TXF file

This is result TXF file:

V042
ACyrptoTaxes
D 04/16/2018
^
TD
N712
C1
L1
$1.55131499 ETH
D06/14/2017
D06/28/2017
$613.54
$453.70
^

TurboTax 2017 doesn't accept it as correct. According to specification line "$1.55131499 ETH" must be "P 1.55131499 ETH" instead.

NameError: global name 'sell_index' is not defined

After fixing #2 and #3 :

Connected to Coinbase.
Sorting the buy and sell orders by time
Traceback (most recent call last):
File "CoinTaxes.py", line 197, in
main()
File "CoinTaxes.py", line 182, in main
tax_year=config['year']
File "/home/ivan/Documents/code/CoinTaxes/formats/fill_8949.py", line 70, in get_cost_basis
print("WARNING! COULD NOT FIND A COST BASIS FOR sell_index=%d!" % sell_index)
NameError: global name 'sell_index' is not defined

It looks like variable "sell_index" was eliminated during refactoring.

TypeError: get_product_historic_rates() got an unexpected keyword argument 'product'

Ubuntu 16.04 LTS, python 2.7, ConTaxes' latest master:

Traceback (most recent call last):
File "CoinTaxes.py", line 158, in
main()
File "CoinTaxes.py", line 112, in main
exchange_buys, exchange_sells = fix_orders(exchange, exchange_buys, exchange_sells)
File "CoinTaxes.py", line 40, in fix_orders
price_usd = exchange.get_price(order['order_time'], product='BTC-USD')
File "/home/ivan/Documents/code/CoinTaxes/exchanges/gdax_reader.py", line 125, in get_price
end=order_time
TypeError: get_product_historic_rates() got an unexpected keyword argument 'product'

Exchange of an altcoin to BTC is not tracked properly causing significant 8949 profit/loss calculation mistake

For tax purposes, exchange of a $COIN to BTC is recorded as two transactions:

  1. sell $COIN for USD
  2. buy BTC with USD
    This is handled in the function CoinTaxes.py->fix_orders().

There is a mistake that for amount of $COIN sold, the order['cost'] is used instead of order['amount'].
The order['cost'] contains amount of BTC purchased, while order['amount'] contains amount of $COIN sold.

For example, if in reality you have sold 10 ETH to buy 1 BTC, due to the error, that would be recorded as two transactions:

  1. sale of 1 ETH for USD cost of 10 BTC
  2. purchase of 10 BTC with USD from the above
    Which significantly interferes with gain/loss and proceeds calculations.

IndexError: list index out of range in fill_8949

Traceback (most recent call last):
File "CoinTaxes.py", line 181, in
main()
File "CoinTaxes.py", line 177, in main
fill_8949.make_pdf(full_orders, "test", config['name'], config['social'], config['year'])
File "/home/user/Documents/code/CoinTaxes-2018/formats/fill_8949.py", line 169, in make_pdf
field_num = field_nums[idx - 1]
IndexError: list index out of range

TypeError: list indices must be integers, not str

Sorting the buy and sell orders by time
Traceback (most recent call last):
File "CoinTaxes.py", line 166, in
main()
File "CoinTaxes.py", line 135, in main
buys_sorted = sorted(buys, key=lambda buy_order: buy_order['order_time'])
File "CoinTaxes.py", line 135, in
buys_sorted = sorted(buys, key=lambda buy_order: buy_order['order_time'])
TypeError: list indices must be integers, not str

I suspect it was caused by fix_orders() because it appends lists instead of objects into buys and sells lists.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.