By Scalpel Team. . 7 min read.
In short
IB Gateway is Trader Workstation (TWS) without the trading screens: the same login, the same API, about 40% fewer resources by IBKR's own estimate. Run IB Gateway when another program is your trading screen, and TWS when you also want IBKR's own windows for charts, manual orders or account work. Both need a two-factor login, both should be set to auto restart daily, and both make you log in again once a week.
Every trading app that connects to Interactive Brokers through the TWS API needs one of the two programs running and logged in on your computer. The choice looks small, but it decides how much memory the setup eats, what happens at the daily restart, and whether you can still click an order in by hand when something goes wrong. Settings below were checked against IBKR's documentation on October 15, 2026.
Scalpel is independent and not affiliated with or endorsed by Interactive Brokers.
TWS (glossary) is IBKR's full desktop trading platform: watchlists, charts, Level 2 in BookTrader, order entry, hotkeys, scanners, account windows. It also serves the API, once you switch the API on.
IB Gateway (glossary) is the API server without the platform. You log in, a small status window appears, and that is all you see. IBKR's docs put it plainly: "From the perspective of an API application, IB Gateway and TWS are identical" (IBKR: The IB Gateway). Same orders, same market data, same limits. The difference is everything around the API.
| What | TWS | IB Gateway |
|---|---|---|
| Trading screens | Full platform | None: a status window |
| Resources | Heavier | About 40% fewer, per IBKR |
| API | Off until you tick Enable ActiveX and Socket Clients | Always listening |
| Default ports | 7496 live, 7497 paper | 4001 live, 4002 paper |
| Login | Username, password, two-factor | The same |
| Daily restart | Auto restart under Lock and Exit | The same |
| Weekly login | Yes | Yes |
| Can lock on inactivity | Yes, unless Never lock is set | No |
| Manual orders and charts | Yes | No |
IBKR's only published comparison is that IB Gateway "consumes about 40% fewer resources" than TWS. It does not publish megabyte figures, and real use depends on what you open: in TWS, every chart, watchlist row and depth window costs memory and CPU, while IB Gateway's load comes only from what your API programs request.
Two things help either program:
If your trading app already draws your charts, Level 2 and tape, running TWS underneath means paying for the same data on screen twice. That is the main reason to pick IB Gateway for day trading.
Do not be alarmed if IB Gateway shows a yellow or inactive data farm connection when nothing is running. IBKR notes that IB Gateway does not connect to the market data farms until a program asks for data.
Both programs are designed to restart once a day. Left at the default, they log you out at a set time, every API connection drops, and your trading app sits disconnected until you log in again. The fix is the same setting in each:
In TWS, open File > Global Configuration (Edit > Global Configuration in the Classic layout), then Lock and Exit. In IB Gateway, open Configure > Settings, then Lock and Exit.
Select Auto restart instead of Auto log off, and set a time you never trade, such as late evening. The time is in the time zone TWS is set to, not necessarily New York time.
In TWS, choose Never lock Trader Workstation. A locked TWS disconnects API programs. IB Gateway does not lock on inactivity.
Click Apply and OK. From now on the program restarts itself each day without asking for two-factor, and API programs reconnect after it comes back.
Auto restart does not remove the weekly login. IBKR's docs describe a session running "from Sunday to Sunday" with auto restart, after which you must enter your credentials again (daily and weekly reauthentication). Plan to log in, with your phone to hand, before your first session of each week.
The API page has the same settings in both programs, in different places:
| Setting | TWS | IB Gateway |
|---|---|---|
| Where | File > Global Configuration > API > Settings | Configure > Settings > API > Settings |
| Enable ActiveX and Socket Clients | Must be ticked | Not shown: always on |
| Socket port | 7496 live, 7497 paper | 4001 live, 4002 paper |
| Read-Only API | Untick to allow orders | Starts ticked: untick to allow orders |
| Allow connections from localhost only | Keep ticked | Keep ticked |
| Precautions | API > Precautions | API > Precautions |
The ports are IBKR's defaults (IBKR's port list). You can change them; the program you connect must use the same number. With Read-Only API ticked, programs can read quotes and your account but not place orders, which is a sensible lock while you only practice. Every setting is explained in enable the TWS API.
IBKR requires two-factor for every user, and the API programs are no exception: you approve the login in IB Key or another supported method each time you log in by hand. IBKR's two-factor page for the API lists IB Key, the smartphone apps, SMS and the Digital Security Card+ as supported, and the security code cards as not supported.
The bigger trap is sessions. IBKR allows one trading session per username at a time (logging into multiple applications). Log in to TWS while IB Gateway runs on the same username, or to IBKR Desktop, and one of them is signed out, taking its API connections with it. You cannot run TWS and IB Gateway side by side on one username.
If you want both, add a second username in Client Portal. Market data subscriptions are set up per username, so the second one needs its own, and pays for them.
IB Gateway is lighter, but TWS earns its memory in a few situations:
| Your setup | Run | Why |
|---|---|---|
| A trading app is your only screen | IB Gateway | Lighter, never locks, nothing duplicated on screen |
| A trading app plus TWS windows | TWS with the API on | One login serves both |
| You trade by hand in TWS only | TWS, API off | No API needed |
| You want both fully open at once | TWS on one username, IB Gateway on a second | Two logins, two sets of data subscriptions |
| Older or low-memory computer | IB Gateway | About 40% fewer resources |
| New to IBKR | TWS first | Learn what the broker sees before you automate around it |
Scalpel works with either. It connects to the API socket on the same computer at 127.0.0.1, starts on port 7497, and you set Settings > Connection > Port to whatever your program listens on: 7497 or 7496 for TWS, 4001 or 4002 for IB Gateway (connect Scalpel to Interactive Brokers).
While the link is down, Scalpel checks every 5 seconds which program answers on those four ports and says so in a banner: Use port 7496 when TWS is on its other port, Use IB Gateway when the other program is the one running, and Start TWS or Start IB Gateway when nothing is running and the program is installed in its usual place.
If Scalpel is your only trading screen, IB Gateway is the lighter choice. Keep in mind that Scalpel's stops are watched by the app, so if TWS or IB Gateway restarts or drops while you hold a LIVE position, nothing protects it until the link is back (fix a disconnected Scalpel). That is one more reason to set the daily restart well outside your trading hours.
For what the API itself can and cannot do for a scalper, from market data lines to pacing, read scalping through the TWS API. For the full setup from account to hotkeys, see day trading on Interactive Brokers.
Trading carries a significant risk of loss. Nothing here is financial advice.