Connection and login

TWS and IB Gateway ports: paper versus live

Quick answer

The usual ports are 7497 for TWS paper, 7496 for TWS live, 4002 for IB Gateway paper, and 4001 for IB Gateway live. These are defaults. Always read the actual port and account mode before connecting an app.

Educational software guidance. Trading involves risk. Read the financial and information disclaimers.

Step by step

  1. 1 Identify the program you opened: Trader Workstation or IB Gateway. Their default ports differ.
  2. 2 Check whether the session is paper or live. In paper TWS, the interface carries a simulated-trading banner.
  3. 3 In TWS, open Global Configuration → API → Settings and read Socket port. In Gateway, use Configure → Settings → API → Settings.
  4. 4 Set the same number in the connecting app. If two sessions run on one machine, each needs its own port.
  5. 5 Verify the returned account in the app. Do not infer paper mode from a port number alone.

A practical example

Suppose you have both a live TWS window and a paper TWS window. Write down which port belongs to each one. Next, connect the app and read which account it found. A port of 7497 is not proof of paper mode because a user can change it. The account and the paper banner are the checks that matter before a test trade.

Illustrative scenario, not a record of a trade placed during this review.

Screen reference

Start in Mosaic with File → Global Configuration. Then choose the panel named in the steps.

TWS Mosaic File menu with Global Configuration and Layout Settings
Open Global Configuration from File in Mosaic. This capture excludes the account header. Captured in TWS paper mode on 3 October 2026. Open the image for full size.
TWS API Settings showing socket clients, read-only access, port and logging
Find the named control in API → Settings. The displayed values belong to a paper session and are examples, not universal recommendations. Captured in TWS paper mode on 3 October 2026. Open the image for full size.
TWS login with Paper Trading selected and both credential fields empty
Choose the intended mode before signing in. This is a normal empty login screen, not a reproduced authentication failure. Credentials were cleared before capture. Captured in TWS paper mode on 3 October 2026. Open the image for full size.
TWS Market Data Connections with farm purpose and status, plus API client columns
The observed services are connected and the API client list is empty. Use this panel to read current status; it does not reproduce a disconnect or prove an app handshake completed. Captured in TWS paper mode on 3 October 2026. Open the image for full size.
How to confirm the result The app should connect to the account you intended, not merely to any open TWS session.

Mistake to avoid

A user can set a live session to 7497. A familiar number does not make the account a paper account.

Common questions

Can I choose a custom port?

Yes, if the server and client agree and the port is available.

Is 4002 a TWS paper port?

It is the usual IB Gateway paper default. Read your actual setup.

Financial and information disclaimers

Financial disclaimer

These guides explain software. They are for education, not financial, investment, tax, or legal advice. No example is a suggestion to buy or sell a product or use a trading strategy. Trading can lose money, including all funds you put at risk. With margin, futures, short sales, or some options, losses can exceed your starting funds. Automation can fail, send duplicate orders, or act late. Stops do not guarantee a fill or a price. Review your orders and positions, and seek advice from a qualified professional for your own needs. Paper trades, examples, and past results do not predict live results or promise a profit.

Information disclaimer

This is general help based on the sources and check date shown on the page. Screens, settings, fees, data access, and product support can change or differ by app version, account, country, and broker. The content may contain errors or become out of date; accuracy, completeness, and continuous service are not guaranteed. Check current broker and app instructions before acting. Screenshots show where controls are; they do not prove that an order test passed. This guide does not replace broker terms or risk notices. References to IBKR and TradingView identify their products and do not imply their endorsement of this guide.

IBKR risk disclosures · IBKR paper-trading limits · SEC guidance on automated investment tools

PickMyTrade help · Independent guidance for Trader Workstation and the desktop integration. TWS images show paper trading. Other applications are named in the image captions. Settings and availability can vary by version and account.

Automate TradingView alerts to Interactive Brokers

See the IBKR integration