Automate Interactive Brokers with IB Gateway, no code
Words on this page
- IB Gateway
- A small program from Interactive Brokers (IB) that you install and log in to. Programs talk to Interactive Brokers through it instead of through the website.
- Paper trading account
- Interactive Brokers' practice account: pretend money, real prices, and its own separate username. You switch it on in the Client Portal settings.
- Tailscale
- A free program that joins computers into a small private network. Your bot uses it to reach IB Gateway on your computer and nothing else.
- Trusted IP addresses
- The list in IB Gateway of the only addresses allowed to connect (IP stands for internet protocol: an address on a network). You add your bot's address there, and nobody else's.
- API
- Application programming interface: the door a program uses instead of the screens a person uses.
How the connection works
Interactive Brokers doesn't hand out a simple key. Instead you run IB Gateway on a computer of yours that stays on - a desktop, not a laptop that goes to sleep - and log in to it there. Your bot then sends its orders to IB Gateway, and IB Gateway passes them to Interactive Brokers.
Your bot runs on BasisPoint's server, so it needs a private way to reach your computer. That is Tailscale: you install it, paste a one-line joining command from your bot's Brokers page, and your computer joins BasisPoint's private network. Only your bot can reach it, only on IB Gateway's ports, and your computer can reach nothing of ours.
Your Interactive Brokers username and password are typed into IB Gateway on your own computer. They never travel to the bot, and BasisPoint never sees them - see connecting a broker safely.
Setting it up, in order
Your bot's Settings > Brokers page shows each step with the exact menu names. In short:
- Open an Interactive Brokers account, then switch on the paper trading account in the Client Portal settings. Practise with that one first.
- Install IB Gateway (the stable version), choose the paper trading mode on its login screen and log in.
- In IB Gateway's settings, allow orders (untick Read-Only API) and turn on Auto restart, so you log in about once a week instead of every day.
- Install Tailscale, press Get my joining key on your bot's Brokers page and run the command it shows. The page says when your computer is linked.
- Add the BasisPoint address shown on that page to IB Gateway's trusted addresses, then press Test the connection in your bot.
What happens when IB Gateway is away
IB Gateway restarts about once a day and asks for your login about once a week. While it is away, or your computer is off, the bot waits: it places no orders meanwhile, tells you once, and reconnects by itself when you log in again. It never guesses what happened in between.
What Interactive Brokers adds
Interactive Brokers trades on exchanges in America, Europe and many other countries, and holds several currencies in one account. That suits a mix spread across markets - see markets and currencies.
It charges a fee per trade, with a minimum. The practice account in your bot charges the same fees, so what you watch in practice already includes them.
Practise first, then decide about real money
Every bot starts on simulated trading with real prices, and the paper trading account lets you watch real orders with pretend money. Real money needs IB Gateway in its live mode, a short agreement you sign inside your bot and limits you set yourself. Real money opens once BasisPoint's company is registered, and you can pause or go back to practice at any time.
Questions
Does BasisPoint ever see my Interactive Brokers login?
No. You type it into IB Gateway on your own computer, and it stays there.
Does my computer have to stay on?
Yes, while you want the bot to trade. If it is off or asleep, the bot waits, tells you once, and carries on when IB Gateway is back.
Can the bot reach anything else on my computer?
No. Over the private network it can reach only IB Gateway's ports, and only your bot can reach your computer at all.
Do I need to write any code?
No. The bot is set up from your answers in the blueprint, and the connection is the steps above, each shown on your bot's Brokers page.
Education only: not investment advice and not a recommendation to buy or sell anything. Facts about BasisPoint checked on November 21, 2026.
