Broker guides / Interactive Brokers

How to build an IBKR Flex Query that shows option assignments

The default Flex Query hides the events that matter. Two sections have to be switched on or an assigned put arrives as a closing buy at a price of zero.

The steps

step 1
In Client Portal go to Performance & Reports, then Flex Queries, and create an Activity Flex Query.
step 2
Add the Trades section. Include at least: symbol, description, assetCategory, tradeDate, quantity, tradePrice, proceeds, ibCommission, orderID, tradeID, putCall, strike, expiry, multiplier, underlyingSymbol.
step 3
Add the Option Exercises, Assignments and Expirations section. Without it, a resolved position is only visible as a mirror trade at zero.
step 4
Alternatively add the Statement of Funds section, which carries the same events as activity codes and an ADJ line for index settlement. FillStub reads either shape.
step 5
Set Format to XML and Period to the range you want, then run it and download.

What you get, and what it means

what you get
<Trade assetCategory="OPT"   symbol="XSP 181205P00288000"
  transactionType="BookTrade"   tradePrice=0
  quantity="1"   proceeds="0" />

<OptionEAE transactionType="Assignment"
  symbol="XSP 181205P00288000"   quantity="1" />
what it means
one assignment of 1 contract
the BookTrade at price 0 is its mirror, and is dropped
the shares it delivered become a lot, not an option row

booked as a trade, this reads as a closing buy at zero

Traps in this file

A BookTrade at price zero is not a trade

It is the position leg of an exercise or an assignment. FillStub drops it once the real event is present, so nothing is counted twice.

An EXE or ASSIGN code also appears on the delivered instrument

The shares, or the future. Those become share lots, not option resolutions, and the difference decides which tax form the result lands on.

Index settlement money may sit on a separate ADJ line

If your query omits the column that carries it, FillStub says so rather than reporting the position as flat: an index option only settles when it is in the money.

Futures options are Section 1256, not Form 8949

They are flagged rather than silently filed with your equity trades.

Both Flex shapes are supported: Trades plus OptionEAE, and Statement of Funds. A token for the Flex Web Service is generated by you in Client Portal and can be restricted by IP, so automatic refresh needs no partner programme.

Drop your Interactive Brokers file