exchangerates.co.ke

Problem

During the development of one Market Information System, the client requested to have an ability to have a currency conversion functionality on their web application. The client specifically requested that the exchange rates be sourced from the Central Bank of Kenya. This thus ruled out using many of the free exchange rate providers that currently exist, since none explicitly states that they get their rates from the Central Bank of Kenya. Unfortunately the Central Bank of Kenya website provides no efficient way to download or access the exchange rates as they are just displayed in a table.

Solution

I did a bit of research and found an excellent article written by Jacob Ward on web scrapping with PHP and Curl. Using the examples and logic I was able to build a simple scrapping function that would extract the exchange rates from the Central Bank website. After examining the url structure of the Central Bank I was able to pull data dating back to 2005. I then created a cron job that ran the script everyday updating the exchange rates on the clients database. Problem solved.

Idea

I then realized I could extract data that could be useful to other developers especially those who are dealing with foreign currency where the Kenya Shilling was the base currency. I decided to build a simple JSON API that could be freely accessed and could give developers access to daily and historical exchange rates.

exchangerates.co.ke

This web application was developed using the slim framework which is an awesome micro framework along with RedBean an easy to use ORM. The rates are extracted daily from the Central Bank website and are stored on the application's database.

The API service requires users to register and receive an API key via their email address. The service is rate limited at 1000 requests monthly. The API allows querying of daily and historical rates dating back to 2005. There are currently exchange rates for over 21 currencies and this includes both the buying and selling rates in comparison to the Kenya Shilling. Head over to exchangerates.co.ke to see the usage details. Currently that is all there is to it, in case you have ideas or suggestions to share to improve this service please let me know.

Read this article

Data Generation Tools

Generatedata.com

I am a big fan of generatedata.com ever since I discovered it a few years ago. Amazing work from the developer behind the project. This tool can generate a variety of data types (30+) such as names, emails, phone numbers, alphanumeric data, number ranges, dates and so on. The data can be exported as CSV, Excel, HTML, JSON, SQL among many other export types. This tool will no doubt save you a great deal of time in generating mock data.

Read this article

Yii 2.0.0

Woke up to great news that Yii 2.0 GA has been released. I came to love Yii during my time at OpenWorld. At first the learning curve was quite steep but the documentation is well written and that was a great help. The Yii community is also great and the forums quite active and there are a a load of great extensions to add more functionality to your web apps. I look forward to developing on this new Yii version which has a ton of new improvements. See yiiframework for features to look out for. Happy coding.

Read this article