US Tax Forms (1040 Schedule D and 8949 supplemental forms) require that every capital gains sale is listed by line, even if no cost basis or even a 1099-B has been provided to the IRS. Entering this data into tax software like TurboTax is tedious and error prone. Some institutions provide limited export capabilities such as CSV or excel export but this is not easy to translate into tax preparation software.

These python scripts convert two simple to generate input files BuyLots.csv and Sales.csv into a .TXF file that can be imported into tax prep software and a second RemainingLots.csv that can be used for next year. The scripts automatically calculate the First In First Out lots for every sale and properly tag them in the TXF format ( https://turbotax.intuit.com/txf/TXF042.jsp ).

Also are scripts for:

Lending Club - https://www.lendingclub.com/
Coinbase - https://www.coinbase.com/
Kraken - https://www.kraken.com/

Project Activity

See All Activity >

Categories

Tax

License

MIT License

Follow CapitalGainsCalc

CapitalGainsCalc Web Site

Other Useful Business Software
Our Free Plans just got better! | Auth0 Icon
Our Free Plans just got better! | Auth0

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your security. Auth0 now, thank yourself later.
Try free now
Rate This Project
Login To Rate This Project

User Ratings

★★★★★
★★★★
★★★
★★
0
1
0
0
0
ease 1 of 5 2 of 5 3 of 5 4 of 5 5 of 5 4 / 5
features 1 of 5 2 of 5 3 of 5 4 of 5 5 of 5 4 / 5
design 1 of 5 2 of 5 3 of 5 4 of 5 5 of 5 5 / 5
support 1 of 5 2 of 5 3 of 5 4 of 5 5 of 5 0 / 5

User Reviews

  • Hey Rob, You are my freakin hero, man. :) This script didn't work right off the bat for me, but after learning some Python and messing around for a couple of hours, I finally got it output, imported into TurboTax and everything. Really awesome! The biggest hurdle was that my server only supported up to Python v2.6 and your script requires v2.7 or higher. I don't like to custom compile on my servers, so I spent some time making your script backwards compatible with Python 2.6 and earlier. Now, a lot more people should be able to use it without too much fuss. The only thing I noticed that seemed "off" was the remainingLots csv. It was not comma-separated. I could not really distinguish what was in it, and in my case, there shouldn't have been any lots remaining because I sold them all. For reference, here are my changes to make this script compatible with Python pre-2.7: Search in both py files: writer.writeheader() Replace: # writer.writeheader() # Requires python 2.7 (as of 03/16/2016, not available via yum) writer.writerow(dict(zip(fieldnames,fieldnames))) Note: Due to "total_seconds" not being available in Python before v2.7, I also had to add a substitute function and modify the if statement calling it. In convertBuySellTransactionsToTXF.py, add: def total_seconds(td): # Keep backward compatibility with Python 2.6 which doesn't have # this method if hasattr(td, 'total_seconds'): return td.total_seconds() else: return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6 Then search: if diff.total_seconds() > 365*24*3600: Replace: # if diff.total_seconds() > 365*24*3600: # not supported before Python 2.7, yields AttributeError: 'datetime.timedelta' object has no attribute 'total_seconds' if total_seconds(diff) > 365*24*3600: Note: The tool expects the date to be %Y-%m-%d %H:%M:%S (Ex: 2015-1-1 19:46:00) but Coinbase outputs %m/%d/%Y %H:%M. Be sure to convert the dates in Excel (easier than writing Python code to convert it!) and save the file as coinbase.csv. The Excel custom date format is: 'yyyy-mm-dd hh:mm:ss'. After giving this some thought, I figured out that I could also modify the date format support to avoid converting the dates in Excel first. In convertBuySellTransactionsToTXF.py, search: dateFormats = [ datefmt, '%m/%d/%y', '%Y-%m-%d', '%m/%d/%y %H:%M %p', '%m/%d/%Y %H:%M %p', '%Y-%m-%d %H:%M:%S'] Replace: dateFormats = [ datefmt, '%m/%d/%Y %H:%M', '%m/%d/%y', '%Y-%m-%d', '%m/%d/%y %H:%M %p', '%m/%d/%Y %H:%M %p', '%Y-%m-%d %H:%M:%S'] Thanks for doing all the heavy lifting! Cheers, Brandon p.s. Sorry it's all jacked up. Looks like sourceforge really messes up the formatting of reviews. :(
Read more reviews >

Additional Project Details

Programming Language

Python

Related Categories

Python Tax Software

Registered

2015-03-30