C# – IRR Function

Today I was working on a financial application for a project. One of the spec’s was an IRR (internal rate of return) calculation that had t...

Today I was working on a financial application for a project. One of the spec’s was an IRR (internal rate of return) calculation that had to be done. Since C# doesn’t offer any classes that can calculate the IRR, I decided to use the .Net Framework alternative: the IRR method from the Financial Class (in Microsoft.VisualBasic.dll). So one could call this method in the following way:

double IRRValue = Microsoft.VisualBasic.Financial.IRR(ref irrArray, estimate);


Unfortunately this will only work for simple IRR calculations. My project has an array containing 16 cashflows. I have concluded that the abovementioned IRR method can only calculate arrays that don’t exceed 12 cashflows. If you exceed 12 cashflows the method throws an exception stating “Arguments Are Not Valid". (yes my friend, you are reading this correctly) Furthermore (yes, there is more), if you read the MSDN documentation on this beautiful method you will see that is says: “If IRR cannot find a result after 20 tries, it fails.”. For complex calculations chances are that 20 is to little, and thus you will get the aforementioned exception again.

İlginizi çekebilir...

0 Cevap

Labels

Microsoft ( 69 ) Sharepoint 2010 ( 60 ) WPF ( 53 ) Genel ( 49 ) Visual Studio 2008 ( 42 ) .net 3.5 ( 39 ) ASP.NET ( 35 ) XAML ( 33 ) Visual Studio 2010 ( 29 ) Makale ( 26 ) Silverlight 2 ( 26 ) Windows 7 ( 25 ) Sharepoint Designer ( 24 ) YazGeliştir ( 24 ) C#Nedir ( 22 ) MVC ( 22 ) Türkçe ( 22 ) C# 3.0 ( 21 ) Silverlight ( 21 ) .Net 4.0 ( 19 ) C# ( 19 ) Staj ( 18 ) WWF ( 16 ) sharepoint ( 15 ) Article ( 14 ) Windows Vista ( 14 ) Silverlight VSTools ( 13 ) Developer ( 12 ) Expression Blend ( 12 ) .net 3 ( 11 ) LinQ ( 11 ) SQL ( 10 ) Teknoloji ( 10 ) Windows 7 RC ( 10 ) C# 4.0 ( 9 ) SQL Server 2008 ( 9 ) WCF ( 9 ) Android ( 8 ) Beta ( 8 ) C# 3 ( 8 ) Demo ( 8 ) News ( 8 ) iPhone ( 8 ) Internet Explorer 8.0 ( 7 ) Office 2010 ( 7 ) Oracle ( 7 ) Windows 7 Beta ( 7 ) Windows Azure ( 7 ) Englisht ( 6 ) Entity Framework ( 6 ) MOSS ( 6 ) MVC 2 ( 6 ) Silverlight 3 ( 6 ) Video ( 6 ) Android SDK ( 5 ) Android Studio ( 5 ) Android Uygulama Geliştirme ( 5 ) Expression Studio ( 5 ) Facebook ( 5 ) Seminer ( 5 ) Silverlight 4 ( 5 ) Test ( 5 ) Visual Studio ( 5 ) ios ( 5 ) ip_ucu ( 5 ) Apple ( 4 ) Composite WPF ( 4 ) F# ( 4 ) Java ( 4 ) Office 14 ( 4 ) Proje Yönetimi ( 4 ) SDK ( 4 ) Sharepoint 2013 ( 4 ) Tips/Tricks ( 4 ) Windows Seven ( 4 ) .Net 2.0 ( 3 ) Chatbots ( 3 ) Cloud Computing ( 3 ) Enterprise Library ( 3 ) Expression Web ( 3 ) Instagram ( 3 ) Kitap ( 3 ) Microsoft Report ( 3 ) Mobil Uygulama Geliştirme ( 3 ) New ( 3 ) Sharepoint Deployment ( 3 ) Social Media ( 3 ) VSTO 2008 ( 3 ) Visual Studio 2005 ( 3 ) Windows 8 ( 3 ) XCode ( 3 ) XCode 5 ( 3 ) AI ( 2 ) AJAX ( 2 ) AS400 ( 2 ) Araç ( 2 ) Blueprint ( 2 ) Code Control ( 2 ) Deployment ( 2 ) Google ( 2 ) Help ( 2 ) Internet Explorer 9.0 ( 2 ) Klout ( 2 ) LinkedIn ( 2 ) Objective C ( 2 ) Online Learning ( 2 ) PMP ( 2 ) Twitter ( 2 ) WSP ( 2 ) Web 2.0 ( 2 ) Windows Mobile 7.0 ( 2 ) Windows Server 2008 ( 2 ) Windows Vista SP1 ( 2 ) Windows Vista SP2 ( 2 ) Youtube ( 2 ) iSearch ( 2 ) ktü ( 2 ) sharepoint list ( 2 ) İş Zekası ( 2 ) .Net 2.0 SP1 ( 1 ) Analytic ( 1 ) Artifical Intelligence ( 1 ) Beep Boop ( 1 ) Bilgisayar Mimarisi ( 1 ) Bilgisayar Sistem Simülasyonu ( 1 ) BlueMix ( 1 ) BotKit ( 1 ) Botsify ( 1 ) CE-34788-0 ( 1 ) CMMI ( 1 ) CRM ( 1 ) CardSpace ( 1 ) Chatfuel ( 1 ) ChattyPeople ( 1 ) CodeProject ( 1 ) Dashcode ( 1 ) Dynamics CRM 4.0 ( 1 ) Eclipse ( 1 ) EcmaScript ( 1 ) ErrorCode ( 1 ) Eğitim ( 1 ) Facebook Messenger Platform ( 1 ) FlowXO ( 1 ) Free Learning ( 1 ) Gadget ( 1 ) Google Plus ( 1 ) Hotmail ( 1 ) Hyper-V ( 1 ) IBM ( 1 ) IBM Watson ( 1 ) JRE ( 1 ) Java FX ( 1 ) Kik ( 1 ) Learning ( 1 ) Liderlik ( 1 ) Live Writer ( 1 ) Luis.ai ( 1 ) MEOKAY ( 1 ) Messenger ( 1 ) Mobil Programlama ( 1 ) Moonlight ( 1 ) Multipoint ( 1 ) My Phone ( 1 ) NLP ( 1 ) Nokia ( 1 ) OOXML ( 1 ) Open Source ( 1 ) PHP ( 1 ) PS4 ( 1 ) Parallel Computing ( 1 ) Playstation ( 1 ) Playstation4 ( 1 ) ProblemSolve ( 1 ) Programlama ( 1 ) Property Bag ( 1 ) RDLC ( 1 ) SP2 ( 1 ) SPICE ( 1 ) SQL Azure ( 1 ) SSRS ( 1 ) Sales ( 1 ) Sefer Algan ( 1 ) Segment ( 1 ) Simulator ( 1 ) Skype ( 1 ) Smooch ( 1 ) Sony ( 1 ) Strategy ( 1 ) Swift ( 1 ) TSE ( 1 ) Telegram Bots ( 1 ) Upgrade ( 1 ) Visio ( 1 ) Visual Studio 2005 SP1 ( 1 ) Visual Studio 2013 ( 1 ) Visual Studio 2015 ( 1 ) Windows Mobile ( 1 ) Windows XP ( 1 ) XML ( 1 ) Xamarin ( 1 ) Yahoo ( 1 ) api ( 1 ) api.ai ( 1 ) free ( 1 ) isbb ( 1 ) rest ( 1 ) tools ( 1 ) wit.ai ( 1 )