portfolio icon indicating copy to clipboard operation
portfolio copied to clipboard

IB cfd import

Open MichaelSp opened this issue 5 years ago • 2 comments

Support for CFD trades from via "IB Activity Statement" Importer

There is a problem with the cost/netCash however: Since CFDs are traded with the help of the broker (x% your money, rest from the broker), it doesn't make sens to put the actual value of the underlying in your portfolio. It's not your money. If you sell this position you will not get this amount in your account.

In the IB statement the attribute netCash (which is currently used) only contains the fees. And that is the actual value that is withdrawn from your account. Eventually you'll have netCash - fee = 0 as amount in your portfolio. Rating the performance later based on 0 value could be... difficult :)

Other attributes are as follows:

 quantity = 3
 tradePrice = 409.75
 closePrice = 409.75
 commission = fee (-5.8)
 cost = quantity * tradePrice - commission (1235.05)
 netCash = commission                        (-5.8)
 tradeMoney = quantity * tradePrice        (1229.25)
 proceeds= -tradeMoney                    (-1229.25)

which attribute should be the amount? Any ideas?

https://forum.portfolio-performance.info/t/interactive-brokers/276/148

Related issues #1466 #1736 (it's about selling short, but based on CFD)

MichaelSp avatar Nov 23 '20 23:11 MichaelSp

To be honest, I haven't had the time to wrap my head around the short selling. PP assumes you invest X to purchase an asset and that it can make daily valuation of that asset.

My naive thinking is: For the transaction above, the fees (5.8) what you actually pay to purchase the asset (CFD). The daily valuation of your position would be something like currentPrice - tradePrice. PP does not support that (yet?)

How is InteractiveBrokers showing the valuation of your CFD? How is it showing the investment.

buchen avatar Nov 28 '20 09:11 buchen

I think "Valutation" is called "Net asset value"? (I'm not to familiar with all these financial terms)

In NAV you'll find basically these entries: image Stock, Cash and Dividend as absolute values But CFD only as difference: In Profit/Loss

I' try to find out how it's rated performance wise.

Meanwhile I found a bug in the import, which I'm gonna try to fix too: https://github.com/buchen/portfolio/blob/master/name.abuchen.portfolio/src/name/abuchen/portfolio/datatransfer/IBFlexStatementExtractor.java#L483-L487 Here the gross unit is added based on total` value.

And I have to think about this change here: https://github.com/buchen/portfolio/commit/d57af920da794667dd63bb29a8db272a71ee7c82 I was about to use cost instead of netCash...

MichaelSp avatar Nov 28 '20 21:11 MichaelSp