Skip to main content

6. Connect Xerolite to IB TWS

Once TWS/IB Gateway is configured for API access, you can connect XeroLite to Interactive Brokers. This section guides you through establishing the connection.

Prerequisites

6.1: Ensure TWS Is Running

  1. Launch TWS or IB Gateway:
    • Open Trader Workstation or IB Gateway
    • Log in with your Interactive Brokers credentials
    • Ensure you're connected to IB servers (check connection status)
  2. Verify API Settings:
    • Confirm API access is enabled (port 7497)
    • Ensure TWS/IB Gateway is not in read-only mode
  3. Keep TWS Running:
    • TWS/IB Gateway must remain running while XeroLite is active
    • Do not close TWS/IB Gateway during trading operations

6.2: Verify Broker Connection

  1. Log in to XeroLite:
    • Open your web browser
    • Navigate to your XeroLite Cloud Edition URL
    • Log in with your XeroLite credentials
  2. Verify Connection Status:
    • Look for a green status indicator or "Connected" message
    • The Broker Health indicator should display as connected
    • Account information should appear if connection is successful

Connection Status Indicators

  • Green/Connected: Successfully connected to IB
  • Red/Disconnected: Connection failed or TWS is not running

Automatic Connection

Once properly configured, XeroLite will automatically connect to TWS/IB Gateway when:

  • Both XeroLite and TWS/IB Gateway are running
  • API settings are correctly configured
  • Connection parameters are saved

Troubleshooting

Connection Failed

  • Verify TWS is Running: Ensure TWS/IB Gateway is launched and logged in
  • Check Port: Confirm the port in XeroLite matches TWS API settings (7497)
  • Restart Both: Try restarting both TWS and XeroLite

API Settings Not Saving

  • Restart TWS: Restart TWS/IB Gateway after changing API settings
  • Check Permissions: Ensure you have write permissions for TWS configuration
  • Verify Settings: Go back to API settings and confirm they persisted

Next Steps

After successfully connecting, proceed to: