Algorithmic Trading Group Forum
https://www.algotradinggroup.com/cgi-bin/yabb2/YaBB.pl
Trading Strategies >> Software Infrastructure >> Functional programming languages
https://www.algotradinggroup.com/cgi-bin/yabb2/YaBB.pl?num=1215367637

Message started by Baltar on 07/06/08 at 19:07:17

Title: Functional programming languages
Post by Baltar on 07/06/08 at 19:07:17

Here's an interesting alternative to the usual set of imperative languages.  Jane Street Capital use a functional programming language for all their development.  They are using OCaml.  See the following paper:

Adventures of a functional programmer on Wall Street
www.janestcapital.com/yaron_minsky-cufp_2006.pdf

Title: Re: Functional programming languages
Post by Co0olCat on 07/06/08 at 19:51:59

Hi Baltar,

It is interesting presentation.
There is intriguing aspect, which I think answers most of the questions: they are looking for people able to program in OCaml. After 3 years since the presentation was written I do not see that OCaml is dominating language (Is it?).
As for me, I am reluctant to spend time to learn it since fast code I will produce with C/C++. Any statistical and econometric procedures I will find in R and unwrap them to use in my code.
So the question is... why this relatively new language is better? Do we invent bike again?
Comments...


Regards,
T.  :)

Title: Re: Functional programming languages
Post by Baltar on 07/07/08 at 01:49:35


Co0olCat wrote on 07/06/08 at 19:51:59:
Hi Baltar,

It is interesting presentation.
There is intriguing aspect, which I think answers most of the questions: they are looking for people able to program in OCaml.


Now the good people come to them.  It seems like a gamble though.  


Quote:
After 3 years since the presentation was written I do not see that OCaml is dominating language (Is it?).


Much of the hard-core functional programming focus seems to be on Haskell these days.  


Quote:
As for me, I am reluctant to spend time to learn it since fast code I will produce with C/C++. Any statistical and econometric procedures I will find in R and unwrap them to use in my code.
So the question is... why this relatively new language is better? Do we invent bike again?


Its always good to use the most suitable language for the problem domain (and even alternate languages for sub-domains).  Pure, functional languages fit into the implementation domain somewhere, but I'm not sure where. (Personally, I can't program in OCaml either and use C++ and Python, but its interesting to see that some company uses an alternative to the traditional languages.)


Title: Re: Functional programming languages
Post by Algo Designer on 07/08/08 at 13:54:59

IMHO, both functional and imperative programming models can happily co-exist even in the context of the same strategy. The latter can be nicely layered with the "quant core" (signal generator or whatever it might be) implemented in the functional language. The order placement optimisation, on the other hand, requires state. This is where the imperative approach comes in handy. I am hypothesizing here.

In my practical experience, the usage of functional language did not go beyond prototyping. I have always found it convenient to "port" solutions to a more traditional language (Java in my case) and optimise things for performance where needed. This is just my personal preference.


Title: Re: Functional programming languages
Post by Miles Sabin on 07/08/08 at 16:36:27

If you're stuck with targeting the JVM or the CLR then you might be interested in taking a look at Scala (an object-functional language which interoperates extremely well with Java, http://www.scala-lang.org/) or F#(a close relative of OCaml which targets the CLR and I believe interoperates reasonably well with other CLR languages, http://research.microsoft.com/fsharp/fsharp.aspx).

Title: Re: Functional programming languages
Post by Yury Rojek on 07/11/08 at 17:41:40

Functional languages have some advantages over imperative ones. At the moment, the argument goes like this.
1) Imperative languages continue borrowing from functional languages whenever they meet some problems. Examples are Template metaprogramming in C++ (Generics in C#/Java to some extend), lambda-calculus (closures in various languages). So, why not use functional languages all along then?

2) Writing code is difficult, learning curve is steep. But the code produced is less buggy. It is very often the case in Haskell that once it compiles - it has no bugs.

