Exemplo n.º 1
0
def main():
    setup_logging(logging.INFO)
    this_dir_path = os.path.dirname(os.path.abspath(__file__))
    strategy, benchmark, live_date = cached_value(
        get_data, os.path.join(this_dir_path, 'tearsheet5.cache'))

    settings = container.resolve(Settings)  # type: Settings
    pdf_exporter = container.resolve(PDFExporter)  # type: PDFExporter

    title = "Tearsheet With Benchmark, With Live Date"
    tearsheet = TearsheetWithBenchmark(settings,
                                       pdf_exporter,
                                       strategy,
                                       benchmark,
                                       live_date=live_date,
                                       title=title)
    tearsheet.build_document()
    tearsheet.save(file_name=title)

    title = "Tearsheet With Benchmark, Without Live Date"
    tearsheet = TearsheetWithBenchmark(settings,
                                       pdf_exporter,
                                       strategy,
                                       benchmark,
                                       live_date=None,
                                       title=title)
    tearsheet.build_document()
    tearsheet.save(file_name=title)

    title = "Tearsheet Without Benchmark, With Live Date"
    tearsheet = TearsheetWithoutBenchmark(settings,
                                          pdf_exporter,
                                          strategy,
                                          live_date=live_date,
                                          title=title)
    tearsheet.build_document()
    tearsheet.save(file_name=title)

    title = "Tearsheet Without Benchmark, Without Live Date"
    tearsheet = TearsheetWithoutBenchmark(settings,
                                          pdf_exporter,
                                          strategy,
                                          live_date=None,
                                          title=title)
    tearsheet.build_document()
    tearsheet.save(file_name=title)

    title = "Tearsheet Comparative"
    tearsheet = TearsheetComparative(settings,
                                     pdf_exporter,
                                     strategy,
                                     benchmark,
                                     title=title)
    tearsheet.build_document()
    tearsheet.save(file_name=title)

    print("Finished")
Exemplo n.º 2
0
    def _issue_tearsheet(self, portfolio_tms):
        if self._monitor_settings.issue_tearsheet:
            if self.benchmark_tms is None:
                tearsheet = TearsheetWithoutBenchmark(
                    self._settings, self._pdf_exporter, portfolio_tms, title=portfolio_tms.name)
            else:
                tearsheet = TearsheetWithBenchmark(
                    self._settings, self._pdf_exporter, portfolio_tms, self.benchmark_tms, title=portfolio_tms.name)

            tearsheet.build_document()
            tearsheet.save(self._report_dir)
Exemplo n.º 3
0
 def _export_pdf_with_charts(self, portfolio_tms):
     portfolio_tms.name = self.backtest_result.backtest_name
     tearsheet = TearsheetWithoutBenchmark(self._settings,
                                           self._pdf_exporter,
                                           portfolio_tms,
                                           title=portfolio_tms.name)
     tearsheet.build_document()
     tearsheet.save(self._report_dir)
Exemplo n.º 4
0
 def _export_PDF_with_charts(self, portfolio_tms):
     try:
         tearsheet = TearsheetWithoutBenchmark(self._settings,
                                               self._pdf_exporter,
                                               portfolio_tms,
                                               title=portfolio_tms.name)
         tearsheet.build_document()
         tearsheet.save(self._report_dir)
     except Exception as ex:
         self.logger.error("Error while exporting to PDF: " + str(ex))