Financial Functions in .Net (C#)

I recently worked on a project where I had to perform financial calculations. The main project requirements where provided on an Excel and because of the sensitivity of the calculations(mortgage payments), I had to keep within 1cent accuracy.

After reviewing the needed calculations, my main issue was the NPV (Net Present Value); although I am familiar with the formula and applications of NPV, I was not sure of the exact implementation in Excel.

So, I jumped to Google to see if there was any implementations and found the Excel Financial Functions for .Net: “… a .NET library that provides the full set of financial functions from Excel.”.

Great! BUT. The library is actually implemented in F# and only the source code is provided, no compiled version…. No problem, since all .Net languages compile into IL (Intermediate Language), all I needed to do was to compile the F# project and then reference it on my C# one.

After I add ed the Financial.dll reference to my project (compiled version included in the provided source code), I am ready to use it on my code, however, note that the following reference is required:

using

System.Numeric;

 

With the reference in place, I can now use the NPV function as follow:

Financials

Comparing the signature of the NPV function on Financial.dll to excel, we can see they are virtually the same:

Financials-Excel

And even though I have shown mainly the NPV usage, this library contains implementation pretty much all financial functions in Excel (Complete List).

There you have it; if you ever have a project where you need to use Excel functions, you can refer t the Excel Financial Functions for .Net library; you can use the compiled library provided on this example, but I recommend reviewing the library page regularly to check for updates.

Hope this helps!

Facebook Profile Management

In this post I will discuss how I implemented the Profile Management for Network Trotters .

Profile Management Generals

As an application developer, you get the opportunity to place some information in the user profile page. Specifically you can set a Profile Action (link below the Profile Pic) and a Profile Box.

In your application you basically tell the Facebook platform where it should get the FBML/HTML that defines both the Profile Action and Profile Box. It is important to notice, that Facebook will Cache this FBML/HTML, until you specifically tell them to refresh it.

So in summary, you set the user Profile from your application, but you have to build a mechanism to refresh the users profile periodically.

Context

I am using the Facebook Development Toolkit as the Facebook Platform API wrapper; and the profiles are set by using Urls.

.Net Implementation (one of many)

In my implementation, the profile management contains 3 main components:

  • Profile Content Page
  • Setting a user profile
  • Refresh the profile

Continue reading “Facebook Profile Management”