3) Multi-core, Multi-processor architectures are becoming cheaper, stronger and more accessible. Writing multi-threaded program even on single CPU machine is hard in general. Parallelizing algorithms is hard too. Programs written in functional languages are easily parallelizable. The closest alternative to Haskell-style parallelization in C++ is openPM.

Title: Re: Functional programming languages
Post by Z on 07/31/08 at 06:03:53

I've used Haskell back in my uni days. I also heard a lot of good things about Erlang. Would love to code the "business-logic" side of things in a functional language. Alas, there are many, many reasons why this is unlikely to happen any time soon.

Title: Re: Functional programming languages
Post by stargrazer on 10/05/08 at 12:57:55


Co0olCat wrote on 07/06/08 at 19:51:59:
As for me, I am reluctant to spend time to learn it since fast code I will produce with C/C++.


Boost [1]is a popular C++ Library.  Within it are a number of add-ons providing functional programming ability to the multi-paradigm programing language C++.  One of the newest arrivals is Phoenix.  [2].  One add-on which has been around for a while is Lamba.  [3]

[1]  http://www.boost.org/doc/libs/1_36_0/libs/libraries.htm#Function-objects
[2]  http://www.boost.org/doc/libs/1_36_0/libs/spirit/phoenix/doc/html/index.html
[3]  http://www.boost.org/doc/libs/1_36_0/doc/html/lambda.html



Title: Re: Functional programming languages
Post by Lucky711 on 04/07/09 at 03:51:58

I've been using / learning Scala and am quite impressed so far...  That it is so workable with Java is a huge plus for it as well.

Title: Re: Functional programming languages
Post by Sergei Drannikov on 04/07/09 at 06:56:47

I believe that Scala is a very likely candidate for being the 'next-gen' language for the JVM platform. Its benefits include being full blown OOP (even more so than Java in a sense), full blown FP, static typing (though having many benefits of dynamic typing by employing very careful and intelligent trade-offs), 100 % compatibility with JVM, to name just a few. It's perfectly suitable for financial institutions having large investments in Java IMHO.

Same things can be said for F# on .NET platform.

Title: Re: Functional programming languages
Post by Alexander Temerev on 04/07/09 at 10:39:57

I've considered using OCaml myself for future projects. It differs from other functional languages because it's FAST. It is probably the only functional programming language that can match C/C++ in speed (and get things done with much more clear and concise code — if you know how FP).

Scala is good as well and it is fully interoperable with Java. However, Scala's performance is not that good...

Title: Re: Functional programming languages
Post by Yury R on 04/07/09 at 12:37:40

I have been in one company on interview some time ago and they use Scala for Monte-Carlo option pricing. They proudly stated that they haven't noticed any particular problems with speed.

Talking to other companies I also noticed that all Java-shops end up having a grid of computers (may be just a few PCs, or 30-40-100s).

It might be the case that C++ might suddenly half-die, given some imperfections accumulated over time. It just needs a final blow.

Discaimer: I am C++ programmer myself for 10+ years and would rather it doesn't die soon, but I have always been impressed with functional languages (since may be 1st year of uni).

Title: Re: Functional programming languages
Post by Algo Designer on 04/07/09 at 12:41:33

Scala is certainly a very elegant language, but I also heard that it is still not on par with Java performance-wise. I am wondering if any members of this forum implemented a trading strategy in the former.

I should take a look at OCaml...

Title: Re: Functional programming languages
Post by Algo Designer on 04/07/09 at 13:02:14


qroach wrote on 04/07/09 at 12:37:40:
...
It might be the case that C++ might suddenly half-die, given some imperfections accumulated over time. It just needs a final blow.

Discaimer: I am C++ programmer myself for 10+ years and would rather it doesn't die soon, but I have always been impressed with functional languages (since may be 1st year of uni).


As much as I like C, I perceive C++ as a syntactical Frankenstein. It will last for a while though. I have progressively migrated most of my work to Java over the last 9 years.

Disclaimer: I have been programming in C/C++ since I was a teenager (it's scary to put the number of years...) and Java since 1997. Although I have always liked functional languages, I have never used them in production applications, only in throw-away prototypes.

Algorithmic Trading Group Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.