Closed ajdore closed 3 years ago
Thanks for asking - the IB api call is eClientSocket.eDisconnect.
You can also check out the delete function in the +TWS/Session.m src file. This function cleans up all listeners and closes the TWS connection. This function also gets called automatically if session obj goes out of scope (eg clear sess or clear all)
thank you!
Sorry for the very basic question but I didn't see it in the docs/examples. How do you close an open session?
For example, I've set up an open connection to pull data on a live account:
session.eClientSocket.eConnect('127.0.0.1',7496,0);
Now, close the live account connection above, and connect to the paper trading account to trade
session.eClientSocket.eConnect('127.0.0.2',7497,0);
Both paper and live accounts are open on TWS concurrently and the sockets etc have been configured accordingly in each account.