NPO Accounting Software for Currency Conversions
byon November 22, 2017
Conservancy helps project participants from all over the world travel to all kinds of conferences and hackfests (around 150 people in 2017!). Because of that, our day-to-day accounting work can involve a lot of currency conversions. Someone on a single trip might have expenses in multiple currencies, and want to be reimbursed in another currency different from all of those.
We previously used rates published by the Bank of Canada to do these conversions. It was a trustworthy source of data, but it wasn’t very user-friendly: we had to go through a multipart web form to get rates, save those in our records, and then convert amounts by hand. When they stopped publishing rates earlier this year, one thing we hoped to find in a replacement was an API that we could use to build some higher-level accounting tooling.
We evaluated several alternatives and found what we wanted in Open Exchange Rates. In particular, it has a historical rates API that meets our needs very well: give it a date, and it returns all the rates for that date in a JSON object. It’s easy to save those results in our books, and use the data for higher-level conversions.
I wrote oxrlib as the tooling we needed on top of that API. It starts as a simple command-line wrapper over the API: give it a date, and it shows you all the rates for that date. From there, you can pass more arguments to answer more specific questions. Name a currency or two, and it will show you the rates between just those currencies. Add an amount, and it will convert that amount from one currency to the other. It can even output all this information in the same format our Ledger books use, so it’s easy to insert directly into an entry we’re working on. All this functionality has already reduced the amount of time we spend processing reimbursement requests. A process that used to require several tools, copying data by hand between them, is now handled by a single command.
My bigger hope is that it will save us even more time developing more NPO Accounting tools. I put “lib” in the name “oxrlib” for a reason: it’s a fully-fledged Python module that I’ve developed with an eye toward reusing in the future. All the functionality we have today in the command-line wrapper should be easy to incorporate into other tools in the future. oxrlib gives us a starting point to automate bookkeeping in multiple currencies. I’m hopeful this pattern will let us make useful incremental progress on NPO Accounting. Today we build small, practical, reusable pieces that solve an immediate problem. Tomorrow we can use those to build more fully-featured programs that solve bigger problems.
You can find oxrlib on our Kallithea Git server, and even use it today with an account and API key from Open Exchange Rates. Expect to hear from me again soon about more NPO Accounting tools like this.
Please email any comments on this entry to email@example.com.