4
$\begingroup$

If it exists, has been agreed on, and F# programmers have used it extensively, I would like to know what is the industry standard Quant Finance library for F#.

What typical finance scenario(s) have you had success with for this library?

$\endgroup$
9
  • $\begingroup$ Theres quantlib in C++ but even that is far from an industry standard.... $\endgroup$
    – pyCthon
    Commented Jan 23, 2013 at 20:30
  • 1
    $\begingroup$ "Quant finance" is a broad field. Are you referring to derivatives pricing? High-frequency trading? Risk management? This is like asking, "What's the industry standard library for science?" $\endgroup$ Commented Jan 23, 2013 at 21:15
  • $\begingroup$ Anything that needs to express complex Quant equations efficiently in f# $\endgroup$
    – Nikos
    Commented Jan 24, 2013 at 0:25
  • $\begingroup$ What do you currently use at your employer? $\endgroup$ Commented Jan 24, 2013 at 3:30
  • 2
    $\begingroup$ It's hard to get easier in quant finance than BS. Even VBA can handle that easily. $\endgroup$
    – Matt Wolf
    Commented Jan 24, 2013 at 19:11

4 Answers 4

6
$\begingroup$

I'm not aware of an industry-standard Quant Finance library in the F# space, but there are plenty of high-quality commercial and open source alternatives. See the F# Software Foundation's Math Stacks page.

F# is used in a wide range of finance scenarios.You can read some experience reports from the F# Software Foundation home page.

$\endgroup$
2
  • $\begingroup$ Excellent link. $\endgroup$
    – SRKX
    Commented Jan 24, 2013 at 16:04
  • $\begingroup$ @SRKX I agree!! $\endgroup$
    – Nikos
    Commented Feb 1, 2013 at 2:00
6
$\begingroup$
  • In my opinion F# will never ever take off in ways C++ or C# has become popular. There are way too many competitive functional languages out there and if you program functionally why would you ever want to lock yourself into a MS product, at least that is an argument I have heard multiple times.

  • There is no comprehensive F# library out there right now that tackles derivatives pricing algorithms or quantitative methods applied to financial modeling, period.

  • I highly recommend you to look at C++ libraries and some C# libraries (which perform more and more closely to their C++ brothers, throughput and latency wise). There is just not enough support for functional language libraries in the broader finance community yet, and to be honest I do not think there will ever be sufficient interest in order to make it worthwhile to run a whole architecture on a functional language. The reason I say that is because I already see lots of effort put in by MS and other vendors to open up C++ and especially C# more and more to handle work loads that were the core domain of functional languages before. Examples that show how C# (.Net) really pushes onto the turf of other competing languages:

    • Actor model (and IPC communication)
    • State machine compile time creation (async, await type concurrent programming)
    • want static typing? check; strong typing? check; dynamic typing? check; object type inference? check
    • tpl dataflow, concurrent data flow processing
    • complex event processing (MS has its own product out there that tightly integrates with .Net and got pretty good reviews)

A lot of that stuff was previously the domain of Haskell or Erlang, not so anymore.

$\endgroup$
10
  • 1
    $\begingroup$ care to comment on why you downvoted? Just down voting does not benefit anyone other than your ego. I love to learn and hear from you if you disagree, make a point so that everyone else benefits as well. $\endgroup$
    – Matt Wolf
    Commented Jan 24, 2013 at 4:06
  • $\begingroup$ don't get the down vote either, this is true +1 $\endgroup$
    – pyCthon
    Commented Jan 24, 2013 at 6:16
  • $\begingroup$ @pyCthon, I do not have an issue with down votes at all as long as a reason is given. I down vote at times but generally always comment on the reason and revise the down vote if an answer is updated and reflects changes that warrant a reconsideration. I am here to learn and to hope to add value, "like/don't like" does not add much value imho. $\endgroup$
    – Matt Wolf
    Commented Jan 24, 2013 at 6:58
  • 3
    $\begingroup$ I downvoted you. You and @phi didn't even address the question, which is about libraries for F#. $\endgroup$ Commented Jan 24, 2013 at 12:31
  • $\begingroup$ @chrisaycock, well I stated the fact which is that there are none that could be considered standard. Some believe its because F# is relatively new and I added my own point which is that I do not believe F# will ever catch on much. If you still think that is missing the question (though I precisely answered it and added maybe more content in addition than you wanted to see, though you were not the recipient) then feel free to retain the down vote, I stand by my answer. $\endgroup$
    – Matt Wolf
    Commented Jan 24, 2013 at 15:23
3
$\begingroup$

F# is a relatively recent programming language: it was only included with Visual Studio since the 2010 version. Therefore, there is little chance that programmers had the time to agree on a common library, especially given the fact that Quantitative Finance is a broad field and hence different libraries might be better in specific areas.

