Port for Paper Trading TWS is now 7497

This is just a heads up for IBC users using Paper Trading account. Interactive Brokers changed they default port number of paper trading accounts as per: https://www.interactivebrokers.com/en/index.php?f=15912

Default production port: 7496 (as before)
Default paper trading port: 7497

The assigned default API ports for production and paper accounts are now different to allow both accounts to run at the same time. Production port is still 7496 and paper port is now 7497. These ports are automatically assigned when TWS is installed or reinstalled. Likewise, IB Gateway users will see the change of default ports for paper go from 4001 to 4002, leaving 4001 for the production version.

Hi. I have configured the following:

  1. My Database is configured to use IB Gateway 4001
  2. IB Gateway is configured to use port 4001
  3. When I start up IB Gateway, I log into the my PAPER account and it informs me that I am using a PAPER Account.

QUESTION: Why would I need to change my port to “match” the PAPER port (4002) to my PAPER login?

Please advise. Thanks

Because TWS developers decided so?


I thought this was going to be simple. In order to access the paper trade IB account

in IBController.ini, I changed




But no connection.

Only by resetting IB Gateway thus:

IBGateway > settings > socket port = 7496

could I get a connection.

Have I missed something?

Moderator comment: This is BAD advice. AmiBroker's IBController does NOT use IBController.ini file. There is no such file ever used.

I think you should contact Interactive Brokers as nobody here is able to fix errors inside TWS API / TWS / Gateway. These are written by IB.


I found this post using the forum's "search" function.

I've decided to stop using TWS and to start using IB Gateway instead. I notice that the port changes from 7496 to 4001, and that this should be configured in IBController.ini.

Where is this file? It is not in the AB directory where I installed BrokerIB.exe.

Also, the AT installation executable at1380beta.exe seems no longer to be available at IBController 1.3.8 READ ME.

Many thanks,

Another to fix the port issue is to set the port in IB Gateway Configuration -> API -> Settings to 7496, the same as that used for TWS.

IBcontroller.ini is NOT the file that AmiBroker's IBController ever uses. I don't know from where people took that but keep in mind that the advice given on forums is not always good. Apparently there are other softwares named "IBController" so if you google for information you might find something completely unrelated to AmiBroker's IBController.

Instead of manipulating some unknown files that don't work, use the GUI.

AmiBroker's IBController has the GUI. You can use File->Configure in IBController window menu

to bring up this dialog where you can easily define port:


Many thanksTomasz, that explains how to configure the value.
Howver, the port number is not persisted. When I close AB and IBC, and restart AB, the default value 7496 is still displayed in the Port Number text box.

That is not what I see here. It persists just fine. Make sure you change the value and close IBController on its own (File->Exit). Next time you run it will use changed value.
If not, you have having issues with Operating System (Windows Registry) - not having ACCESS RIGHTS to write to your HKEY_CURRENT_USER (which is rather impossible because it will break pretty much all programs) or your antivirus is going crazy.