Plpc in postion

I just realised that the portfolio position plpc : profit loss percent does not actually reflect percent. Its off by two decimal points, see example below. Is this right?

Position({ ‘asset_class’: ‘us_equity’,
‘asset_id’: ‘f9d55f85-5125-43a6-8cb6-7c8b3c49bbc4’,
‘avg_entry_price’: ‘86.2133333333333333’,
‘change_today’: ‘-0.0229261269243549’,
‘cost_basis’: ‘1034.56’,
‘current_price’: ‘88.22’,
‘exchange’: ‘NYSE’,
‘lastday_price’: ‘90.29’,
‘market_value’: ‘1058.64’,
‘qty’: ‘12’,
‘side’: ‘long’,
‘symbol’: ‘XPO’,
‘unrealized_intraday_pl’: ‘-24.84’,
‘unrealized_intraday_plpc’: ‘-0.0229261269243549’,
‘unrealized_pl’: ‘24.08’,
‘unrealized_plpc’: ‘0.0232755954222085’}

i feel your pain i was just dealing with something like that…

keep your eye on what you code and look at the docs

1 Like

you know what also hit me about it, in emulation i was accounting for the data correctly but in paper it was still using a cash value…

Well I hope this is fixed, may be it does not represent what I thought it did. I went by the following formula,
int(qty)/abs(int(qty))*(float(market_value)/float(cost_basis)-1)*100.
The fist part is just to change the sign for a short position.