コード例 #1
0
def test_output():
    static_folder = jutil.join_relative_path('trade/analyze/static')

    r = Report({'mytitle': 'Test Title', 'mytable': 'Hello World!'},
               source_dir=static_folder,
               template_fn='test_template.html',
               out_folder='../output')
    r.generate_html()
    r.output_html()
    r.output_pdf()
コード例 #2
0
ファイル: test_report.py プロジェクト: sukeyisme/JAQS
def test_output():
    static_folder = jutil.join_relative_path('trade/analyze/static')

    r = Report({'mytitle': 'Test Title', 'mytable': 'Hello World!'},
               source_dir=static_folder,
               template_fn='test_template.html',
               out_folder='../output')
    r.generate_html()
    r.output_html()
    r.output_pdf()
コード例 #3
0
    def gen_report(self, source_dir, template_fn, out_folder='.', selected=None):
        """
        Generate HTML (and PDF) report of the trade analysis.

        Parameters
        ----------
        source_dir : str
            path of directory where HTML template and css files are stored.
        template_fn : str
            File name of HTML template.
        out_folder : str
            Output folder of report.
        selected : list of str or None
            List of symbols whose detailed PnL curve and position will be plotted.
            # TODO: this parameter should not belong to function


        """
        dic = dict()
        dic['html_title'] = "Alpha Strategy Backtest Result"
        dic['selected_securities'] = selected
        dic['props'] = self.configs
        dic['metrics'] = self.metrics
        dic['position_change'] = self.position_change
        dic['account'] = self.account
        dic['df_daily'] = jutil.group_df_to_dict(self.daily, by='symbol')
        
        self.report_dic.update(dic)
        
        self.returns.to_csv(os.path.join(out_folder, 'returns.csv'))
    
        r = Report(self.report_dic, source_dir=source_dir, template_fn=template_fn, out_folder=out_folder)
        
        r.generate_html()
        r.output_html('report.html')
コード例 #4
0
ファイル: analyze.py プロジェクト: sukeyisme/JAQS
    def gen_report(self, source_dir, template_fn, out_folder='.', selected=None):
        """
        Generate HTML (and PDF) report of the trade analysis.

        Parameters
        ----------
        source_dir : str
            path of directory where HTML template and css files are stored.
        template_fn : str
            File name of HTML template.
        out_folder : str
            Output folder of report.
        selected : list of str or None
            List of symbols whose detailed PnL curve and position will be plotted.
            # TODO: this parameter should not belong to function


        """
        dic = dict()
        dic['html_title'] = "Alpha Strategy Backtest Result"
        dic['selected_securities'] = selected
        # we do not want to show username / password in report
        dic['props'] = {k: v for k, v in self.configs.items() if ('username' not in k and 'password' not in k)}
        dic['performance_metrics'] = self.performance_metrics
        dic['risk_metrics'] = self.risk_metrics
        dic['position_change'] = self.position_change
        dic['account'] = self.account
        dic['df_daily'] = jutil.group_df_to_dict(self.daily, by='symbol')
        dic['daily_position'] = None # self.daily_position
        dic['rebalance_positions'] = self.rebalance_positions
        
        self.report_dic.update(dic)
        
        r = Report(self.report_dic, source_dir=source_dir, template_fn=template_fn, out_folder=out_folder)
        
        r.generate_html()
        r.output_html('report.html')
コード例 #5
0
ファイル: analyze.py プロジェクト: JTJ17/JAQS
    def gen_report(self,
                   source_dir,
                   template_fn,
                   out_folder='.',
                   selected=None):
        """
        Generate HTML (and PDF) report of the trade analysis.

        Parameters
        ----------
        source_dir : str
            path of directory where HTML template and css files are stored.
        template_fn : str
            File name of HTML template.
        out_folder : str
            Output folder of report.
        selected : list of str or None
            List of symbols whose detailed PnL curve and position will be plotted.
            # TODO: this parameter should not belong to function


        """
        dic = dict()
        dic['html_title'] = "Alpha Strategy Backtest Result"
        dic['selected_securities'] = selected
        # we do not want to show username / password in report
        dic['props'] = {
            k: v
            for k, v in self.configs.items()
            if ('username' not in k and 'password' not in k)
        }
        dic['performance_metrics_report'] = self.performance_metrics_report
        dic['risk_metrics_report'] = self.risk_metrics_report
        dic['position_change'] = self.position_change
        dic['account'] = self.account
        dic['df_daily'] = jutil.group_df_to_dict(self.daily, by='symbol')
        dic['daily_position'] = None  # self.daily_position
        dic['rebalance_positions'] = self.rebalance_positions

        self.report_dic.update(dic)

        r = Report(self.report_dic,
                   source_dir=source_dir,
                   template_fn=template_fn,
                   out_folder=out_folder)

        r.generate_html()
        r.output_html('report.html')