APR Calculator Code Open Sourced

Last year I wrote an article about some code to help calculate the Annual Percentage Rate for a loan. The code discussed how to calculate APR’s that were compliant with the United Kingdoms Financial Conduct Authorities FCAMCOB 10.3 Formula for calculating APR.


Even though all the code in contained in the article, I have received many requests for a Visual Studio project containing the code and all the unit tests that cover the test scenarios in the original article, so what I have done is open source the code on Codeplex. It seems many people have found this code useful, which is great, so I hope that by open sourcing it, more people will get use out of it.


Validating Card Numbers with the Luhn Check Algorithm

In this article I want to discuss how to validate debit/credit card numbers. First I will talk about how the algorithm works on a theoretical level, and then I will present a C# implementation that you can use in your own code. Then I will show another implementation that allows you to generate multiple valid test card numbers.

Validating Card Numbers with the Luhn Check Algorithm
Validating Card Numbers with the Luhn Check Algorithm

The algorithm I want to discuss here is called the Luhn Algorithm. It is also known as the mod 10 check. The Luhn algorithm is a simple checksum formula used to validate a variety of identification numbers, but the most common use is credit card numbers. The algorithm was invented by an IBM scientist, Hans Peter Luhn.

How to Calculate Annual Percentage Rates (APR)

I have had many requests for a Visual Studio solution project with the APR code and unit tests in. I have open sourced the code and put it onto Codeplex to make it easy for you to access.

In this article I want to discuss Annual Percentage Rates (APR) and how you calculate them including some sample code. APR is a term you will see on several different lending products including loans, overdrafts, credit cards and mortgages. It is a legal requirement to show the APR on products where you borrow money, (certainly in the UK). The APR is meant to make it easier to make fairer comparisons of different products. To make things even more confusing there are 2 types of APR, Personal APR and Typical APR.

How to calculate Annual Percentage Rate (APR)
How to calculate Annual Percentage Rate (APR)

The APR is essentially how much your borrowing will cost over the period of an average year, over the term of your debt. It takes into account interest charged as well as any additional fees (such as arrangement fees, or annual fees) you’ll have to pay. It also considers the frequency with which interest is charged on your borrowing, as this as an impact on how much you will pay as well.