summaryrefslogtreecommitdiffstats
path: root/README.org
blob: f0ff1574e44dd063be87e203e714b7eadbd49570 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
* Bitcoincharts Beancount converter

This is a quick tool I hacked together to convert historic bitcoin
prices from [[http://api.bitcoincharts.com/v1/csv/][bitcoincharts CSVs]] into beancount price directives.

The files are gzipped CSVs of (unixtime, price, tradeamount)

For each month with trades on the 1st, the tool calculates a weighted
average of trades on that day and outputs a beancount price directive.

** Running

The tool does not download files on its own.  Download the files
before running.

#+BEGIN_SRC shell
$ node index.js some.csv.gz
# or
$ node index.js some.csv.gz EUR
# or
$ node index.js some.csv.gz EUR BTC
#+END_SRC 

*** Parameters

- filename (gzipped CSV)
- currency [optional] (currency code used in beancount {USD,EUR, etc})
- commodity [optional] (currency code of commodity) {BTC,BCH,LTC, etc}

*** Status

It works. I don't plan on working on it much further.

It's not very efficent.  I suspect the main problem is the group
function probably doesn't assume that the input is sorted and
therefore buffers its entire input.  Patches welcome.

** License

MIT