Click here to Skip to main content
Licence CPOL
First Posted 22 Oct 2008
Views 23,094
Downloads 82
Bookmarked 20 times

Financial calculation using .NET: Part 1

By | 22 Oct 2008 | Article
Doing financial calculation using .NET.

Introduction

In the finance world, very often we need to do general financial calculation like interest calculation, regression analysis, internal rate of return, etc. .NET does not provide readymade functions for these standard financial functionalities. Building these functionalities from scratch is not a big thing but testing it end to end with different scenarios is a challenge. We will try to understand how we can reuse 'Financial' classes from the Microsoft.VisualBasic namespace. These functions are time tested and you do not need to code from scratch.

In this article, we will understand how we can calculate the future value for a given rate of interest, period, and monthly invested amount.

I have uploaded a sample source code which has a simple UI to calculate the future value.

I have been writing and recording a lot of architecture related videos on Design Patterns, UML, FPA estimation, C# projects, etc. You can watch my videos at http://www.questpond.com.

Understanding the future value fundamental

First, let’s understand how future values are calculated in the finance domain. Let’s say you have decided to invest for two years in some scheme. Let’s say the amount is 1000 (I am not thinking in terms of INR, $, or pounds) at a rate of interest of 10%. For the first month, you will invest 1000 with 10% interest; in the second month, you will get 1100. Now in second month, you invest 1000, so the total is 1000 + 1100. Now the rate of interest on 2100 is 210. So after two months, you will get 2310.

The above calculation is nothing but a future value calculation. This is available as a readymade function in the Microsoft.VisualBasic namespace. Once you import the namespace, you will get a Financial static class which has a FV function. This function takes in the rate of interest, number of months, and the amount per month. Once we give this, it calculates the value you will get after the defined period. I have wrapped the Financial.FV function in a class ClsFutureValue.

Click here to download the source code attached with this article to see how the FV function works. Below is the screenshot of the sample project:.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Shivprasad koirala

Architect
http://www.questpond.com
India India

Member

I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small
E-learning company in India. We are very much active in making training videos ,
writing books and corporate trainings. Do visit my site for 
.NET, C# , design pattern , WCF , Silverlight
, LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server  training 
and Interview questions and answers



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 5 PinmemberFernandaUY14:10 16 Jan '12  
GeneralMy vote of 1 Pinmembermasoroso1:39 3 Aug '10  
GeneralRe: My vote of 1 PinmemberFernandaUY14:10 16 Jan '12  
GeneralGood one Pinmembersid88978709:05 25 Oct '08  
GeneralData types Pinmembertrevorde stickman22:02 23 Oct '08  
GeneralRe: Data types PinmemberRay Cassick4:36 24 Oct '08  
GeneralNice very Nice Pinmemberjaydevking15:58 23 Oct '08  
GeneralNice one PinmemberKfeeder4:31 23 Oct '08  
GeneralDo we have any such more function PinmemberSatyyGk1:05 23 Oct '08  
GeneralRe: Do we have any such more function PinmemberShivprasad koirala1:08 23 Oct '08  
GeneralRe: Do we have any such more function Pinmemberokash6:09 23 Oct '08  
QuestionHow on Earth did you get 5s? PinPopularmemberMichael Moreno0:55 23 Oct '08  
AnswerRe: How on Earth did you get 5s? PinmemberEnnis Ray Lynch, Jr.14:47 23 Oct '08  
QuestionWhat's this for? PinPopularmemberMaximilian Korporal0:34 23 Oct '08  
AnswerRe: What's this for? PinmemberSadadevguru0:38 23 Oct '08  
AnswerRe: What's this for? PinmemberShivprasad koirala0:41 23 Oct '08  
RantRe: What's this for? PinmemberMaximilian Korporal0:51 23 Oct '08  
GeneralRe: What's this for? PinmemberShivprasad koirala0:54 23 Oct '08  
RantRe: What's this for? PinmemberMaximilian Korporal1:04 23 Oct '08  
GeneralRe: What's this for? PinmemberMaximilian Korporal1:10 23 Oct '08  
GeneralRe: What's this for? PinmemberKfeeder4:34 23 Oct '08  
GeneralRe: What's this for? PinmemberMaximilian Korporal4:51 23 Oct '08  
GeneralRe: What's this for? Pinmemberokash5:57 23 Oct '08  
AnswerRe: What's this for? PinmemberFernandaUY14:13 16 Jan '12  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 23 Oct 2008
Article Copyright 2008 by Shivprasad koirala
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid