Example #1
0
    def outputSummaryStats(self, curve, plot):
        returns = curve['return']
        if hasattr(self.dataHandler, "benchmarkData"):
            benchmarkReturns = self.dataHandler.benchmarkData['return']
            benchmarkReturns.name = self.benchmark
        else:
            benchmarkReturns = None
        perf_metric, perf_df, rollingRisk = createPerformanceTearSheet(
            returns=returns, benchmarkReturns=benchmarkReturns, plot=plot)

        if self.portfolioType == PortfolioType.FullNotional:
            positons = curve.drop([
                'cash', 'commission', 'total', 'return', 'margin',
                'equity_curve', 'pnl'
            ],
                                  axis=1)
        else:
            positons = curve.drop([
                'commission', 'total', 'return', 'margin', 'equity_curve',
                'pnl'
            ],
                                  axis=1)
        aggregated_positons = createPostionTearSheet(positons, plot=plot)

        transactions = extractTransactionFromFilledBook(self.filledBook.view())
        turnover_rate = createTranscationTearSheet(transactions,
                                                   positons,
                                                   plot=plot)

        if plot:
            plt.show()

        return perf_metric, perf_df, rollingRisk, aggregated_positons, transactions, turnover_rate
Example #2
0
    def outputSummaryStats(self, curve, other_curves, plot):
        returns = curve['return']
        if hasattr(self.dataHandler, "benchmarkData"):
            benchmarkReturns = self.dataHandler.benchmarkData['return']
            benchmarkReturns.name = self.benchmark
        else:
            benchmarkReturns = None

        perf_metric, perf_df, rollingRisk = createPerformanceTearSheet(returns=returns,
                                                                       benchmarkReturns=benchmarkReturns,
                                                                       other_curves=other_curves,
                                                                       plot=plot)

        if self.portfolioType == PortfolioType.FullNotional:
            positons = curve.drop(['cash', 'commission', 'total', 'return', 'margin', 'equity_curve', 'pnl'], axis=1)
        else:
            positons = curve.drop(['commission', 'total', 'return', 'margin', 'equity_curve', 'pnl'], axis=1)
        aggregated_positons = createPostionTearSheet(positons, plot=plot)

        transactions = extractTransactionFromFilledBook(self.filledBook.view())
        turnover_rate = createTranscationTearSheet(transactions, positons, plot=plot)

        if plot:
            plt.show()

        return perf_metric, perf_df, rollingRisk, aggregated_positons, transactions, turnover_rate