31 Cryptocurrencies — Week 1
The 365 day experiment has begun. I pulled the trigger. Instead of 30 cryptocurrencies as originally planned, I ended up purchasing 31. Oops. Small snippet of the hundreds of transactions that occurred:

Unfortunately I wasn’t able to get exactly $10 USD of each currency. No exchange that I’m aware of allows the purchase of these alt-coins with USD (except for major ones like bitcoin, ethereum, and litecoin); you must purchase bitcoin and use that to purchase other currencies. The value of bitcoin changes so frequently and rapidly that it was impossible to get the exact amount I wanted, but I got close:


Since I don’t want to manually update all this information every week, and generate charts and graphs for these blog posts, I built some d3.js charts that utilize CryptoCompare API’s to pull down price data. Here’s the script for pulling the data:
global.fetch = require(‘node-fetch’);
const cc = require(‘cryptocompare’);
const fs = require(‘fs’);
let wallet = JSON.parse(fs.readFileSync(process.argv[2], ‘utf8’));
let currencyMap = JSON.parse(fs.readFileSync(‘./currency-map.json’, ‘utf8’));
let symbols = [];
let res = [];
let date = new Date().toISOString().substring(0, 10);
for (let symbol in wallet) {
symbols.push(symbol);
}
cc.priceMulti(symbols, [‘USD’])
.then(prices => {
for (let symbol in prices) {
wallet[symbol].position_usd = wallet[symbol].quantity * prices[symbol].USD;
let asset = {
date: date,
symbol: symbol,
name: currencyMap[symbol],
quantity: wallet[symbol].quantity,
price: prices[symbol].USD,
position: wallet[symbol].quantity * prices[symbol].USD
};
res.push(asset);
}
fs.writeFileSync(‘../data/’+date.replace(/-/g,’’)+’.json’, JSON.stringify(res));
})
.catch(console.error);Usage:
node calculate.js wallet.jsonExample input file (wallet.json):
{
“BTC”: {
“quantity”: 10,
}
}Example output:
{
“date”:”2017–08–23",
“symbol”:”BTC”,
“name”:”Bitcoin”,
“quantity”:0.00248323,
“price”:4182.83,
“position”:10.386928940899999
}The d3.js code loads the JSON generated by this script and displays the relevant charts. I’m working on creating better charts for future updates, but that might be a ways off. I have a cron job that runs this script every night to capture the value of my portfolio every day. Each week I will post an update, including some fancier charts! You can see the d3 code in the html folder of the github repo.

