GEXPITGuides

Setting up Interactive Brokers (once)

The Recorder reads the option chain from your own Interactive Brokers account through IB Gateway on the same PC, signed in to your paper-trading account. With Start IB Gateway by itself on (the normal way), the Recorder starts IB Gateway and sets it up for you: you never open its settings. By hand you do only two things at Interactive Brokers: the market-data subscriptions and their sharing with the paper account. About 10 minutes, once.

The Recorder never places orders. It connects in read-only mode and only reads market data. GEXPIT never sees your broker password: it stays encrypted on your PC.

What you need from Interactive Brokers

Switch them on in the Client Portal, in Settings → User Settings → Market Data Subscriptions, on your live account and in your own name. The wording can differ a little with the language of the portal. If the Recorder then says “not subscribed”, see No market data.

A standard account has 100 simultaneous market-data lines. You choose how many the Recorder may use: Settings → IBKR data lines, 50, 70, 90 or Other. Leave some free for your trading. If the limit is reached, the Recorder tells you (details).

1. Install IB Gateway

Download IB Gateway from Interactive Brokers (the stable version) and install it. Nothing else to do in it.

At the first start of the Recorder, its welcome window (Welcome to GEXPIT Recorder, page Connect to IBKR) finds IB Gateway by itself. Choose Paper trading, type your IBKR user name and password, keep Start IB Gateway by itself ticked and press Finish. On trading days you only approve IBKR’s own sign-in on your phone when IBKR asks.

2. Share your live data with the paper account

A paper account has no market data of its own. Sign in to the IBKR Client Portal with your live username, open Settings → Account Configuration, find Paper Trading Account and switch on the sharing of real-time market data with the paper account. Wait a few minutes. Without this, the paper session gets delayed data or none (No market data).

IBKR delivers live data to one session at a time for the same username. If Trader Workstation, the mobile app or the web platform is open elsewhere with the same login, the Recorder’s session may get nothing: close the others before the session.

That is all for most testers. The rest of this page is only for special cases.

Paper or your real TWS?

Only if you trade with Trader Workstation (TWS) on the same account. IBKR sends live data to one session at a time: if your real account is open in TWS and the Recorder uses the paper account at the same time, the paper session loses its data, error 10197 (“No market data during competing session”). Pick one of three ways. The Recorder never starts, closes or changes TWS: you set its API once and keep it open.

Way 1: one pipe (simplest if you trade with TWS)

  1. The Recorder connects to your real TWS. No IB Gateway, no paper account.
  2. In TWS open Edit → Global Configuration → API → Settings.
  3. Tick Enable ActiveX and Socket Clients.
  4. Keep Read-Only API ticked. The Recorder never places orders.
  5. Socket port: this number (TWS on a real account).
    Socket port7496
  6. Keep Allow connections from localhost only ticked.
  7. In the Recorder, step 4 below: Host 127.0.0.1, Port 7496, Client ID 11.
  8. Keep TWS open for the whole session.
  9. Mind the data lines: the Recorder and your TWS share the same 100 (see above).

Way 2: two pipes

  1. The Primary User adds a second user to the same account: Client Portal, Settings → User Access Rights, the “+” next to Users.
  2. The second user needs their own market data subscriptions: IBKR charges data fees for each user.
  3. IB Gateway runs on the real account with the second user (in the Recorder: Live trading). Its port is this number:
    Socket port4001
  4. In the Recorder, step 4 below: Port 4001.
  5. Trade in TWS with your own user, as always.

Way 3: the long pipe (TWS on another computer, for example a VPS)

GEXPIT runs only on your physical PC (Beta Tester Agreement, section 2.7); remote access is fine. If your TWS runs on a server:

  1. Join the PC and the server with a private encrypted network, for example Tailscale, or the VPN you already have.
  2. In TWS on the server: Read-Only API ticked, port 7496.
  3. Untick Allow connections from localhost only, and add your PC’s private address in Trusted IPs.
  4. In the Recorder: Host = the server’s private address.
  5. Restart TWS every day outside the session: Global Configuration → Lock and Exit.
Never open the API port to the internet. Only the private network may reach it.

3. API settings in IB Gateway (only if you start it yourself)

Skip this with Start IB Gateway by itself on: the Recorder sets these for you. If you switched it off, sign in to IB Gateway, open Configure → Settings → API → Settings and set:

  1. Read-Only API: ticked. The Recorder needs nothing more.
  2. Socket port: this number, IB Gateway’s default for a paper account.
    Socket port4002
  3. Allow connections from localhost only: ticked. The Recorder runs on the same PC.
  4. Trusted IPs: add this address.
    Trusted IPs127.0.0.1
  5. Master API client ID: leave empty.
  6. Press OK. If IB Gateway asks to restart, do it.

Then also set its daily restart outside the session: The session stopped halfway.

4. The Recorder’s settings (to check)

The welcome window fills these in for you. To check them, open Settings in the Recorder, section 2. API network:

Host127.0.0.1
Port4002
Client ID11

If another program also connects to your IB Gateway, each one needs a different Client ID. The Recorder also opens a second connection with a Client ID 50 higher than yours. With the default that is this number: leave it free.

Leave free61

Section 3. IB Gateway automatic start holds Start IB Gateway by itself, your IBKR user name and password and the IB Gateway folder. Your broker password is stored encrypted on your PC and is never sent to GEXPIT; you are responsible towards your broker for its security, so protect your Windows sign-in with a password or PIN and install only software you trust.

5. Try it

The Recorder runs a guided IBKR check whenever you press its button: is IB Gateway or TWS running, which port answers, is the API on, are the SPX options data allowed. Each problem comes in one line, with what to do. With the market closed it tells you what it tried, and tries again by itself at the open.

  1. Press Start in the Recorder. It starts IB Gateway and signs in (approve IBKR’s sign-in on your phone if IBKR asks). In the console you should see the connection line in green. You can try in the evening: the Recorder connects, then waits for the next trading day.
  2. A red line? Look it up in The Recorder can’t connect to Interactive Brokers or No market data, or “not subscribed”. Each message tells you what to do.