Not sure if right place - but can automation/programming do this in IB?

Discussion in 'Interactive Brokers' started by Saltynuts, Jan 23, 2020.

  1. I have an IB account.

    I want to set these simple conditions:

    If security A is up by more than X% of the amount security B is up, buy (or sell) security A and sell (or buy) security B. Something like that.

    I take it that can be done one way or another in IB? If so, how? Is there some order that will do this, or should I learn some kind of programming to do this? If so what kind?

    Thanks!
     
  2. guru

    guru

    You could try coding this in Excel and using IB Excel examples included with IB's API.
    They provide Excel-based GUI for placing orders, which also streams quotes, and possibly could be scripted to work together. It may need some "figuring out" or hiring temp help.
    Just not sure if it can work reliably and without obstructing your main trading.

    https://interactivebrokers.github.io/tws-api/dde_realtime_tutorial.html

    upload_2020-1-23_19-54-10.png
     
  3. gaussian

    gaussian

    For this particular task I would advise against their DDE software. It was not as reliable as I had hoped.

    Given the constraint of "submit x if y", you may want something more robust. Perhaps look into their Python API (there are public ones available). It is probably the simplest given the language, however you (or someone else) will need to understand their real time API.
     
  4. You're basically talking about a pair trade? I'd recommend Jupyter and ib_insync.

    I think they've replaced it with some .NET thing.
     
    guru likes this.
  5. guru

    guru


    Agree in general, though I see IB now including several Excel API variants, with one of them being DDE. Now they also seem to include Rtd, which seems very popular with TDA/ToS.
    Though I haven't used any of these to get a feel for features & reliability.

    upload_2020-1-23_21-3-54.png