How to Rebalance Your Interactive Brokers Portfolio: File, Flex Token or AI Assistant
Three ways to bring your IBKR positions into the free Portfolio Rebalancer — a statement file, a Flex token, or your AI assistant — and exactly what each one shares with us.
The RetireCrunch Portfolio Rebalancer works out the exact buy and sell trades that take your portfolio back to the mix you chose. Typing in every position by hand gets old quickly, so if your account is at Interactive Brokers you can now import it. There are three ways to do it. None of them needs an account with us, and none of them ever gives RetireCrunch your IBKR login or the ability to trade.
The short version
A statement file is the most private: it never leaves your browser. A Flex token is the most convenient for regular use. Your AI assistant gives you live positions and can hand the finished plan back to IBKR as order instructions you confirm yourself. All three end in the same preview, and nothing changes until you press Import.
| Route | Flex statement file | Flex token | AI assistant (MCP) |
|---|---|---|---|
| Set-up | Create a Flex Query once, download the XML | Flex Query + a token in IBKR | Connect the IBKR and RetireCrunch connectors |
| Freshness | Previous close | Previous close, on demand | Live |
| What reaches our server | Nothing | Your token, for one request, then discarded | Your positions, encrypted with a key we never receive, for at most 15 minutes |
| Best for | Maximum privacy | Regular rebalancing | Live data, and sending the plan back to IBKR |
First: one Flex Query (for the file and the token)
The file and the token both read an IBKR Flex Query — a statement you define once in Client Portal. Set it up like this:
Open Flex Queries
In IBKR Client Portal go to Performance & Reports → Flex Queries and create an Activity Flex Query.
Choose the sections
Tick Open Positions (with both Summary and Lot), Cash Report (with the currency breakdown) and, if you hold more than one currency, Conversion Rates.
Format and period
Choose XML and the period Last Business Day, then save. Note the Query ID IBKR shows next to it.
Why tick Lot
With lot detail, every sell in your trade ticket can show which of your lots it would close under FIFO (IBKR's default), with each lot's gain or loss and whether you've held it for more than a year. It's information, not a tax estimate.
Option 1: upload the statement file
This is the most private route: the file is read in your browser and never uploaded. Nothing about it reaches our server.
Run the query
In Flex Queries, run your query and download the XML.
Import
In the Rebalancer choose Import → Import from Interactive Brokers, then Flex statement file, and pick the file.
Review
Check the preview — new, updated and missing positions, and whether positions plus cash add up — then press Import.
Option 2: fetch it with a Flex token
Instead of downloading the file every time, let RetireCrunch fetch it for you. IBKR's servers don't accept requests straight from a web page, so the request passes through our server: your token is used for that one request and then discarded — it isn't stored in your browser or on our server, and it never appears in our logs. You enter it each time.
Create a token
In Flex Queries → Flex Web Service Configuration, enable the service and generate a token. Choose a short validity.
Lock it to our IP
Restrict the token to RetireCrunch's IP address, 34.65.245.66. A token copied by anyone else is then useless.
Fetch
In the import dialog choose Flex token, enter the token and your Query ID, and press Fetch statement.
A token is read-only — but still treat it like a password
A Flex token can read your statements, not trade. Locking it to our IP and giving it a short life keeps the damage of a leak close to zero. You can revoke it in IBKR at any time by generating a new one.
Option 3: let your AI assistant do it
Interactive Brokers offers a connector that lets AI assistants such as Claude or ChatGPT read your positions, on your behalf and with your permission. RetireCrunch has one too: its calculators, including the Rebalancer, are available as Model Context Protocol (MCP) tools at https://mcp.retirecrunch.com/mcp. Connect both, and your assistant can move your live portfolio from one to the other.
You authorise IBKR's connector with IBKR itself; RetireCrunch never sees that authorisation. The RetireCrunch connector needs no login at all.
Connect both
In your assistant's connector settings, add Interactive Brokers, then add a custom connector named RetireCrunch with the URL https://mcp.retirecrunch.com/mcp.
Ask
Say something like: “Get my IBKR positions, balances and account summary, and load them into RetireCrunch.”
Open the link
Your assistant replies with a private link to the Rebalancer. Open it within 15 minutes; the same preview appears, ready to import.
Your assistant retypes IBKR's numbers when it hands them over, so RetireCrunch checks them: positions plus cash must match the net liquidation value IBKR reports. If a figure was garbled on the way, you'll see a warning in the reply and in the preview, rather than a silently wrong portfolio.
No login: how the link keeps your portfolio private
A service without accounts still has to get your positions from your assistant to your browser. RetireCrunch does it with a link that is its own key:
Encrypted with a fresh key
The RetireCrunch connector encrypts your positions with a new random key that exists for this one handoff only.
Only the ciphertext is kept
Our server stores the encrypted copy — which it cannot read — for at most 15 minutes.
The key lives in the link
It sits in the part of the link after the # sign. Browsers never send that part to any server, so it doesn't reach ours, our logs or analytics; the page removes it from the address bar the moment it loads.
Opened once, then deleted
Opening the link fetches the encrypted copy and deletes it in the same step. Your browser decrypts it locally. A second open finds nothing.
- What we never get: your IBKR username or password, your IBKR authorisation, or any ability to trade.
- What we hold, briefly: an encrypted copy we cannot read, for at most 15 minutes, gone as soon as you open the link.
- What stays on your device: the imported portfolio, your targets and your plan — in your browser's storage, as always.
- What your AI provider sees: your positions pass through your assistant's conversation, so its own privacy terms apply to them — just as they do to anything else you ask it.
The link is the key — don't share it
Anyone who has the link before you open it can open it once. Treat it like a one-time password: open it yourself, soon. If a link has expired or was already used, just ask your assistant for a new one.
It's a deliberate trade-off. An account would let us keep your portfolio between visits, but it would also mean an email address, a password and a database of portfolios to protect. A one-time encrypted link gives you the convenience of the assistant without any of that.
Getting your trades back to IBKR
Once you've set your targets, the trade ticket lists the exact buys and sells. RetireCrunch never places an order. You have two ways to act on the plan:
- TWS basket: Export → Download TWS basket (CSV), then import it in Trader Workstation's BasketTrader, review the orders and transmit them yourself.
- Through your assistant: Export → Send plan to my AI gives you a one-time code (the same 15-minute, single-use encryption). Paste it into the chat; your assistant fetches the trades and creates IBKR order instructions, which you review and submit — or reject — inside IBKR.
Import your IBKR portfolio and see the trades back to your target mix.
Open the Rebalancer →Key takeaways
- Three routes, one preview: a file that never leaves your browser, a token used once, or your AI assistant with live data.
- No account, no IBKR login: RetireCrunch never receives your credentials and can't trade.
- The assistant route is private by design: an encrypted copy we can't read, for at most 15 minutes, opened once with a link that is its own key.
- You stay in control of every order: trades go back as a TWS basket or as IBKR order instructions you confirm yourself.
The Rebalancer is a planning tool: you choose the targets, it does the arithmetic. It isn't investment or tax advice — check the trades against your own situation before placing them.
Set up the RetireCrunch connector in your AI assistant.
Connector setup →