Code Monkey home page Code Monkey logo

cost-basis-filler's Introduction

Generate missing cost basis for unknown crypto deposits from day-of historical price.

$ node index.js data.csv costbasis

402/402 100% 0.0s (0 errors)
Type  Buy Cur.  Sell  Cur. Exchange  Trade Group Comment Trade Date
"Type","Buy","Cur.","Sell","Cur.","Exchange","Trade Group",,,"Comment","Trade Date"
"Income","0.00059200","BTC","-","","Coinbase","",,,"Cost Basis","06.04.2016 08:47"
"Income","27.25163848","BTC","-","","Coinbase","",,,"Cost Basis","20.05.2016 16:46"
"Income","0.63300000","BTC","-","","Kraken","Kraken Ledger",,,"Cost Basis","18.06.2016 15:14"
...

$ node index.js data.csv summary

Transactions:  4879
Total Days:  791
Withdrawals:  3913
Matched Deposits:  564
Unmatched Deposits:  402

Calculate prices from cryptocompare aggregrate (cccagg):

$ node index.js data.csv prices

402/402 100% 0.0s (0 errors)
Type  Buy Cur.  Sell  Cur. Exchange  Trade Group Comment Trade Date  Price
"Type","Buy","Cur.","Sell","Cur.","Exchange","Trade Group",,,"Comment","Trade Date"
"Income","0.00059200","BTC","-","","Coinbase","",,,"Cost Basis","06.04.2016 08:47"
"Income","27.25163848","BTC","-","","Coinbase","",,,"Cost Basis","20.05.2016 16:46"
"Income","0.63300000","BTC","-","","Kraken","Kraken Ledger",,,"Cost Basis","18.06.2016 15:14". "753.77"
...

If a symbol cannot be found, errors will be shown and the price will be empty:

402/402 100% 0.0s (2 errors)
No price for BLOOBLOO on 2018-12-11
No price for BLOGBING on 2018-12-13
Type  Buy Cur.  Sell  Cur.Sell Exchange  Trade Group Comment Trade Date  Price
"Income","1.00000000","BLOOBLOO","-","Coinssss","",,"11.12.2018 00:00"
"Income","10.00000000",BLOGBING","-","Coinssss","",,"13.12.2018 00:00"
"Income","0.63300000","BTC","-","Kraken","Krakenger","18.06.2016 15:14"  "753.77"

Use all.js to calculate prices and totals (amount * price) for every transaction. Calculates prices from Coinbase.

$ node all.js data.csv

11/11 100% 0.0s (0 errors)
"Type","Buy","Cur.","Sell","Cur.","Price","Total","Exchange","Trade Group",,,"Comment","Trade Date"
"Withdrawal","-","","3.97977742","ETH",378.85,1507.7386755670002,"Coinbase","",,,"","01.04.2018 21:53"
"Withdrawal","-","","3.23510857","ETH",303.7,982.5024727089999,"Coinbase","",,,"","04.09.2017 08:46"
"Withdrawal","-","","2.82298340","ETH",404.95,1143.16712783,"Coinbase","",,,"","06.08.2018 22:51"
...

Installation

  1. Clone the repo.
  2. Rename sample-secure.json to secure.json and add valid API keys.
  3. sample-data.csv is from cointracking.info/trades.

cost-basis-filler's People

Contributors

raineorshine avatar

Stargazers

Kollan House avatar

Watchers

James Cloos avatar  avatar

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.