Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 22871

"Morphex's Blogologue": Exchange rate file parsing for ravencoin taxman

$
0
0
I hacked a little more on the

https://github.com/morphex/ravencoin-taxman/

Ravencoin accounting tool today, it takes a lighter approach than ethereum-classic-taxman, downloading a CSV file of transactions instead of running through all the blocks in a blockchain node to find relevant transactions.

Since it does that, it makes things a bit less mentally demanding to work with, and I need to get FIFO sorted out for accounting purposes, so that it is possible to calculate loss and gains for capital tax.

Ravencoin-taxman works with data from different sources, one part is the Ravencoin transactions, another is the rate in USD for RVN at any given time (day) and finally a local currency is often necessary, in my case NOK, Norwegian kroner, to calculate things correctly for accounting and tax purposes.

Working a bit with CSV files, it is easy to appreciate their simplicity, on the other hand, they're not what you can call "well-defined" formats, for example the date fields in them can have different meanings based on where the CSV file is generated. YY/MM/DD or YY/DD/MM or even DD/MM/YY.

So I worked on that today. I think there is a little CSV tool that can be refactored into a separate Python package for working with CSV files, or data that isn't strictly declared or formatted.

CSV files are great in their simplicity and utility, but as this code shows:

https://github.com/morphex/ravencoin-taxman/commit/62fe3c364...

It takes quite a bit of work to make sure that data from CSV files is interpreted correctly, and if you're working with a limited amount of data, it is possible for that code to interpret a date wrong, switching the month and day fields the wrong way around.

Viewing all articles
Browse latest Browse all 22871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>