best language for quantiative finance? C, D, Fortran,python etc.

Discussion in 'Automated Trading' started by Batman28, Jun 1, 2006.

which language..

  1. C, C++, C#

    40 vote(s)
    38.1%
  2. Python

    17 vote(s)
    16.2%
  3. Delphi

    6 vote(s)
    5.7%
  4. Java

    12 vote(s)
    11.4%
  5. Pascal

    3 vote(s)
    2.9%
  6. C#

    11 vote(s)
    10.5%
  7. D

    0 vote(s)
    0.0%
  8. Perl

    4 vote(s)
    3.8%
  9. other

    9 vote(s)
    8.6%
  10. your own..

    3 vote(s)
    2.9%
  1. I could learn a language with zero effort, I would learn Matlab and Ruby and use them for some of the things I do now in Python.

    Martin
     
    #101     Jun 2, 2006
  2. mrtwo

    mrtwo

    Maybe our dynamic here is different because we have a team in place with a very formal development process and in our case, our C/C++ team is among one of the most productive teams in the house.

    But as I said on the other post, I am not sure I would be developing anything in C/C++ if I were stripped of all our previous investment on it (libraries, patterns, pratices, etc)

    Martin, I already asked nononsense and I would like to hear from you too: what, in your opinion and own words, makes Python the best language for you?
     
    #102     Jun 2, 2006
  3. mrtwo,
    I feel that I did more than my "job" here.
    In fact, there is a lot more required to get started: GUI, DB interface, IDE, libraries. I explained all this a couple of times over during the last 12 months or so. Make some effort yourself and do a little search at ET. You'll find what you want.
    Better still, stick to www.python.org as a starter. They know much better than my second hand know-how.
    I can assure you though that YOU WON'T BECOME PROFICIENT in Python in one week like some wise guy wrote, perhaps a bit if you only aspire to kiddie exercises.
    I'm working 2 years on it and I keep on picking up new "nuggets".
     
    #103     Jun 2, 2006
  4. I think for me, in this line of work, it wasn't Python itself that sealed the deal, it was numarray. Numarray is a package that turns Python into an array language like Matlab or APL.

    http://en.wikipedia.org/wiki/Array_programming_language

    Something like numarray could be written in C++, and probably has been, but the Python object model and syntax make it particularly clean and expressive.

    Without numarray, I think pure Python would be too slow for a lot of the stuff I do. I would have had to write a lot more embedded C code for the core numerical algorithms.

    Here's an example of the power and compactness of Python and numarray. This calculates the correlation, alpha, and beta of two vectors a1 and a2 in a dozen lines of code.

    <pre>
    def Correlation(a1, a2):
    assert len(a1) == len(a2)
    n = len(a1)
    mean1 = sum(a1) / n
    variance1 = sum( (a1 - mean1)**2 ) / (n-1)
    mean2 = sum(a2) / n
    variance2 = sum( (a2 - mean2)**2 ) / (n-1)
    covariance = sum( (a1 - mean1) * (a2 - mean2) ) / (n-1)

    beta = covariance / variance1
    alpha = mean2 - beta * mean1
    correlation = covariance / sqrt(variance1) / sqrt(variance2)
    return (correlation, alpha, beta)
    </pre>

    Incidentally if you are just starting out with Python you should look at NumPy instead of numarray, it is under active development and seems to be the future direction of array programming in Python.

    http://www.scipy.org/NumPy

    Martin
     
    #104     Jun 2, 2006
  5. If you look at the internal buildup of numpy and numarray, you will discover that a large part had been existing as C/C++ libraries and another part as Fortran libraries.
    The writing of such a comprehensive mathematics package requires indeed many years, nay 10-20 years before it is sufficiently debugged and tested in order to become the reliable library as we know it today. It is the result of a major collaborative effort between many research organizations with many active individual participants.

    The presence of Fortran may surprise the unfamiliar with scientific computation.
     
    #105     Jun 2, 2006
  6. Speak for yourself with regards to any such conclusions reached.
     
    #106     Jun 2, 2006
  7. andread

    andread

    aaah.. yes, that makes it a bit clearer. I don't know if it's possible to run so much code only in the library, and I don't know how fast the library is, but this sounds more realistic.
    I also appreciate more the idea of Python interfacing with native code, although I would probably prefer in that case to use only one language.

    Yes, it does. I will trust you on your 4:1 proportion :)

    mmmm, I personally consider it an important factor. The thing i liked least in Java is the lack of templates, that forces me to cast every time a use a collection. I change the type of the collection, nothing checks my casts. I can imagine that in the case of Python this can happen much more often (in complex code, of course).
    But, just to put something more, I might mention (please tell me if I'm wrong):
    1) limited access control. Python has a kind of private access that is not really private, and it doesn't have protected or anything like that. Even the C++ friend (which sucks) is missing
    2) no checked exceptions. Thrown exception are not checked. Not that C++ is better, to be honest (there are tools, though; maybe something similar exists for Python). I personally prefer the Java solution.
    Lack of enums can also be a bit annoying. I did see some workarounds, but I'm not sure how effective they are.

    I am also aware of some strange syntax constructs, but this is probably very subjective.

    Maybe I should mention one last thing. I haven't developed C++ for a few years, but it's still my language of choice if I have to develop a stand alone (non web) application, and mainly for one reason: performance. As a language, I have to say that since 1.5 Java is starting to be quite appealing, although I would still like a couple of things more
     
    #107     Jun 2, 2006
  8. nbates

    nbates

    Gotta say, It's pretty easy to separate the men from the boys in this thread.

    I've coded under almost every ASM, C, Fortran, Pascal, Lisp, Python, Perl, Java, C++, C#, VB, .NET, and other languages in the fashion of the day (applications, device drivers, and firmware on all platforms)...and really need to say there is NOTHING that beats well architected C++ <<[template]>> code for applications.

    If you want GUI use WTL and if you want Database, there are a ton of API's to chose from...I prefer Embedded databases myself, but in most circumstances just bypass that and implement my own home-grown variation (for speed), since all that SQL stuff is really just hash tables with pointers into memory mapped files.

    The real payoff's though are when you start to take a system's approach to the problem(s) and, once you get away from the language or OS doing all the work for you (or so you think), realize the real benefit is finding a balance (the right one!) between CPU, I/O, network, data and code.

    Not too many context switches or application driven hardware interrupts and knowing what parts of your software need to run and belong at the IPL Kernel level and which ones can and should run in User mode. Coalesce your data, it's movement and the GUI operations for maximum efficiency and minimum latency.

    Then of course, there's a benefit in having the ability and/or capability to take things all the way back to the server and build your own Machine down-under, so those FAT Client applications can drop a few calories and your signals can drive trades the way you want them to.

    I guess all that can be done in Python, Perl, CGI script or whatever (and yes, XML and COM are the answer! lol)...but, real programmers are not self-proclaimed, they just work and get the job done.

    -rant-rant
     
    #108     Jun 2, 2006
  9. Oooooooookay.

    Martin
     
    #109     Jun 2, 2006
  10. *yawn*

    So what kind of tasks does the thread starter need to develop?

    Picking a programming language depends on the requirements of the project.

    I personally use C# because it's enough.

    Can program in Java, Python, and a little C++ (really little...)
     
    #110     Jun 2, 2006