investing-algorithm-framework 8.0.0__tar.gz → 8.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/PKG-INFO +1 -1
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/context.py +5 -1
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/backtest_report.py +134 -10
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/templates/dashboard.js +404 -121
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/templates/dashboard_template.html.j2 +4 -119
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/strategy.py +10 -5
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/mcp_server.py +825 -22
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/backtesting/backtest_evaluation_focuss.py +16 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/backtesting/backtest_summary_metrics.py +16 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/backtesting/combine_backtests.py +120 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/order/order.py +27 -3
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/services/backtesting/vector_backtest_service.py +10 -2
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/trade_service/trade_service.py +2 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/pyproject.toml +1 -1
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/LICENSE +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/README.md +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/analysis/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/analysis/backtest_data_ranges.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/analysis/markdown.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/analysis/ranking.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/algorithm/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/algorithm/algorithm.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/algorithm/algorithm_factory.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/app.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/app_hook.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/eventloop.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/ascii.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/backtest_report_old.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/charts/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/charts/entry_exist_signals.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/charts/equity_curve.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/charts/equity_curve_drawdown.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/charts/line_chart.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/charts/monthly_returns_heatmap.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/charts/ohlcv_data_completeness.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/charts/rolling_sharp_ratio.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/charts/yearly_returns_barchart.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/generate.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/tables/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/tables/key_metrics_table.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/tables/stop_loss_table.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/tables/time_metrics_table.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/tables/trade_metrics_table.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/tables/trades_table.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/tables/utils.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/templates/dashboard.css +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/reporting/templates/report_template.html.j2 +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/stateless/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/stateless/action_handlers/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/stateless/action_handlers/action_handler_strategy.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/stateless/action_handlers/check_online_handler.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/stateless/action_handlers/run_strategy_handler.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/stateless/exception_handler.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/task.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/controllers/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/controllers/orders.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/controllers/portfolio.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/controllers/positions.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/create_app.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/error_handler.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/responses.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/run_strategies.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/schemas/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/schemas/order.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/schemas/portfolio.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/schemas/position.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/app/web/setup_cors.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/cli.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/deploy_to_aws_lambda.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/deploy_to_azure_function.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/initialize_app.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/.gitignore.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/app.py.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/app_aws_lambda_function.py.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/app_azure_function.py.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/app_web.py.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/aws_lambda_dockerfile.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/aws_lambda_dockerignore.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/aws_lambda_readme.md.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/aws_lambda_requirements.txt.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/azure_function_function_app.py.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/azure_function_host.json.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/azure_function_local.settings.json.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/azure_function_requirements.txt.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/data_providers.py.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/env.example.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/env_azure_function.example.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/market_data_providers.py.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/readme.md.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/requirements.txt.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/run_backtest.py.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/templates/strategy.py.template +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/cli/validate_backtest_checkpoints.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/create_app.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/dependency_container.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/algorithm_id.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/backtesting/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/backtesting/backtest.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/backtesting/backtest_date_range.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/backtesting/backtest_metrics.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/backtesting/backtest_permutation_test.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/backtesting/backtest_run.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/backtesting/backtest_utils.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/backtesting/templates/backtest.html +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/backtesting/templates/finterion-dark.png +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/backtesting/templates/finterion-light.png +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/config.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/constants.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/data_provider.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/data_structures.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/decimal_parsing.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/exceptions.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/app_mode.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/base_model.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/data/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/data/data_source.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/data/data_type.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/event.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/market/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/market/market_credential.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/order/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/order/order.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/order/order_side.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/order/order_status.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/order/order_type.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/portfolio/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/portfolio/portfolio.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/portfolio/portfolio_configuration.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/portfolio/portfolio_snapshot.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/position/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/position/position.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/position/position_size.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/position/position_snapshot.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/risk_rules/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/risk_rules/scaling_rule.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/risk_rules/stop_loss_rule.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/risk_rules/take_profit_rule.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/risk_rules/trading_cost.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/snapshot_interval.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/strategy_profile.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/time_frame.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/time_interval.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/time_unit.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/tracing/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/tracing/trace.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/trade/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/trade/trade.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/trade/trade_status.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/trade/trade_stop_loss.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/models/trade/trade_take_profit.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/order_executor.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/portfolio_provider.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/services/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/services/market_credential_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/services/portfolios/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/services/portfolios/portfolio_sync_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/services/rounding_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/services/state_handler.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/stateless_actions.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/strategy.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/utils/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/utils/csv.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/utils/custom_tqdm.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/utils/dates.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/utils/jupyter_notebook_detection.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/utils/polars.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/utils/random.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/utils/signatures.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/utils/stoppable_thread.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/domain/utils/synchronized.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/download_data.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/data_providers/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/data_providers/ccxt.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/data_providers/csv.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/data_providers/pandas.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/database/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/database/sql_alchemy.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/decimal_parser.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/model_extension.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/order/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/order/trade_allocation.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/order_trade_association.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/portfolio/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/portfolio/portfolio_snapshot.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/portfolio/sql_portfolio.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/position/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/position/position.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/position/position_snapshot.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/trades/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/trades/trade.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/trades/trade_stop_loss.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/models/trades/trade_take_profit.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/order_executors/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/order_executors/backtest_oder_executor.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/order_executors/ccxt_order_executor.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/portfolio_providers/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/portfolio_providers/ccxt_portfolio_provider.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/repositories/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/repositories/order_repository.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/repositories/portfolio_repository.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/repositories/portfolio_snapshot_repository.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/repositories/position_repository.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/repositories/position_snapshot_repository.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/repositories/repository.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/repositories/trade_allocation_repository.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/repositories/trade_repository.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/repositories/trade_stop_loss_repository.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/repositories/trade_take_profit_repository.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/services/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/services/aws/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/services/aws/state_handler.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/services/azure/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/services/azure/state_handler.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/services/backtesting/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/services/backtesting/backtest_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/infrastructure/services/backtesting/event_backtest_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/configuration_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/data_providers/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/data_providers/data.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/data_providers/data_provider_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/market_credential_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/alpha.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/beta.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/cagr.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/calmar_ratio.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/drawdown.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/equity_curve.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/exposure.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/generate.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/mean_daily_return.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/price_efficiency.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/profit_factor.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/recovery.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/returns.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/risk_free_rate.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/sharpe_ratio.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/sortino_ratio.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/standard_deviation.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/trades.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/treynor_ratio.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/ulcer.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/value_at_risk.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/volatility.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/metrics/win_rate.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/order_service/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/order_service/order_backtest_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/order_service/order_executor_lookup.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/order_service/order_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/portfolios/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/portfolios/backtest_portfolio_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/portfolios/portfolio_configuration_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/portfolios/portfolio_provider_lookup.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/portfolios/portfolio_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/portfolios/portfolio_snapshot_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/portfolios/portfolio_sync_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/positions/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/positions/position_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/positions/position_snapshot_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/repository_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/trade_order_evaluator/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/trade_order_evaluator/backtest_trade_oder_evaluator.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/trade_order_evaluator/default_trade_order_evaluator.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/trade_order_evaluator/trade_order_evaluator.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/trade_service/__init__.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/trade_service/trade_stop_loss_service.py +0 -0
- {investing_algorithm_framework-8.0.0 → investing_algorithm_framework-8.1.1}/investing_algorithm_framework/services/trade_service/trade_take_profit_service.py +0 -0
|
@@ -161,7 +161,8 @@ class Context:
|
|
|
161
161
|
market=None,
|
|
162
162
|
execute=True,
|
|
163
163
|
validate=True,
|
|
164
|
-
sync=True
|
|
164
|
+
sync=True,
|
|
165
|
+
metadata=None
|
|
165
166
|
) -> Order:
|
|
166
167
|
"""
|
|
167
168
|
Function to create a limit order. This function will create a limit
|
|
@@ -257,6 +258,9 @@ class Context:
|
|
|
257
258
|
"trading_symbol": portfolio.trading_symbol,
|
|
258
259
|
}
|
|
259
260
|
|
|
261
|
+
if metadata is not None:
|
|
262
|
+
order_data["metadata"] = metadata
|
|
263
|
+
|
|
260
264
|
if BACKTESTING_FLAG in self.configuration_service.config \
|
|
261
265
|
and self.configuration_service.config[BACKTESTING_FLAG]:
|
|
262
266
|
order_data["created_at"] = \
|
|
@@ -10,7 +10,7 @@ from datetime import datetime, timedelta
|
|
|
10
10
|
from jinja2 import Environment, FileSystemLoader
|
|
11
11
|
|
|
12
12
|
from investing_algorithm_framework.domain import (
|
|
13
|
-
Backtest, OperationalException
|
|
13
|
+
Backtest, OperationalException, tqdm
|
|
14
14
|
)
|
|
15
15
|
|
|
16
16
|
logger = logging.getLogger("investing_algorithm_framework")
|
|
@@ -88,6 +88,70 @@ def _is_na(val):
|
|
|
88
88
|
return False
|
|
89
89
|
|
|
90
90
|
|
|
91
|
+
def _downsample(series, max_points=300):
|
|
92
|
+
"""Downsample a time-series list to at most *max_points* entries.
|
|
93
|
+
|
|
94
|
+
Uses the Largest-Triangle-Three-Buckets (LTTB) algorithm to
|
|
95
|
+
preserve visual fidelity while drastically reducing data size
|
|
96
|
+
for the browser. Always keeps the first and last points.
|
|
97
|
+
"""
|
|
98
|
+
if not series or len(series) <= max_points:
|
|
99
|
+
return series
|
|
100
|
+
|
|
101
|
+
n = len(series)
|
|
102
|
+
# Each element is [value, date_str]
|
|
103
|
+
sampled = [series[0]]
|
|
104
|
+
bucket_size = (n - 2) / (max_points - 2)
|
|
105
|
+
|
|
106
|
+
a_idx = 0
|
|
107
|
+
for i in range(1, max_points - 1):
|
|
108
|
+
# Calculate bucket boundaries
|
|
109
|
+
avg_start = int((i) * bucket_size) + 1
|
|
110
|
+
avg_end = int((i + 1) * bucket_size) + 1
|
|
111
|
+
if avg_end > n - 1:
|
|
112
|
+
avg_end = n - 1
|
|
113
|
+
|
|
114
|
+
# Average point of next bucket
|
|
115
|
+
avg_x = 0
|
|
116
|
+
avg_y = 0
|
|
117
|
+
count = avg_end - avg_start
|
|
118
|
+
if count <= 0:
|
|
119
|
+
count = 1
|
|
120
|
+
avg_end = avg_start + 1
|
|
121
|
+
for j in range(avg_start, avg_end):
|
|
122
|
+
avg_x += j
|
|
123
|
+
avg_y += series[j][0]
|
|
124
|
+
avg_x /= count
|
|
125
|
+
avg_y /= count
|
|
126
|
+
|
|
127
|
+
# Current bucket boundaries
|
|
128
|
+
range_start = int((i - 1) * bucket_size) + 1
|
|
129
|
+
range_end = int(i * bucket_size) + 1
|
|
130
|
+
if range_end > n - 1:
|
|
131
|
+
range_end = n - 1
|
|
132
|
+
|
|
133
|
+
# Pick the point with the largest triangle area
|
|
134
|
+
a_x = a_idx
|
|
135
|
+
a_y = series[a_idx][0]
|
|
136
|
+
max_area = -1
|
|
137
|
+
best_idx = range_start
|
|
138
|
+
|
|
139
|
+
for j in range(range_start, range_end):
|
|
140
|
+
area = abs(
|
|
141
|
+
(a_x - avg_x) * (series[j][0] - a_y)
|
|
142
|
+
- (a_x - j) * (avg_y - a_y)
|
|
143
|
+
) * 0.5
|
|
144
|
+
if area > max_area:
|
|
145
|
+
max_area = area
|
|
146
|
+
best_idx = j
|
|
147
|
+
|
|
148
|
+
sampled.append(series[best_idx])
|
|
149
|
+
a_idx = best_idx
|
|
150
|
+
|
|
151
|
+
sampled.append(series[-1])
|
|
152
|
+
return sampled
|
|
153
|
+
|
|
154
|
+
|
|
91
155
|
@dataclass
|
|
92
156
|
class BacktestReport:
|
|
93
157
|
backtests: List[Backtest] = field(default_factory=list)
|
|
@@ -125,14 +189,17 @@ class BacktestReport:
|
|
|
125
189
|
with open(path, "w") as f:
|
|
126
190
|
f.write(self.html_report)
|
|
127
191
|
|
|
192
|
+
if browser:
|
|
193
|
+
webbrowser.open(f"file://{path}")
|
|
194
|
+
return
|
|
195
|
+
|
|
128
196
|
try:
|
|
129
197
|
from IPython import get_ipython
|
|
130
198
|
shell = get_ipython().__class__.__name__
|
|
131
199
|
if shell == 'ZMQInteractiveShell':
|
|
132
200
|
from IPython.display import display, HTML
|
|
133
201
|
display(HTML(self.html_report))
|
|
134
|
-
|
|
135
|
-
return
|
|
202
|
+
return
|
|
136
203
|
except (NameError, ImportError):
|
|
137
204
|
pass
|
|
138
205
|
|
|
@@ -159,6 +226,7 @@ class BacktestReport:
|
|
|
159
226
|
def open(
|
|
160
227
|
backtests: List[Backtest] = None,
|
|
161
228
|
directory_path: Union[str, List[str], None] = None,
|
|
229
|
+
show_progress: bool = False,
|
|
162
230
|
) -> "BacktestReport":
|
|
163
231
|
loaded = []
|
|
164
232
|
source_tags = []
|
|
@@ -175,11 +243,12 @@ class BacktestReport:
|
|
|
175
243
|
else:
|
|
176
244
|
dir_paths = []
|
|
177
245
|
|
|
246
|
+
# Collect all backtest paths first for progress tracking
|
|
247
|
+
backtest_paths = []
|
|
178
248
|
for dp in dir_paths:
|
|
179
249
|
tag = os.path.basename(os.path.normpath(dp))
|
|
180
250
|
if BacktestReport._is_backtest(dp):
|
|
181
|
-
|
|
182
|
-
source_tags.append(tag)
|
|
251
|
+
backtest_paths.append((dp, tag))
|
|
183
252
|
else:
|
|
184
253
|
for root, dirs, _ in os.walk(dp):
|
|
185
254
|
for dir_name in dirs:
|
|
@@ -189,10 +258,20 @@ class BacktestReport:
|
|
|
189
258
|
if BacktestReport._is_backtest(
|
|
190
259
|
subdir
|
|
191
260
|
):
|
|
192
|
-
|
|
193
|
-
|
|
261
|
+
backtest_paths.append(
|
|
262
|
+
(subdir, tag)
|
|
194
263
|
)
|
|
195
|
-
|
|
264
|
+
|
|
265
|
+
iterator = backtest_paths
|
|
266
|
+
if show_progress:
|
|
267
|
+
iterator = tqdm(
|
|
268
|
+
backtest_paths,
|
|
269
|
+
desc="Loading backtests",
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
for path, tag in iterator:
|
|
273
|
+
loaded.append(Backtest.open(path))
|
|
274
|
+
source_tags.append(tag)
|
|
196
275
|
|
|
197
276
|
for bt in backtests:
|
|
198
277
|
if not isinstance(bt, Backtest):
|
|
@@ -336,10 +415,10 @@ class BacktestReport:
|
|
|
336
415
|
initial = ec[0][0] if ec else 1
|
|
337
416
|
if initial == 0:
|
|
338
417
|
initial = 1
|
|
339
|
-
rep_eq = [
|
|
418
|
+
rep_eq = _downsample([
|
|
340
419
|
[(v / initial - 1) * 100, _fmt_date(d)]
|
|
341
420
|
for v, d in ec
|
|
342
|
-
]
|
|
421
|
+
])
|
|
343
422
|
|
|
344
423
|
# Run IDs / mappings / labels
|
|
345
424
|
run_ids, run_name_map, run_labels_list = [], {}, []
|
|
@@ -463,6 +542,29 @@ class BacktestReport:
|
|
|
463
542
|
op_dt = t.opened_at
|
|
464
543
|
cl_dt = t.closed_at
|
|
465
544
|
total_fees = getattr(t, 'total_fees', 0) or 0
|
|
545
|
+
# Stop-loss / take-profit status
|
|
546
|
+
t_sls = getattr(t, 'stop_losses', None)
|
|
547
|
+
t_tps = getattr(t, 'take_profits', None)
|
|
548
|
+
sl_triggered = any(
|
|
549
|
+
getattr(sl, 'triggered', False)
|
|
550
|
+
for sl in (t_sls or [])
|
|
551
|
+
)
|
|
552
|
+
tp_triggered = any(
|
|
553
|
+
getattr(tp, 'triggered', False)
|
|
554
|
+
for tp in (t_tps or [])
|
|
555
|
+
)
|
|
556
|
+
has_sl = bool(t_sls and len(t_sls) > 0)
|
|
557
|
+
has_tp = bool(t_tps and len(t_tps) > 0)
|
|
558
|
+
# Collect unique order reasons
|
|
559
|
+
t_reasons = set()
|
|
560
|
+
for t_o in (getattr(t, 'orders', None)
|
|
561
|
+
or []):
|
|
562
|
+
t_o_meta = getattr(
|
|
563
|
+
t_o, 'metadata', None
|
|
564
|
+
) or {}
|
|
565
|
+
r = t_o_meta.get('order_reason')
|
|
566
|
+
if r:
|
|
567
|
+
t_reasons.add(r)
|
|
466
568
|
trades_list.append({
|
|
467
569
|
'id': idx_t,
|
|
468
570
|
'sym': sym,
|
|
@@ -476,6 +578,17 @@ class BacktestReport:
|
|
|
476
578
|
'total_fees': round(total_fees, 4),
|
|
477
579
|
'net_gain': round(ng, 2),
|
|
478
580
|
'pct': round(pct, 2),
|
|
581
|
+
'stop_loss': (
|
|
582
|
+
'Triggered' if sl_triggered
|
|
583
|
+
else ('Set' if has_sl else '')
|
|
584
|
+
),
|
|
585
|
+
'take_profit': (
|
|
586
|
+
'Triggered' if tp_triggered
|
|
587
|
+
else ('Set' if has_tp else '')
|
|
588
|
+
),
|
|
589
|
+
'reasons': ', '.join(
|
|
590
|
+
sorted(t_reasons)
|
|
591
|
+
),
|
|
479
592
|
})
|
|
480
593
|
sym_stats.setdefault(sym, {'count': 0, 'gain': 0})
|
|
481
594
|
sym_stats[sym]['count'] += 1
|
|
@@ -588,6 +701,11 @@ class BacktestReport:
|
|
|
588
701
|
o_slippage = getattr(o, 'slippage', None)
|
|
589
702
|
if o_slippage is None:
|
|
590
703
|
o_slippage = 0
|
|
704
|
+
o_meta = getattr(o, 'metadata', None)
|
|
705
|
+
o_meta = o_meta if o_meta else {}
|
|
706
|
+
o_reason = o_meta.get(
|
|
707
|
+
'order_reason', ''
|
|
708
|
+
)
|
|
591
709
|
orders_list.append({
|
|
592
710
|
'sym': getattr(o, 'target_symbol', '')
|
|
593
711
|
or '',
|
|
@@ -617,6 +735,7 @@ class BacktestReport:
|
|
|
617
735
|
'slippage': round(
|
|
618
736
|
float(o_slippage), 4
|
|
619
737
|
),
|
|
738
|
+
'reason': o_reason,
|
|
620
739
|
'created': _fmt_date(o_dt)
|
|
621
740
|
if o_dt else '',
|
|
622
741
|
'updated': _fmt_date(u_dt)
|
|
@@ -637,6 +756,11 @@ class BacktestReport:
|
|
|
637
756
|
),
|
|
638
757
|
})
|
|
639
758
|
|
|
759
|
+
# Downsample heavy time series for browser perf
|
|
760
|
+
eq = _downsample(eq)
|
|
761
|
+
dd = _downsample(dd)
|
|
762
|
+
rs = _downsample(rs)
|
|
763
|
+
|
|
640
764
|
run_data[rid] = {
|
|
641
765
|
'label': label,
|
|
642
766
|
'EQ': eq,
|