P&L report not showing all positions #601
Replies: 1 comment 3 replies
-
Could be many reasons? Have you tried debugging to find out? (Apart from IRON these are all Asian markets... could be useful to know?) Here is what I would do: Looking at sysproduction/reporting/pandl_report.py it calls quite a few functions in the reporting API:
It looks like this bad boy is the one we want: In sysproduction.reporting.api:
So we actually get the data from
This is just a cacheing function here is where it comes from:
OK how do we get a pandl_calculator?
We need to go to another file now, sysproduction/reporting/data/pandl.py Note I'm doing all this in pycharm by just doing right click / go to / declaration. I'm sure you IDE has a similar function. This is the method we wanted (remember from earlier
Notice that zero p&l are filtered out: this is important for later. Stepping into
To delve deeper would involve getting into the weeds of my mongo API, and I'm hoping any problem isn't there. We have enough information to start doing some testing. We can perform the same exercise (going from top to bottom), but in code. At a python prompt:
It is instructive to compare this with my current list of held positions:
OK so KR10 is missing from the p&l list. An Asian market!. There are also extra items, but they are probably things I've closed since yesterday. Let's step into the code
So this actually includes all instruments I have ever held a position in.
Now this list is subsequently filtered to remove zeros (line #89). PandL(code='KR10', pandl=0.0 So if an instrument will be missing if it has never had a position (unlikely!), the position records are wrong (also unlikely) or the p&l is zero. The cause of the p&l being zero could be because the price hasn't changed, or because we had no position on.
OK there is the problem. I'm running this code at 0930 on the 27th April. Since 0930 yesterday, and today, the price hasn't been updated. To be 100% confident this was the problem I could run a p&l report with a 2 day, not 1 day, window. If that still broke, it could be something more serious. But let's assume it is the problem. Quick way to check if a price has been updated.
I could trawl through log files to see why, but it makes perfect sense to have a delay updating Asian prices, since when my price update ran on the 26th the last price available was 7am. I can check there are no serious issues:
All good. If I rerun my pandl code I should now see KR10:
Now KR10 is in the list. |
Beta Was this translation helpful? Give feedback.
-
Hi
Hope you all are well!!
I noticed my
P&L report
did not list all of the positions that exist in the system. Compared to theReconcile report
there are 5 instruments that is both with the broker and in the db, but that is not listed in the P&L report.The thought about missing / delayed data crossed my mind. All but one of the missing instruments figure in the
Status Report
under theDelayed adjusted / FX prices
section. So I guess that isn't the explanaition eitherOverview of instruments missing from the P&L:
None of the missing instruments are new - VNKI was on the
Trade Report
but the position was only further reduced, not opened.Anyone know of the reason why instruments are included in the P&L, please let me now!
Beta Was this translation helpful? Give feedback.
All reactions