Guide 13.3
Beginner, 4 min read. Checked with Scalpel 1.12.8 on .
In short
Interactive Brokers allows one trading session per username. TWS, IB Gateway and IBKR Desktop all count, so logging in to IB Gateway signs TWS out, and the other way round. Run only one of them for Scalpel (IB Gateway alone is the lightest), run Scalpel alongside TWS, or add a second username in Client Portal so each program has its own login.
This is an Interactive Brokers rule, not a Scalpel setting, and no setting in TWS or Scalpel gets around it. The fix is to choose how you want to run.
A username can hold one live trading session. When a second program logs in with the same username, Interactive Brokers asks whether to take over the session and then closes the first one. TWS shows that it has been logged out; Scalpel loses its connection if it was using that program.
| Counts as a session | Does not |
|---|---|
| TWS | Client Portal (the website) |
| IB Gateway | |
| IBKR Desktop |
The IBKR mobile app can also compete with your desktop login for market data. If quotes stop on your desktop while you use the app, log out of the app.
Scalpel was using the program that just lost the session, so you hear IB connection lost, the IBKR pill turns red, and the banner points at whatever is still running. If IB Gateway took the session, the banner offers to use it:
Clicking Use IB Gateway connects Scalpel to the program that now holds the session. Your LIVE positions are picked back up from Interactive Brokers when it reconnects.
| Setup | How | Good for | Cost |
|---|---|---|---|
| Scalpel instead of TWS | Run IB Gateway only, logged in. Scalpel on 4001 (live) or 4002 (paper). | The lightest setup. Scalpel is your only trading screen. | Nothing extra |
| Scalpel alongside TWS | Run TWS only, with the API enabled. Scalpel on TWS's port (7496 live or 7497 paper by default). | Keeping TWS's own screens and windows open next to Scalpel. | Nothing extra |
| Both fully open | A second username: TWS logs in with one, IB Gateway with the other for Scalpel. | Running TWS and IB Gateway at the same time. | Market data is billed per username, so the second one needs its own subscriptions |
Both TWS and IB Gateway restart once a day and ask for a fresh login unless you set auto-restart in their settings, and both need your two-factor approval at login. IB Gateway has no trading screens, but it still needs you to log in.
Log in to Client Portal on the Interactive Brokers website and open Settings > Users and Access Rights.
Add a new user with trading access to the same account, following Interactive Brokers' steps. It needs its own two-factor setup.
Market data subscriptions belong to a username, not the account. Give the second username the subscriptions Scalpel needs: live quotes and Level 2 depth for the exchanges you trade (guide 1.6).
TWS with your usual username, IB Gateway with the new one. Point Scalpel at IB Gateway's port in Settings > Connection (guide 1.4).