FolioCast
New
Play the sample

Setup guide

Connect IBKR to FolioCast

Step by step: create a Flex report and a read-only token in Interactive Brokers, then enter them on the FolioCast setup page and connect @FolioCastBot in Telegram.

What you need

  • About 5 minutes.
  • Your login for IBKR Client Portal.
  • A FolioCast subscription: the FolioCast setup page opens right after checkout.

Why this is needed: FolioCast makes your morning episode from your IBKR report. The Flex Query decides what goes into the report, and the token lets FolioCast fetch it.

Is it safe?

  • The token can only read reports. It cannot trade or move money.
  • FolioCast checks the token once with IBKR, then stores it encrypted and uses it only to fetch your reports.
  • You can revoke the token in IBKR at any time.

Faster: create the report with AI in IBKR

IBKR can build the Flex report from a short text. You still check the result and create the token by hand. If something does not work, use the manual steps below.

  1. In IBKR Client Portal open Performance & Reports → Flex Queries and click Configure with AI.

  2. Paste this ready text. The Copy button puts it on your clipboard.

    Create an Activity Flex Query named foliocast. Period: Last Business Day. Output format: XML. Include these sections: Account Information; Change in NAV; Mark-to-Market Performance Summary in Base; Open Positions with Level of Detail Summary; Trades with Level of Detail Executions; Cash Transactions; Cash Report; Financial Instrument Information. Select all fields in each section.
  3. Click Generate Flex Query and look through the result.

  4. Click Edit Manually and check:

    • Name: foliocast.
    • All sections from the list in Part 1 are there: Account Information, Change in NAV, Mark-to-Market Performance Summary in Base, Open Positions (Level of Detail: Summary), Trades (Level of Detail: Executions), Cash Transactions, Cash Report, Financial Instrument Information.
    • Delivery Configuration: Format XML.
    • Period Last Business Day.

    IBKR warns that the AI result may be incomplete, so this check is required. The name, XML and the period are sometimes not applied — then set them by hand.

  5. Click Save Query.

  6. Open the info icon next to the query and copy its Query ID. Then go to Part 2.

AI does not switch on Flex Web Service and does not create the token: always do Part 2 by hand.

Official IBKR guide

Part 1. Create the Flex report by hand

The manual way, if you did not use AI or something went wrong. If the report is already saved, go to Part 2.

  1. Sign in to IBKR Client Portal.

  2. Open Performance & Reports → Flex Queries.

  3. Click + next to Activity Flex Query.

  4. Name the query foliocast.

  5. Tick each section from the list below and choose Select All fields in it. Account ID and name may stay unticked.

    Sections and fields FolioCast reads
    • Change in NAV: Starting Value, Ending Value, Deposits/Withdrawals, Mark-to-Market, Realized, Dividends, Withholding Tax, Commissions
    • Mark-to-Market Performance Summary in Base: Symbol, Description, Asset Class, Prior Open MTM, Transaction MTM, Total
    • Open Positions (Level of Detail: Summary): Symbol, Description, Conid, Asset Class, Underlying Symbol, Quantity, Put/Call, Strike, Expiry, Cost Basis Money, FIFO Unrealized P/L, FX Rate To Base
    • Trades (Executions): IB Commission, FIFO Realized P/L, FX Rate To Base
    • Cash Transactions: Type, Amount, Currency, FX Rate To Base
    • Cash Report: Currency, Ending Cash, Dividends, Withholding Tax
    • Financial Instrument Information: Conid, Underlying Symbol, Expiry, Put/Call, Strike
    • Account Information: Currency
  6. In Delivery, choose Format XML.

  7. Choose Period Last Business Day.

  8. Click Save.

  9. Open the info icon next to the query and copy its Query ID.

Part 2. Create the token

  1. Open Performance & Reports → Flex Queries → Flex Web Service Configuration.

  2. Switch on Flex Web Service Status and click Save.

  3. Click Generate A New Token. The validity can be from 6 hours to 1 year; we suggest 1 year, with no IP restriction.

  4. Copy the token. Do not share it with anyone else.

Official IBKR guide

Part 3. Enter them in FolioCast and connect @FolioCastBot

  1. Open the FolioCast setup page. It opens right after checkout.

  2. In step 01, paste the token and the Query ID, choose the episode language and press Check with IBKR and save.

  3. In step 02, press Get my Telegram link, open the link and press Start in the chat with @FolioCastBot. The link works once, for one hour.

  4. If you like, press Send my first episode now in step 03. After that, a new episode arrives after every US trading day, around 05:00 UTC.

You do not send the token or the Query ID in the Telegram chat: they are entered only on the setup page or in your account.

To replace the token later, send /account to @FolioCastBot, open the one-time link, enter the new token and your Query ID and press Check with IBKR and save.

If something goes wrong

  • “IBKR rejected the token.” Copy it again from Flex Web Service Configuration, or generate a new one.
  • “IBKR does not know this Query ID for this token.” Check the number next to your Activity Flex Query and copy it again.
  • “This token is limited to certain IP addresses.” Generate a new token without an IP restriction.
  • “Flex Web Service is switched off or the token has expired.” Switch it on and generate a new token.
  • The bot says your token has expired or is invalid. Generate a new token in IBKR, then send /account to the bot, open the one-time link and press Check with IBKR and save with the new token and your Query ID. Your subscription stays as it is.
  • You generated a new token. A new token cancels the old one. Update it in FolioCast: send /account to the bot, open the one-time link and press Check with IBKR and save with the new token and your Query ID.
  • IBKR is busy or does not answer. Nothing is saved until the check passes. Wait a few minutes and try again.
  • No episode on Sunday. Episodes arrive after US trading days. On Monday the episode covers Friday’s close and the week ahead. If IBKR prepares the report late, FolioCast tries again later the same morning.
  • Still stuck? Write to [email protected].