The TWS API is the application programming interface provided by Interactive Brokers that allows a client's own software to communicate with the broker's Trader Workstation or its lighter, screen-free counterpart, IB Gateway. Programs connect to the running application over a local network socket and can then place, modify and cancel orders, request real-time and historical market data, and retrieve positions, balances and executions. Interactive Brokers publishes the client libraries, with their source code, for languages including Python, Java, C++ and C#.
The API is widely used by individual traders, small funds and developers to build algorithmic trading systems, custom dashboards and risk tools without writing their own exchange connections. Because it works through TWS or IB Gateway, that program must be running and logged in. Interactive Brokers also offers a web-based REST interface and a connection over the FIX protocol for institutional users.