Difference between P&L on Console and in Trading Report

aj165602aj165602 Posts: 105

Good morning.

I'm getting different values for the Total MTM PL reported on the console at the end of running the script, and the same value reported in the downloaded Trading Report. The figure is usually lower in the Trading Report.

Should these numbers be different, and if so, which is the most reliable?

Thanks,
Antony

Tagged:

Comments

  • ms778834ms778834 Posts: 28
    edited May 2017

    Good evening (from Czechia), Antony!
    What is your self.useTradeFileForPnL setting?
    Is it self.useTradeFileForPnL = kwargs.get('useTradeFileForPnL',False), or self.useTradeFileForPnL = kwargs.get('useTradeFileForPnL', True)?

  • aj165602aj165602 Posts: 105

    Thanks! I've hunted high and low, and I just can't find this referenced anywhere. Could you point me to where it is in the documentation, please?

    Many thanks,
    Antony

  • ms778834ms778834 Posts: 28

    I have not found it in the documentation. Based on what you write, you've not played with the code, so your setting should be the default self.useTradeFileForPnL = kwargs.get('useTradeFileForPnL',False).
    To shed some light on this code snippet: this line defines how your P/L is calculated→ it is just a part of source code which tells the computer how to generate your reports; the full code can be found in your zipped file: your directory/Report - name.zip/name/python_notebooks, as well as in report's HTML file by clicking Click here to toggle on/off the raw code.

    Now the way in which the Total Profit is calculated, is defined by this method ↓

    def calculateTotalProfit(self,returnValue = False):
            self.totalProfit = np.sum(self.dailyTotalPnL)
            if returnValue:
                return self.totalProfit
    , which calls
    self.dailyCombinedPnL = pd.DataFrame(columns=['dailyRealizedPnL','dailyUnrealizedPnL'])
            ### change here!
            if self.useTradeFileForPnL == True:
                #print("Using trade file to calculate PnL due to issues in portfolio file...")

    Maybe KTG's CIO will know more about it, if he finds the time to answer @shayne :smirk:
  • aj165602aj165602 Posts: 105

    Thanks. Very useful to learn how to use that tool.

Sign In or Register to comment.