Getting Started with Algorithic Trading and the IB API

Discussion in 'Educational Resources' started by kmiklas, Aug 9, 2021.

  1. kmiklas

    kmiklas

    Someone asked me how to get started with programming, algo trading, and the IB API. I wrote this up and thought I'd share there for posterity.

    There are three main pieces to learn: the Pycharm IDE, Python 3, and the Interactive Brokers API.

    <3 Keith

    1. Pycharm:
    - Download:
    https://www.jetbrains.com/pycharm/
    - Training:
    https://blog.jetbrains.com/pycharm/2016/01/introducing-getting-started-with-pycharm-video-tutorials/

    2. Python 3
    - MIT online courses
    https://ocw.mit.edu/courses/electri...and-programming-in-python-fall-2016/index.htm
    - YouTube free course


    3. Interactive Brokers
    - Short Videos are great.
    Scroll to "TWS Python API"
    https://www.interactivebrokers.com/en/index.php?f=14082
     
  2. d08

    d08

    Wasting time on PyCharm seems unnecessary. VSCode/VSCodium will do great. Understanding all the IB API quirks on their own takes time.
     
  3. kmiklas

    kmiklas

    - PyCharm is excellent: specifically built for Python.
    - I find that the more I learn about PyCharm, the more I understand Python itself.
    - It also runs on Windows, Mac, and even Linux... so you don't have to use vim anymore XD
    - The IntelliJ suite is pretty good in general; I've also used CLion.
    - VS Code is also good, but I see it as more for JavaScript

    I also talked with the guy who made the IB short vids and he recommended PyCharm. That's what he uses.
     
  4. What was the reason for pushing for Python and not any of the other software languages which IB supports? Maybe the person who asked you to write the intro is already fluent in another language and now you force him/her to learn Python.
     
  5. Perhaps Excel VBA and the IB API?
     
  6. kmiklas

    kmiklas

    A. It's what the pros use, for good reason
    ... a. It's relatively simple for a beginner to learn
    ... b. It's powerful: supporting OOP and concurrency
    ... c. It's closely integrated with R; easy access to data science tools

    B. Of the five languages that IB offers:
    ... 1. C++: Too much for a beginner; Also, with an IB tick time of 250ms, the speed of C++ is unnecessary. Don't get me wrong, I love C++, but not for this use case... unless he wants to hit the books and learn the C++ syntax.
    ... 2. Java: Too verbose; kind of a clunky language, although Kotlin (next-gen Java) is excellent, and would be my second or third choice; a close race with VB for second.
    ... 3. C#: Too Microsoft. This is the next gen of Microsoft Foundation Classes. It's more towards C++, and best for developing .net and Windows-based applications; not a good fit for a beginner who wants to get things done fast. Also not too good for Linux.
    ... 4. Visual Basic: This is not bad, I love the Excel integration; a close race with Kotlin. I haven't used this much; it is OOP but at first glance the threading model looks a bit strange, but definitely a solid option.
    ... 5. Python: YES. Hits the sweet spot of features, usability, industry acceptance, multi-platform, R integration, and support.

    Additionally, the whole ecosystem is free, which is nice. You do have to pay for Excel.

    Ref:
    https://interactivebrokers.github.io/tws-api/
     
    Last edited: Aug 10, 2021
    jtrader33 likes this.
  7. sef88

    sef88

    kmiklas and yc47ib like this.
  8. kmiklas

    kmiklas

    These algos/ execution systems must be closely monitored, especially when entering and exiting positions is automated. Any bug, logic error, or market anomaly can blow out your account.

    A friend went on vacation for a few days, and left one of these systems up and running. He came home to find his account value cut in half!
     
    yc47ib and sef88 like this.
  9. zdreg

    zdreg

    Obviously, he was an amateur trader with an outsized ego.
     
  10. kmiklas

    kmiklas

    I think that he was just overwhelmed... busy with his family and work obligations. He didn't think that it could blow up on him like that.
     
    #10     Aug 12, 2021