jamsix / ib-edavki

Skripta, ki prevede XML poročilo trgovalnih poslov v platformi InteractiveBrokers v XML format primeren za uvoz v obrazce Doh-KDVP, D-IFI, Doh-Div in Doh-Obr v eDavkih Finančne uprave.
MIT License
183 stars 59 forks source link

Cancelled trades #55

Closed pronebird closed 2 years ago

pronebird commented 2 years ago

Hi,

I noticed that some trades in the XML outputs are marked with notes = "Ca.", buy_sell = "BUY (Ca.)" or SELL (Ca.). I wonder what are those and if we handle them properly?

<Trade accountId="XXXX" acctAlias="" model="" currency="USD" fxRateToBase="1" assetCategory="STK" symbol="COFF" description="WT COFFEE" conid="41015904" securityID="GB00B15KXP72" securityIDType="ISIN" cusip="" isin="GB00B15KXP72" listingExchange="LSE" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" strike="" expiry="" tradeID="" putCall="" reportDate="20210830" principalAdjustFactor="" dateTime="20210827;104920" tradeDate="20210827" settleDateTarget="" transactionType="TradeCancel" exchange="--" quantity="-XXXX" tradePrice="1.175" tradeMoney="-XXXX" proceeds="XXXX" taxes="0" ibCommission="0" ibCommissionCurrency="USD" netCash="XXXX" closePrice="1.1655" openCloseIndicator="" notes="Ca" cost="-XXXX" fifoPnlRealized="0" fxPnl="0" mtmPnl="47.5" origTradePrice="1.175" origTradeDate="20210827" origTradeID="38891264" origOrderID="33259243" clearingFirmID="" transactionID="112639667" buySell="BUY (Ca.)" ibOrderID="33259243" ibExecID="" brokerageOrderID="" orderReference="" volatilityOrderLink="" exchOrderId="N/A" extExecID="N/A" orderTime="" openDateTime="" holdingPeriodDateTime="" whenRealized="" whenReopened="" levelOfDetail="EXECUTION" changeInPrice="0" changeInQuantity="0" orderType="LMT" traderID="" isAPIOrder="N" accruedInt="0" serialNumber="" deliveryType="" commodityType="" fineness="0.0" weight="0.0 ()"/>

I found that "Ca." means cancelled from https://guides.interactivebrokers.com/rg/reportguide/codes_default.htm

pronebird commented 2 years ago

Closing because there are no lots for cancelled trades, I assume they are discarded either way.