I still think the question deserves an answer because F# is being more and more used in Quantitative Finance and I guess programmers in the field will start wondering about a reference library in the future.

First of all, it is important to remember that F# is part of the .Net framework. Hence, you have to keep in my that any library being used nowadays in another language of the framework (I'm especially thinking about C#) can be used from F#. For example, as mentioned by phi, you will be able to use Quantlib. The thing is, to be able to leverage the advantage of the functional programming paradigm which is the main advantage of F#, you would have to create a wrapper around a library that hasn't been done especially for that language. Some of the existing libraries, such as NAG, are starting to make F# wrappers so there is a good chance that more wrappers will be available in the future.

Finally, let's just say again that in order to make profitable strategies, you will not be able to solely rely on available libraries, you will have to implement extensions in-house.

$\endgroup$
5
  • $\begingroup$ Great answer thanks, I hope that f# wrapper comes out soon for Quantlib $\endgroup$
    – Nikos
    Commented Jan 24, 2013 at 0:22
  • $\begingroup$ @SRKX, I guess you are aware that as soon as you run C# code through a wrapper within F# you lose pretty much most of the F# advantages that one supposedly wanted to utilize in the first place. So far Microsoft has not convinced me at all that F# is a better place to be rather than Haskell or Erlang. If I want functional language properties I would rather go with those other, much more established languages. So far I have not seen a whole lot that convinces me that F# plays very nice with C# or C++. $\endgroup$
    – Matt Wolf
    Commented Jan 24, 2013 at 10:38
  • $\begingroup$ @Freddy I agree that doing the wrapper will not "inject" F# features in the library. You can be willing to use F# because you enjoy functional programming and you plan to build a model in this paradigm but you need at some point to be able to interact with other part of you environment which are written in C# for example. I'm not sure I would chose F# if I was asked to code an independent functional programming project from scratch. But if I have to manage interaction with .net object-oriented code, then I surely would. $\endgroup$
    – SRKX
    Commented Jan 24, 2013 at 11:12
  • $\begingroup$ fair points, there is admittedly not much out there for Erlang or Haskell. Some open source projects such as ZeroMQ cater to everything under the sun, so also most functional languages. But other libraries are not that supportive. $\endgroup$
    – Matt Wolf
    Commented Jan 24, 2013 at 11:52
  • $\begingroup$ Interesting arguments. There are good jobs here in london using f# in quant roles. $\endgroup$
    – Nikos
    Commented Jan 24, 2013 at 12:55
0
$\begingroup$

Unfortunately, the most there is seems to be the C++ QuantLib. I am not overly familiar with F#, but i assume there is a way to access C++ libraries.

Its documentation is pretty much nonexistent, however Mark Joshi has published a very good book on Design Patterns with C++, which will help you get started. You may be able to utilize the methods from QL in your system, but implement your own code in F#, but that heavily depends on your usage scenario (maybe you could elaborate on that a bit more?). Another way would be to write most of your system in C++ (or anything else, Java or Python offer decent implementations of QL) and only write only some modules in F#, depending on your needs. This, however, can quickly become a huge mess, and needs to be planned carefully. Weight the advantages of using an at least commonly used library.

On a different note, Microsoft has a case study on F# in banking, but unfortunately they do not answer your question, however it may serve you as a resource for further research: http://www.microsoft.com/casestudies/Case_Study_Detail.aspx?casestudyid=4000006794

$\endgroup$
6
  • $\begingroup$ that's a cool paper!, makes me feel like I'm investing in the right thing $\endgroup$
    – Nikos
    Commented Jan 24, 2013 at 0:28
  • $\begingroup$ interesting link but it contains a lot of misleading statements. "F# interoperates with .Net products such as WPF"? Simply not true. Everything behind the scenes you need to do to get going in WPF can only be done in non-functional languages. " When you’re editing F# code in Visual Studio, you instantly see if something is wrong because errors are highlighted with a red line.” -> Wow, now tell me where that is not the case in C#, for example. "Static typing"? Want strong-typing? Chose C#, want dynamic typing? Chose C#. Whats really the advantage of F#? I never got it. $\endgroup$
    – Matt Wolf
    Commented Jan 24, 2013 at 1:35
  • $\begingroup$ @Freddy For me F# helps with implementing complex equations. $\endgroup$
    – Nikos
    Commented Jan 24, 2013 at 12:59
  • 1
    $\begingroup$ @Nikos, care to share an example that can be solved more easily in F# than C#? Honestly curious. Thanks. $\endgroup$
    – Matt Wolf
    Commented Jan 24, 2013 at 15:19
  • 1
    $\begingroup$ @Freddy see how easier it is to express the Block Scholes using f# fssnip.net/3I $\endgroup$
    – Nikos
    Commented Jan 24, 2013 at 18:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.