Discussion in 'Automated Trading' started by TSGannGalt, Apr 19, 2009.

  1. I program in C#. All my libs and "most" of the trading infrastructure is in C#. Some parts of it are in C++. I don't use any closed-source or retail packages.

    I've heard a few things about OCaml and recommended by a few guys to learn and use it as a systematic developer. Considering that these guys are with the same very reputable firm, I would like to get an unbiased feedback about the language.

    I program a lot but I'm not big with the programming industry, in general. Can anyone provide me with some feedback regarding it?

    Even more, I know that F# came out via .NET, which is based on OCaml. Without considering the overhead time to existing codes, would it be beneficial for me learn Functional Programming and to what degree can I utilize it within the whole automated trading process?

    Should I keep my infrastructure as C#, and code my models F#/OCaml? How about the middlewares? How about the WPF logics behind the components?

    Thank you in advance.
  2. rosy2


    i got into ocaml a few years ago after reading about jane street's use of it. i think it has the most support and libs amongst other functional languages (erlang, haskell, f#). it also has OO support.

    The huge advantage to functional code is that its readable and you know whats being called. Unlike in OO where some method might be overloaded N times. The huge advantage to ocaml itself is its lexer which makes creating simple languages very easy compared to using lex/yacc.

    Also compiled ocaml is probably faster than all but c++ according to language shootout site.

    however, I never use it in the real world.
  3. The big plus about Java and the .NET languages is the huge ready-to-use libraries behind the language. Though the Ocaml community is trying to address that concern (http://batteries.forge.ocamlcore.org/), I believe that it will take time before they catch up
    a) with the sheer amount of stuff available on .NET
    b) the sheer amount of people who do .NET / Java

    If I came from a .NET background, I would use F# while learning functional programming concepts from the Haskell and Ocaml folks from discussion lists.

    I am from a Java background, and I would migrate towards Clojure once I am satisfied the the FP paradigm is good stuff (Clojure goodness includes macros, STM, functional programming). I am learning about Monads from the very helpful and lucidly verbose Haskell folks, and once it looks like I have understood the core concepts well, I would translate to Clojure.

    I approach the whole FP paradigm with cautious optimism. I know exactly what I am looking for but do not get enough time to evaluate it thoroughly:
    - does the functional paradigm (Monadic / Arrow way of composing programs) help conquer complexity in the large? (a typical algo trading server, for example, is ~150000 to 400000 lines of code)
    - without becoming an incomprehensible and unmaintainable mess? are programs easier to read? I'm not interested in performance at the cost of comprehension, especially in a world where many performance problems can be solved by throwing better hardware at them
    - does QuickCheck work on Monadic programs, and can help automate QA for such large programs?
  4. I am switching my systems modeling from other languages to OCaml or F# or Haskell.

    Besides the functional clarity, a very important reason is that these languages are well suited to execution on multiple cores/processors. They scale. C++/# will not, except by way of unsatisfactory extensions.

    This means that your OCaml or F# program may execute 30 times faster (!) than C variants or Java once 32-core computers are common in the next year or two.

  5. Corey


    My guess is that the firm in question is Jane Street? They have been using OCaml for a while now.

    The biggest benefit is the type safety. Basically, when the program compiles, you can ensure that you won't have any type conversion errors or the like, which can occur in dynamic languages or weakly typed languages. So in the world of finance, that can be a very nice guarantee.

    Other than that, I have found knowing a functional language to be very beneficial to the way I program, even though I may not necessarily use a functional language in my day to day work. It really opens up your mind to some different paradigms.

    Edit: A lot of people also believe that the only effective way to get parallelism and concurrency is through functional programming (see Clojure / Alice ML).
  6. No offence you techies but if you cannot program a trading system in excel or basic and make money none of these fancy languages will help you.

    Technology is a trap. Simple ideas make money. I know people who still take positions in commodity futures with quotes off daily newspapers and make tons of money. I know many others with 10 computers, multiple screens, and programming skills who constantly lose.

    Oh yeah, 32-core computers for faster stupidity are here. That will help geeks to faster optimize their systems and send faster their losing trades to hungry MMs.

    Give me a break...
  7. This.

    Most people building uber-complex systems...
    (400,000 lines of code for an "algo server"?????)...
    Are unwittingly contributing to the field of Artificial Stupidity.

    And in a world that is rapidly moving to off-the-shelf Grid Computing...
    Where every core is viewed as a processing unit...
    And you can string together 10 quad boxes for $10,000 in few days...
    Optimizing code and optimizing compilers are so 90s.
  8. Euler


    Your comments might be considered a good warning for "aspiring automated traders" -- most, after all, should quit before they start.

    But simple/nontechnical ideas are not, in and of themselves, superior to complex/technical ones. Just ask James Simons :D

  9. Thank you all for the advice.

    Very much appreciated and helpful.

  10. The people who need the higher processing power are those who are doing things like real-time stat-arb against a live data stream of quotes of all equities and options.

    Granted if someone is just doing static analysis, not much power is needed.

    They might still gain from the lucidity of functional programming in the long run.
    #10     Apr 22, 2009