Home > Technical Topics > Programming > Run IB API headless

Run IB API headless

  1. You have to pay for docker though, don't you?
  2. No, the application-container engine and developer tools is all free software/open source. Commercial support contracts or hosting of proprietary container images on hub.docker.com one has to pay. But that is mostly for businesses and corporations.
  3. Interesting. I had heard of Docker but mostly use VM products like VirtualBox.
    I welcome shiny, new things to distract me. :D
  4. Erm.....

    I'm not sure why you call it a "solution" ?

    An API. By definition. Is headless.

    What programming language you use to talk to the API is up to the developer.

    Comparing API to TWS is irrelevant ! TWS is an example of implementation of access to API.
  5. Do you use the IB API at all? To use the API requires a middleware program, either TWS or IB Gateway, to be running. Both programs require a display to run.
    IBController takes care of part of this, but the Docker solution allows you to create a container that can be easily run and recreated, containing everything needed.
    The alternative is to install IBController directly on your PC. But if your install or the PC itself gets borked up it's harder to recover from. Docker prevents these problems.
  6. Duh, what are you talking about. TWS/IBGateway provides IB's programming API. TWS/IBGateway requires a graphical display to run. IBController packages the Java jar files from TWS/IBGateway so they can run without the need of a graphical display. It's a solution to a known problem that many system developer using IB have.
  7. Couple of questions:

    1) How does it address second level authentication (besides username/password there is a prompt for an additional password to be entered).

    2) Is this a headless solution for IB Gateway, or a solution which is headless that launches IB Gateway inside it? (In other words, did you modify IB Gateway to not show a UI, or is the UI being launched within the VM, but the VM itself is not being shown).

    (Based on my quick look at GitHub it looks like the second, but want to make sure I'm not missing anything).

    Thank you, and thank you for sharing :)
  8. I kinda wondered that myself. I use the 2-factor authentication but it's unclear how that works with IBController.
  9. Disagree, this docker solution only adds another potential failure point. The IB API requires a gateway, period. Whether the gateway is hosted on your Pc, inside a layer or on another machine is irrelevant, other than the complexity level and number of potential failure points. The only way around the gateway is a Fix connection directly to IB's server.

  10. TWS or the gateway does NOT provide the API. IB implemented and offers an API. The API by IB's requirement must connect to TWS or the gateway and TWS and the gateway in turn maintain IB server connectivity. How the gateway is managed, via Gui interface or headless doesn't change the routing logic UNLESS IB makes significant changes to the API and makes the gateway obsolete.

    With all due respect and acknowledgement of your work but I only see some edge cases where this might be useful. The time it takes to configure your gateway, set the ports right, copy the ini files will be as much if not longer than simply installing the gateway on whatever host you want it to run. Who cares it has an additional gui layer or not. It exposes the same functionality in the end. Changing ports and dealing with network issues can make working with dockers a total nightmare from my experience. Why making installing the IB gateway, setting the port, and being ready to run more complicated?

    Now if IB made the gateway obsolete and redesigned its API to directly connect to its servers that would be a real game changer.

  11. Agree, dont think it supports that, which makes the software pretty useless, only good for connecting to a demo account. IB have multiple types of 2-factor solutions which all requires interactive input.
  12. There might be value in putting your entire trading system into a docker container; thus reducing implementation time in getting code dependencies, required libraries etc. Might be useful if you're using a cloud solution like EC2, since every time you start up a new virtual machine you need to install all that crud. Or if you're running a system on parallel machines which otherwise again you'd need to manually setup (something I've been thinking about a lot, see my twitter feed https://twitter.com/investingidiocy).

    I found this link useful:

    But sure any kind of headless system will need a way to view the graphic display to deal with the two factor authentication. I use VNC myself (local headless trading server).

  13. Actually there are 3 methods IB uses for 2-factor authentication: the printed card with the random numbers, the pocket calculator and the smartphone app.
    I switched from the pocket calculator to the smartphone app earlier this year and you don't have to type anything into TWS when you log in (except the username and password). You receive a message on your phone, enter the PIN and TWS receives the authentication and logs in automatically.
    Maybe this will work with the smartphone app authentication.
  14. Hi guys,

    The thread is above my head (knowledge), however I am wondering if you fellows can tell me how (with details) to setup the following.

    A-windows 7 laptop that connects to the Starbucks Wifi and my IB account
    B- a broadband router and two lan cables
    C- windows 10 laptop

    both laptops have IB TWS software and NT7 software installed and running
    I want C to be able to connect to IB for the datafeed to run its NT charts

    If I connect to my IB cash account on A then if I try to connect to IB demo account on C it won't let me because IB sees that a different IP is already connected to my account.

    So I wanted to network the two laptops together so that both are accessing the internet through laptop A. When complete, laptop A with be running its own TWS (via the cash account) and NT and laptop C will be running its own NT charts.

    I have been able to make a home network (with both laptops connected to LAN ports) on my router. However, I haven't been able to get my windows 10 laptop (C) to be able to "see" the internet connection that A has made.

    1. Can what I want to do be done?
    2. Do I need to learn powershell to get around WIndows 10 "protecting me" with its dummied down severely limited "home network". so laptop C and see the wireless modem via the network?

    Thanks in advance
  15. Would buying a Wifi wireless router and plugging it into the back of the router in the WAN port be the way to go?