def main(): this_dir_path = os.path.dirname(os.path.abspath(__file__)) trades, nr_of_assets_traded, start_date, end_date = cached_value( get_data, os.path.join(this_dir_path, 'trade_analysis.cache')) settings = container.resolve(Settings) # type: Settings pdf_exporter = container.resolve(PDFExporter) # type: PDFExporter contract_ticker_mapper = SimulatedBloombergContractTickerMapper() initial_risk = 0.05 nr_of_assets_traded = len( set( contract_ticker_mapper.contract_to_ticker(t.contract, False) for t in trades)) trade_analysis_sheet = TradeAnalysisSheet(settings, pdf_exporter, nr_of_assets_traded, trades, start_date, end_date, initial_risk, title="Sample trade analysis") trade_analysis_sheet.build_document() trade_analysis_sheet.save() print("Finished")
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")
def main(): this_dir_path = os.path.dirname(os.path.abspath(__file__)) trades_df, nr_of_assets_traded, start_date, end_date = cached_value( get_data, os.path.join(this_dir_path, 'trade_analysis.cache')) settings = container.resolve(Settings) # type: Settings pdf_exporter = container.resolve(PDFExporter) # type: PDFExporter trade_analysis_sheet = TradeAnalysisSheet( settings, pdf_exporter, trades_df, start_date, end_date, nr_of_assets_traded=nr_of_assets_traded, title="Sample trade analysis") trade_analysis_sheet.build_document() trade_analysis_sheet.save() print("Finished")
def main(): this_dir_path = os.path.dirname(os.path.abspath(__file__)) strategy_tms, benchmark_tms, live_date = cached_value( get_data, os.path.join(this_dir_path, 'live_trading_sheet.cache')) settings = container.resolve(Settings) # type: Settings pdf_exporter = container.resolve(PDFExporter) # type: PDFExporter is_tms_stats = InSampleReturnStats(0.0005810136908445734, 0.012825939240219972) tearsheet = LiveTradingSheet( settings, pdf_exporter, strategy_tms, strategy_tms, is_tms_stats, "Live Trading Sheet demo") tearsheet.build_document() tearsheet.save() benchmark_tms.name = "Benchmark" leverage = strategy_tms # does not make sense, but just to plot something tearsheet = LiveTradingSheet( settings, pdf_exporter, strategy_tms, leverage, is_tms_stats, "Live trading sheet demo - Benchmark", benchmark_tms=benchmark_tms) tearsheet.build_document() tearsheet.save() print("Finished")