Can I use Python? Is an API language specific? Can I use Python?

Discussion in 'Automated Trading' started by RandomOrNot, Aug 25, 2008.

  1. Hi there,

    I am just starting an automated trading project, struggling right at the beginning:)

    I am trying to choose a trading-platform and a language. My first choice as a language would be Python, because it is easiest to learn.

    Now if I read somewhere that a software has an API, does this mean that any language meeting some standards can connect to it, or is this an interface only for some specified language? (I do not really want to work with something complicated as Java or even C++, but still need a full blown programming language).

    Is it an advantage to use the same language as the one in which the software is programmed?

    Thank you for your help.

    Pete
     
  2. Euler

    Euler

    API's are very language-specific, in general, but for some systems (e.g., Microsoft .Net), multiple languages can work with the same API, and it's also possible to invoke function calls from one API to another under certain circumstances that you'll need to research specifically to your own case.

    In my experience, you're better off using the language that has the lion's share of the examples, best support, etc. from the vendor, even if it means using a language you'd otherwise never use. You can likely build a "bridge" from the API's native language to your own system (using shared file systems, sockets, a Web server, etc.), although this may be more effort than you want to expend.
     
  3. ATLien

    ATLien

    Python is not to be underestimated, and it isn't any less full blown than Java/C++, just a bit higher level. The dynamic/functional aspects make it a great language to do some neat things in. That being said, I've programmed a few trading related apps in python, and most vendors do not provide a python API.

    If the vendor provides a TCP API, you can program your module to interface with it. Most vendors provide C/C++ and Java APIs. You can write python wrappers around C libraries and use them inside your code, but it's definitely not something I would recommend for a novice programmer.
     
  4. Graham1

    Graham1

    There are various tools that reduce the workload involved in making Python wrappers for C++ code - the one I prefer is SIP (http://www.riverbankcomputing.com/static/Docs/sip4/sipref.html)

    But it takes some learning on how to use it - and you still need some C++ experience to understand what is going on and how to compile and link the modules it builds.
     
  5. I am not familiar with Python, but provided it allows for the integration to OS-standard libraries (COM modules, probably for windows, and shared or static libraries for unix), you can utilize this integration to get at the vendor's API.

    APIs for vendor products CAN be specific...many vendors provide C#, C++ and java. However, most are now also providing a FIX-based API. In this case, your development language simply needs the ability to parse a FIX string, do a little math (to calculate a checksum) and make a socket connection. Python can make a socket connection, and since it can do this, I imagine it can also integrate with other libraries. Hope this helps.
     
  6. Thank you for all your answers. This probably means that I will have to use Java (C++ is just too much pain for me) I am too unexperienced to deal with wrappers or other exotic stuff. To bad, I liked the idea of using python.
     
  7. Euler

    Euler

    In my opinion, Java's an excellent choice for a trader who's relatively new to programming.
     
  8. brian1017

    brian1017

    I run a self-written automated trading system. I originally programmed it in visual basic, but have since transitioned it almost entirely to python. I love python as a programming language. My new python-based system is much easier to read, modify and maintain. The interactive nature of python makes backtesting and analysis a much better process.

    On the downside, python, as an interpreted language, python is slower than compiled languages.

    I use IB as my broker. There is a python wrapper called IBPy that allows you to access the IB API in from python.

    I use IQfeed as my quote source. I don't think IQfeed has a python API. This is still the one part of my system that that uses .net. I get the quotes with a small .net component and send them to my trading program via windows named pipes.
     
  9. bidask

    bidask

    liar liar pants on fire! :D

     
  10. I like Python and it's the first high-level language I learned. Though, I switched to C#, later on because the particular broker I used supported C# or Java.

    The fact is that most brokers support .NET or Java. If that doesn't mind you and like to use a C interpretted language, I would also look into RubyRails... I've heard so much good stuff about it.

    ...

    The path I would take now is...

    Learn Python and stick with it for a few years.
    Then go directly to C++.

    Reason:
    So... I use C#. From my current status, I would like to use C++ because it's a lot faster. But I haven't had the time to rebuild all my code in C++, plus my C# library keeps on growing and growing... I dream of detaching myself from .NET...

    If you're an "above average" retail trader to a small/mid sized hedge fund, C# or Java is more than enough. But if you want to be on top of the game, C++ is the language to use and learn.

    Personally, I'm at a point where I take every line of the code with a Profiler fighting for every split second to make my tests run faster...

    ...

    PS. SQL queries are a pain in the ass... I need to get my damn data faster... NO LOCK... View... StoredProc... isn't enough... I need my damn data faster!!!!!!!!!!!!!!!

    Any suggestions and info regarding SQL?
     
    #10     Aug 27, 2008