in Projects

money.js and the Open Source Exchange Rates API = better currency conversion

Today I’m chuffed to release two closely related projects that have been eating up all my spare time recently. I started work on both specifically for our enterprise analytics application (just like accounting.js) but they soon took on a life of their own – quite literally, in one case.

money.js – JavaScript currency conversion library

money.js - javascript currency conversion library

money.js – javascript currency conversion library

money.js is a tiny (1kb) JavaScript library for realtime currency conversion, in the browser and on the server, with zero dependencies. It features simple method chaining and can convert to / from any currency, provided you have the exchange rates for them.

You only need exchange rates relative to one single currency (eg. USD) to be able to convert between any others – money.js does it all for you.

No longer will you need to go wading through shit-heaps of messy, 10-year-old “FREE currency converter javascripts!!1” code just to add basic conversion to your web-app or online store!

More info, demo, download and docs at the money.js homepage

“But where do we get these exchange rates?” (“Maybe there’s some in that truck!!..”)

The biggest issue with currency conversion has to be sourcing reliable exchange rates without having to sell your mum to pay for the API access. I’ve been wanting to take a stab at that for a long time, and here it is:

The Open Source Exchange Rates API project

Open Source Exchange Rates API

The Open Source Exchange Rates API, powered by the lovable (and deadly) Currency Bot

While working on money.js, I realised very quickly that finding a free, reliable source of JSON-formatted, regularly updated data (with no access limits or hidden catches) is, well, impossible. It just doesn’t exist.

Until now!

The Open Source Exchange Rates API provides up-to-date, flexible and portable currency conversion data that can be used in any application, framework or language (not just JavaScript).

It was originally designed for integration with money.js, and hacked together in an afternoon. It’s powered by a simple nodeJS scraper and a list of currencies: every hour, Currency Bot collects all the exchange rates from the Google Calculator API (one by one), then pushes them in JSON format to a public GitHub code repository for everybody to use.

The rates are available historically for any day since the project started, and could soon be extended to provide data going back several years.

Also, it’s mirrored on, which sends files with friendly Access-Control HTTP headers for cross-origin resource sharing (CORS) – so that they can be loaded into an app or page via AJAX.

I would write more, but I’m shattered after waking up at 6am to get Currency Bot out of his can’t-scrape-won’t-scrape funk (he had a few teething problems.) He’s back on form and collecting data like a boss – you can see it at the currencybot/open-exchange-rates GitHub repository.

Learn more about using the free service at the Open Source Exchange Rates API homepage!

The next step

Wow. I’ve wanted to get these two done for a long time, and now I’m left scrambling to find something else to do – lucky for me, there’s plenty. Here’s the future plans for these two projects (if you feel you can contribute, please get in touch!)

  • Find a way to do a once-off retrospective crawl of historical exchange rates going back as far as possible. This will almost certainly involve abusing another free but non-user-friendly or rate-limited service. Open to suggestions.
  • Package up money.js into a npm module so that you can go npm install moneyjs.
  • Write documentation for how to use the Open Source Exchange Rates API in the most popular languages and frameworks
  • Write a full test suite for money.js
  • And a bunch more – all I can say is, hit ‘watch’ on the GitHub repositories (here and here) and follow me on twitter here if you’re interested and want to keep up to date.

Thanks for reading!

Leave a Reply for Aleksandar Cancel Reply

Write a Comment


  1. this is incredible!

    could you share any more information about how you built the scraper in node? i’m just getting started with node and would love to see how it works :)

    • Hey, thanks! the code’s up on the github repository so feel free to have a look in. It’s been hacked around a little bit since the beginning.