Open spickering-git opened 7 years ago
Lets just make a comparison using the positions from accounts_positions_archive
I have a thought to make series converge in different way. Currently I pick campaign series to calculate campaign reports, but probably if I calculate account report's model series based on accounts_positions_archive it could reflect model path more precisely disregarding of campaign composition changes. Also at some moment in the future we would like to add money management for each account, and there is no way to reproduce account's model path using current campaign reports.
Only downside of this method, that real account PnL paths could diverge with campaigns' paths published on the web site for example. We could negate that using 'begin' and 'end' settings, but some minor discrepancies could occur.
https://10.0.1.2:8888/notebooks/tools/All_Production_Campaign_Settlements-Email_template-WedbushAccts-ArchiveBased.ipynb# I've finished archive base accounts reports.
Now it looks better but still not 100% equal: ES
ZN
There a few syntax changes to make it work:
The archive based report compared to the model based report. comparing archive based `crc = CampaignRealCompare() archive_based_pnl = crc.get_account_positions_archive_pnl(account_name="CLX60125", instrument="ES",
#costs_per_option=3.0 # Default
)
crc.run_compare_report(archive_based_pnl, # !!! <- archive_based_pnl here num_days_back = 9,office='CLX',account='60125')`
model based 'crc = CampaignRealCompare() crc.run_compare_report(rpt.campaign_stats,num_days_back = num_of_days_back_master,office='CLX',account='60125')'
The positions in the archive and the model should be the same over the last 10 days. Is the p/l from the archived positions using settlements? This divergence goes on with all of the accounts.
Is the p/l from the archived positions using settlements?
Correct.
I believe this divergence is the result of execution/slippage effects. I noticed that real account had executions even when there were no trades for the model. I guess that this is a cumulative effect of execution could produce such divergences.
but there isn't as much of a divergence from the model and the real account as there is with the archived position and the real account.
We would expect the model and the archived position for the last week to be basically the same
Fixed.
It was a very tough bug, because I used generic PnL calculations which are also used in EXO processing, and still can't understand why is the difference between reports is so huge. I ported old report code to the archive based report and they seems converged.
I wanted to note that new archive based model report seems to show more optimistic results than old one, because due to position netting it subtract less costs. Without the costs both reports are identical.
Here are 60 days based reports:
Old version:
New archive based report:
10 days report Old version:
New version:
problem occured where alpha was marked with end date but should have been begin date https://github.com/trendmanagement/tmqrexo_alexveden/issues/181
this has caused ES_Bidirection V3 to diverge from real account.
For our comparisons, example: https://10.0.1.2:8888/notebooks/tools/All_Production_Campaign_Settlements-Email_template-WedbushAccts.ipynb Can we use the positions from accounts_positions_archive for a few of the days where we have diverged from model and evaluate p/l. Then go back to the model positions after this window.
@alexveden what do you think?