I don't use that myself, so I can't be certain.? But if I sold a put and held to expiry (and I get put the shares), in my transactions I see two transactions... Buy the put @ $0, that one I could see not showing up as a trade, but the other is to buy 100 shares at the strike.? That one should show up under trades.? It's been a while, but there was I think client ID 0 or 1 that included trades through TWS.? That may nbe the issue si ce the trade wasn't initiated via the API, so maybe try checking client ID 0 or 1 for transactions.
toggle quoted message
Show quoted text
-------- Original message --------
From: "jackroc97 via groups.io" <jackroc97@...>
Date: 2024-11-22 8:16 a.m. (GMT-08:00)
Subject: Re: [ib-async] How to watch for option assignment/settlement?
Thanks for the reply Mel. Would this show up as a trade? In my mind its not a “trade” since it is an action taken by the broker (as opposed to the account owner), but I could be wrong. The TWS api docs do not provide much if any information about this.?
In my particular use case I am trying to automate an ES options strategy, so when a (hopefully profitable) option position is held to expiration, it would be settled as cash to the account. I am trying to detect settlement programmatically for logging purposes. ?In my experience thus far, none of the trade callback methods I provide when opening the position are called if the option is held to expiration.?
From the ib_async docs I see a few global events that seem promising for capturing this. Namely updatePortfolioEvent, positionEvent, accountValueEvent.?