How to Import IBKR Trades Into the Wheel Tracker (Step-by-Step Flex Query Setup)

Published February 24, 2026 · 13 min read
#ibkr-import#wheel-tracker#interactive-brokers#options-trading-journal#flex-query

If you've been running the wheel strategy in Interactive Brokers, you don't need to enter trades manually one by one. The IBKR import feature in ThetaHarvester's Wheel Tracker reads a CSV export from your account, detects your wheel cycles automatically, and populates the tracker with full leg history and rolling cost basis.

This guide walks through the entire process from start to finish. Follow the steps exactly and you'll have your wheel history imported in under five minutes.

What You'll Need

  • An Interactive Brokers account with trade history
  • A ThetaHarvester Pro subscription (upgrade here)
  • A desktop browser (IBKR's portal works best on desktop)

The import uses IBKR's Flex Query system — a customizable report builder that lets you export trade data as CSV. A standard activity statement won't work. If you've never created a Flex Query before, don't worry — the steps below cover everything.


Part 1: Set Up the Flex Query in IBKR

You only need to do this once. After the query is saved, you can re-run it any time to export updated data.

Step 1: Log Into IBKR Account Management

Go to interactivebrokers.com and log into Client Portal (Account Management). This is the web portal — not TWS or the mobile app.

Step 2: Navigate to Flex Queries

From the main menu, go to:

Performance & Reports → Flex Queries

You'll see two sections: Activity Flex Queries and Trade Confirm Flex Queries. You want Activity Flex Queries.

Step 3: Create a New Flex Query

Click the + (Create) button next to Activity Flex Queries.

You'll land on the Flex Query configuration page. Start by giving your query a name at the top — something like "ThetaHarvester Export" so you can find it again later.

Step 4: Set the Date Range

Under the query options at the top, set the Period to cover your full wheel trading history.

  • If you started wheeling in January 2025, set the start date to January 1, 2025 or earlier.
  • You can use a preset like "Last 365 Days" or set a custom range.
  • When in doubt, go wider. Including extra history doesn't hurt — the parser only picks up trades it can match to wheel cycles.

Step 5: Enable the Trades Section

Below the general settings, you'll see a list of report sections (Trades, Cash Transactions, Open Positions, etc.). Each section has a clickable + or configure button.

Click on Trades to expand it.

Step 6: Select All Fields

Inside the Trades section configuration, you'll see a list of available columns/fields you can include in the export.

Select all of them. Check every box or use "Select All" if available.

You don't need to cherry-pick specific columns. The parser reads columns by name from the header row, so extra columns are harmlessly ignored. Selecting everything is the easiest approach and guarantees all the required fields are included.

If you prefer a minimal export, the required columns are: AssetClass, Symbol, UnderlyingSymbol, TradeDate, Quantity, TradePrice, Proceeds, IBCommission, Buy/Sell, Strike, Expiry, Put/Call, Multiplier, LevelOfDetail, and Notes/Codes. Including IBOrderID is also recommended — it lets the parser accurately detect and exclude multi-leg strategies (spreads, iron condors, etc.) so only your naked puts and covered calls create wheel cycles. But there's no advantage to excluding the rest — the file size difference is negligible.

Step 7: Set the Detail Level to "Order"

This is the one setting that matters. Inside the Trades section configuration, find the Level of Detail option.

Set it to Order.

Do not use Execution level only. Execution-level detail splits a single fill into multiple rows if your order was filled in pieces across different prices. This confuses the cycle detection because what was one trade looks like several. Order-level consolidates partial fills into one row per trade, which is what the parser expects.

If the option lets you include both Order and Execution rows, that's fine too — the parser filters for ORDER rows and ignores everything else.

Step 8: Set the Format to CSV

Make sure the output format is set to CSV. The parser does not support XML or other formats.

Step 9: Save the Flex Query

Click Save (or Continue then Save, depending on the portal version). Your query is now saved under Activity Flex Queries and can be re-run whenever you need a fresh export.

Step 10: Run the Query and Download the CSV

Back on the Flex Queries page, find your saved query and click Run (the arrow/play button).

IBKR generates the report — this usually takes a few seconds. Once it's ready, download the CSV file to your computer.

The file will be named something like U1234567_20250101_20260222.csv. The name doesn't matter — ThetaHarvester reads the contents, not the filename.


Part 2: Import Into ThetaHarvester

Step 1: Open the Wheel Tracker

Go to tharvester.com and navigate to the Wheel Tracker tab. You'll see an Import IBKR button in the top-right area, next to "+ New Cycle."

Step 2: Upload Your CSV

  1. Click Import IBKR — a modal opens.
  2. Click the file picker and select the CSV you just downloaded from IBKR.
  3. Click Preview Import.

The app uploads your CSV and parses every trade row. This is a preview only — nothing is saved to your account yet.

Step 3: Review the Preview

The preview screen shows three things:

Detected Cycles — each reconstructed wheel cycle displayed as a card. You'll see the ticker, current status (CSP Open, Holding, CC Open, Called Away, etc.), number of legs, and the calculated cost basis.

Warnings — trades that imported but with caveats. The most common one is "stock purchase without a preceding CSP." This happens when you bought shares directly (not through put assignment) and then sold covered calls. The import handles it correctly by creating a cycle starting in "Holding" status, but flags it so you can verify.

Unmatched Rows — trades the engine couldn't fit into any wheel cycle. Common reasons include:

  • Trades in asset classes other than stocks and options (forex, futures, bonds, etc.) — these are safely skipped.
  • Option trades that don't follow the wheel pattern (long calls, spreads, straddles).
  • Trades on tickers where the opening leg is missing from the date range.

Unmatched rows are not imported. They're shown for transparency so you can verify nothing important was missed.

Step 4: Verify the Data

Before confirming, take a minute to check:

  • Tickers — do they match what you've been wheeling?
  • Leg counts — a simple CSP that expired worthless is 2 legs (open + expired). A full wheel through assignment and covered calls will have more.
  • Cost basis — if you were assigned at $25 and collected a few dollars in premiums, cost basis should be in the low $20s, not $0 or negative.
  • Warnings — anything unexpected?

Step 5: Confirm the Import

Click Confirm Import. The cycles and all their legs are saved to the database. The modal closes and the Wheel Tracker refreshes with your imported history.

Your imported cycles appear alongside any manually created cycles in the Active, Completed, and Summary tabs. All summary metrics (total premiums, win rate, daily theta) update automatically to include the imported data.


How the Cycle Detection Works

You don't need to understand this to use the import, but it helps if the preview doesn't match your expectations.

The parser groups all trades by ticker, sorts them chronologically, and walks through them using a state machine that mirrors the wheel lifecycle. Before cycle detection, it filters out multi-leg strategies (spreads, iron condors, etc.) so only naked/cash-secured puts and covered calls are processed. If your CSV includes the IBOrderID column, the filter uses IBKR's own order grouping for accurate detection. Otherwise, it falls back to pairing same-day SELL + BUY legs with matching option type and expiration.

  1. Sell a put → new cycle starts in "CSP Open" status. The premium collected is recorded.

  2. Put expires worthless or is bought to close → cycle moves to "CSP Closed." Net premium is the difference between what you collected and what you paid to close (zero if it expired).

  3. Stock purchase while a CSP is open → assignment occurred. Cycle moves to "Holding." Cost basis = assignment price minus accumulated premiums per share.

  4. Sell a call while holding → covered call opened. Status becomes "CC Open." The call premium further reduces your cost basis.

  5. Call expires worthless or is bought to close → back to "Holding." If bought to close, the buyback cost is deducted from accumulated premiums.

  6. Stock sold while a CC is open → called away. Cycle is complete with full realized P&L.

  7. Stock sold while holding (no CC open) → manual exit. Cycle closes with whatever P&L resulted.

The engine handles multiple cycles per ticker. If you sold a CSP on SOFI, it expired, and you sold another CSP on SOFI a week later, those become two separate cycles.

How Rolls Are Handled

IBKR doesn't have a "roll" trade type in the CSV. A roll appears as two separate trades: a buy-to-close and a sell-to-open. The import captures both correctly as individual legs within the same cycle. They won't display as a single "ROLL" line like manually entered rolls do, but the cost basis math is identical.

If you prefer the cleaner roll display, you can delete the imported close + open legs and re-enter them as a single roll using "Add Leg → Roll." This is cosmetic only — the numbers stay the same.


What the Import Doesn't Cover

Dividends. The IBKR Trades section doesn't include dividend payments — those live in a different section of the activity statement. If you collected dividends while holding shares, add them manually using "Add Leg → Add Dividend" on the relevant cycle. Each dividend logged reduces your cost basis.

Duplicate detection. The importer automatically detects cycles that already exist in your tracker. Duplicates are flagged on the preview screen with a red "DUPLICATE" badge and are excluded from the import. This means you can safely re-import a CSV that overlaps with a previous import without creating duplicate cycles. Matching is based on ticker, opening leg type, trade date, strike, and expiration.

Non-wheel trades. Multi-leg strategies (vertical spreads, iron condors, butterflies, etc.) are automatically detected and excluded before cycle detection. They appear in the warnings list on the preview screen. Long calls, straddles, and other non-wheel trades that slip through detection show up in the unmatched count. None of these are imported.


Troubleshooting

"Could not find header row"

The parser looks for a header row that starts with "AssetClass." This means either:

  • You uploaded a standard activity statement instead of a Flex Query export. Go back to Part 1 and create a Flex Query.
  • The Trades section wasn't enabled in your Flex Query. Edit the query in IBKR and make sure Trades is checked.

"Missing required columns"

The error message tells you exactly which columns are missing. Edit your Flex Query in IBKR, expand the Trades section, and make sure all the listed columns are selected. The simplest fix is to select all columns.

"No cycles detected"

The parser found the header but no trade rows matched. Most likely cause: the Level of Detail is set to something other than Order. Edit your Flex Query and set the Trades detail level to Order.

Cycles are missing legs

Your date range probably doesn't cover the full history. If a CSP was opened in November but your export starts in December, the parser can't see the opening trade and can't construct the cycle. Extend the date range in your Flex Query and re-export.

Cost basis looks wrong

Usually caused by a missing leg — the opening CSP premium wasn't included because of a date range issue. The import calculates cost basis using only the trades present in the CSV. Extend the export date range and re-import.

Warning: "stock purchase without a preceding CSP"

This is expected if you bought shares directly (market/limit order, not through put assignment) and then sold covered calls. The import creates a "Holding" cycle and flags it. The cycle tracks normally from that point — it just didn't start with a cash-secured put.

Unmatched rows for forex, futures, or bonds

If you trade other asset classes besides stocks and options, those trades show up as unmatched with a reason like "Unsupported asset class: CASH" or "Unsupported asset class: FUT." This is normal — the wheel tracker only processes equity and equity option trades. These rows are safely ignored.

Duplicate cycles after re-importing

The importer automatically detects and skips cycles that already exist. If you re-import a CSV covering the same period, the preview screen flags existing cycles as "DUPLICATE" and excludes them from the import. You don't need to worry about overlapping date ranges.


Keeping the Tracker Up to Date After Import

Once you've done the initial import, you have two options going forward:

Option A: Manual entry. Use the tracker's "Add Leg" workflow for new trades. This gives you the cleanest display — rolls show as single lines, dividends are logged as they're paid, and you have full control over each entry.

Option B: Periodic re-import. Run your saved Flex Query again with a date range covering the new period, and import the fresh CSV. The importer automatically detects and skips cycles that already exist, so overlapping date ranges are handled safely.

Most users do the bulk import once to backfill history, then switch to manual entry for new trades. Adding a leg takes about 10 seconds and gives you better control over how rolls and dividends are displayed.


Get Started

The IBKR import is available to all ThetaHarvester Pro subscribers. Set up your Flex Query once, download the CSV, and have your entire wheel history in the tracker in under five minutes.

If you're new to the Wheel Tracker, start with our guide on how the Wheel Tracker works — it covers everything from starting your first cycle to reading the analytics dashboard.

Free users can explore ThetaHarvester's grading and analysis tools with demo tickers (AAPL, SPY, TSLA, NVDA, QQQ, MSFT). The Wheel Tracker and IBKR import are Pro features.