investing-algorithm-framework 7.19.2__tar.gz → 7.19.4__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-7.19.2 → investing_algorithm_framework-7.19.4}/PKG-INFO +1 -1
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/app.py +67 -41
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/data_provider.py +51 -1
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/exceptions.py +10 -1
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/data/data_source.py +33 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/utils/polars.py +6 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/data_providers/ccxt.py +88 -3
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/data_providers/csv.py +84 -10
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/data_providers/pandas.py +82 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/data_providers/data_provider_service.py +8 -1
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/pyproject.toml +1 -1
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/LICENSE +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/README.md +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/algorithm/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/algorithm/algorithm.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/algorithm/algorithm_factory.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/analysis/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/analysis/backtest_data_ranges.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/analysis/backtest_utils.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/analysis/permutation.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/analysis/ranking.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/app_hook.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/context.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/eventloop.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/ascii.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/backtest_report.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/charts/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/charts/entry_exist_signals.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/charts/equity_curve.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/charts/equity_curve_drawdown.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/charts/line_chart.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/charts/monthly_returns_heatmap.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/charts/ohlcv_data_completeness.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/charts/rolling_sharp_ratio.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/charts/yearly_returns_barchart.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/generate.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/tables/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/tables/key_metrics_table.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/tables/stop_loss_table.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/tables/time_metrics_table.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/tables/trade_metrics_table.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/tables/trades_table.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/tables/utils.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/reporting/templates/report_template.html.j2 +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/stateless/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/stateless/action_handlers/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/stateless/action_handlers/action_handler_strategy.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/stateless/action_handlers/check_online_handler.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/stateless/action_handlers/run_strategy_handler.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/stateless/exception_handler.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/strategy.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/task.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/controllers/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/controllers/orders.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/controllers/portfolio.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/controllers/positions.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/create_app.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/error_handler.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/responses.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/run_strategies.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/schemas/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/schemas/order.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/schemas/portfolio.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/schemas/position.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/app/web/setup_cors.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/cli.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/deploy_to_aws_lambda.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/deploy_to_azure_function.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/initialize_app.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/.gitignore.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/app.py.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/app_aws_lambda_function.py.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/app_azure_function.py.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/app_web.py.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/aws_lambda_dockerfile.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/aws_lambda_dockerignore.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/aws_lambda_readme.md.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/aws_lambda_requirements.txt.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/azure_function_function_app.py.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/azure_function_host.json.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/azure_function_local.settings.json.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/azure_function_requirements.txt.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/data_providers.py.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/env.example.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/env_azure_function.example.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/market_data_providers.py.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/readme.md.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/requirements.txt.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/run_backtest.py.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/cli/templates/strategy.py.template +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/create_app.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/dependency_container.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/backtesting/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/backtesting/backtest.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/backtesting/backtest_date_range.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/backtesting/backtest_evaluation_focuss.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/backtesting/backtest_metrics.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/backtesting/backtest_permutation_test.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/backtesting/backtest_run.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/backtesting/backtest_summary_metrics.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/backtesting/combine_backtests.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/config.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/constants.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/data_structures.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/decimal_parsing.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/app_mode.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/base_model.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/data/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/data/data_type.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/event.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/market/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/market/market_credential.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/order/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/order/order.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/order/order_side.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/order/order_status.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/order/order_type.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/portfolio/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/portfolio/portfolio.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/portfolio/portfolio_configuration.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/portfolio/portfolio_snapshot.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/position/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/position/position.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/position/position_snapshot.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/snapshot_interval.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/strategy_profile.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/time_frame.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/time_interval.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/time_unit.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/tracing/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/tracing/trace.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/trade/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/trade/trade.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/trade/trade_risk_type.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/trade/trade_status.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/trade/trade_stop_loss.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/models/trade/trade_take_profit.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/order_executor.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/portfolio_provider.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/positions/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/positions/position_size.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/services/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/services/market_credential_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/services/portfolios/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/services/portfolios/portfolio_sync_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/services/rounding_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/services/state_handler.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/stateless_actions.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/strategy.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/utils/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/utils/csv.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/utils/custom_tqdm.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/utils/dates.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/utils/jupyter_notebook_detection.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/utils/random.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/utils/signatures.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/utils/stoppable_thread.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/domain/utils/synchronized.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/download_data.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/data_providers/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/database/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/database/sql_alchemy.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/decimal_parser.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/model_extension.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/order/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/order/order.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/order/order_metadata.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/order_trade_association.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/portfolio/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/portfolio/portfolio_snapshot.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/portfolio/sql_portfolio.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/position/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/position/position.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/position/position_snapshot.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/trades/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/trades/trade.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/trades/trade_stop_loss.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/models/trades/trade_take_profit.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/order_executors/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/order_executors/backtest_oder_executor.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/order_executors/ccxt_order_executor.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/portfolio_providers/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/portfolio_providers/ccxt_portfolio_provider.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/repositories/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/repositories/order_metadata_repository.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/repositories/order_repository.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/repositories/portfolio_repository.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/repositories/portfolio_snapshot_repository.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/repositories/position_repository.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/repositories/position_snapshot_repository.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/repositories/repository.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/repositories/trade_repository.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/repositories/trade_stop_loss_repository.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/repositories/trade_take_profit_repository.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/services/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/services/aws/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/services/aws/state_handler.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/services/azure/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/infrastructure/services/azure/state_handler.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/backtesting/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/backtesting/backtest_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/configuration_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/data_providers/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/market_credential_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/alpha.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/beta.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/cagr.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/calmar_ratio.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/drawdown.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/equity_curve.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/exposure.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/generate.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/mean_daily_return.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/price_efficiency.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/profit_factor.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/recovery.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/returns.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/risk_free_rate.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/sharpe_ratio.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/sortino_ratio.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/standard_deviation.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/trades.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/treynor_ratio.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/ulcer.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/value_at_risk.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/volatility.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/metrics/win_rate.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/order_service/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/order_service/order_backtest_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/order_service/order_executor_lookup.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/order_service/order_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/portfolios/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/portfolios/backtest_portfolio_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/portfolios/portfolio_configuration_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/portfolios/portfolio_provider_lookup.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/portfolios/portfolio_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/portfolios/portfolio_snapshot_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/portfolios/portfolio_sync_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/positions/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/positions/position_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/positions/position_snapshot_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/repository_service.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/trade_order_evaluator/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/trade_order_evaluator/backtest_trade_oder_evaluator.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/trade_order_evaluator/default_trade_order_evaluator.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/trade_order_evaluator/trade_order_evaluator.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/trade_service/__init__.py +0 -0
- {investing_algorithm_framework-7.19.2 → investing_algorithm_framework-7.19.4}/investing_algorithm_framework/services/trade_service/trade_service.py +0 -0
|
@@ -2,10 +2,9 @@ import inspect
|
|
|
2
2
|
import logging
|
|
3
3
|
import os
|
|
4
4
|
import threading
|
|
5
|
-
from datetime import datetime, timezone
|
|
5
|
+
from datetime import datetime, timezone, timedelta
|
|
6
6
|
from typing import List, Optional, Any, Dict, Tuple
|
|
7
7
|
|
|
8
|
-
import pandas as pd
|
|
9
8
|
from flask import Flask
|
|
10
9
|
|
|
11
10
|
from investing_algorithm_framework.app.algorithm import Algorithm
|
|
@@ -19,7 +18,7 @@ from investing_algorithm_framework.domain import DATABASE_NAME, TimeUnit, \
|
|
|
19
18
|
AppMode, BacktestDateRange, DATABASE_DIRECTORY_NAME, DataSource, \
|
|
20
19
|
BACKTESTING_INITIAL_AMOUNT, SNAPSHOT_INTERVAL, Backtest, DataError, \
|
|
21
20
|
PortfolioConfiguration, SnapshotInterval, DataType, combine_backtests, \
|
|
22
|
-
PortfolioProvider, OrderExecutor, ImproperlyConfigured, \
|
|
21
|
+
PortfolioProvider, OrderExecutor, ImproperlyConfigured, TimeFrame, \
|
|
23
22
|
DataProvider, INDEX_DATETIME, tqdm, BacktestPermutationTest, \
|
|
24
23
|
LAST_SNAPSHOT_DATETIME, BACKTESTING_FLAG, generate_backtest_summary_metrics
|
|
25
24
|
from investing_algorithm_framework.infrastructure import setup_sqlalchemy, \
|
|
@@ -794,8 +793,9 @@ class App:
|
|
|
794
793
|
def check_data_completeness(
|
|
795
794
|
self,
|
|
796
795
|
strategies: List[TradingStrategy],
|
|
797
|
-
backtest_date_range: BacktestDateRange
|
|
798
|
-
|
|
796
|
+
backtest_date_range: BacktestDateRange,
|
|
797
|
+
show_progress: bool = True
|
|
798
|
+
) -> Tuple[bool, Dict[str, Any]]:
|
|
799
799
|
"""
|
|
800
800
|
Function to check the data completeness for a set of strategies
|
|
801
801
|
over a given backtest date range. This method checks if all data
|
|
@@ -807,10 +807,15 @@ class App:
|
|
|
807
807
|
to check data completeness for.
|
|
808
808
|
backtest_date_range (BacktestDateRange): The date range to
|
|
809
809
|
check data completeness for.
|
|
810
|
+
show_progress (bool): Whether to show a progress bar when
|
|
811
|
+
checking data completeness.
|
|
810
812
|
Returns:
|
|
811
|
-
|
|
813
|
+
Tuple[bool, Dict[str, Any]]: A tuple containing a boolean
|
|
814
|
+
indicating if the data is complete and a dictionary
|
|
815
|
+
with information about missing data for each data source.
|
|
812
816
|
"""
|
|
813
817
|
data_sources = []
|
|
818
|
+
missing_data_info = {}
|
|
814
819
|
|
|
815
820
|
for strategy in strategies:
|
|
816
821
|
data_sources.extend(strategy.data_sources)
|
|
@@ -818,7 +823,7 @@ class App:
|
|
|
818
823
|
self.initialize_data_sources_backtest(
|
|
819
824
|
data_sources,
|
|
820
825
|
backtest_date_range,
|
|
821
|
-
show_progress=
|
|
826
|
+
show_progress=show_progress
|
|
822
827
|
)
|
|
823
828
|
data_provider_service = self.container.data_provider_service()
|
|
824
829
|
|
|
@@ -827,36 +832,60 @@ class App:
|
|
|
827
832
|
for data_source in strategy.data_sources:
|
|
828
833
|
|
|
829
834
|
if DataType.OHLCV.equals(data_source.data_type):
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
835
|
+
required_start_date = backtest_date_range.start_date - \
|
|
836
|
+
timedelta(
|
|
837
|
+
minutes=TimeFrame.from_value(
|
|
838
|
+
data_source.time_frame
|
|
839
|
+
).amount_of_minutes * data_source.window_size
|
|
840
|
+
)
|
|
841
|
+
number_of_required_data_points = \
|
|
842
|
+
data_source.get_number_of_required_data_points(
|
|
843
|
+
backtest_date_range.start_date,
|
|
844
|
+
backtest_date_range.end_date
|
|
845
|
+
)
|
|
846
|
+
|
|
847
|
+
try:
|
|
848
|
+
data_provider = data_provider_service.get(data_source)
|
|
849
|
+
number_of_available_data_points = \
|
|
850
|
+
data_provider.get_number_of_data_points(
|
|
851
|
+
backtest_date_range.start_date,
|
|
852
|
+
backtest_date_range.end_date
|
|
853
|
+
)
|
|
854
|
+
|
|
855
|
+
missing_dates = \
|
|
856
|
+
data_provider.get_missing_data_dates(
|
|
857
|
+
required_start_date,
|
|
858
|
+
backtest_date_range.end_date
|
|
859
|
+
)
|
|
860
|
+
if number_of_available_data_points > 0:
|
|
861
|
+
missing_data_info[data_source.identifier] = {
|
|
862
|
+
"data_source_id": data_source.identifier,
|
|
863
|
+
"completeness_percentage": (
|
|
864
|
+
(
|
|
865
|
+
number_of_available_data_points /
|
|
866
|
+
number_of_required_data_points
|
|
867
|
+
) * 100
|
|
868
|
+
),
|
|
869
|
+
"missing_data_points": len(
|
|
870
|
+
missing_dates
|
|
871
|
+
),
|
|
872
|
+
"missing_dates": missing_dates,
|
|
873
|
+
"data_source_file_path":
|
|
874
|
+
data_provider.get_data_source_file_path()
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
except Exception as e:
|
|
853
878
|
raise DataError(
|
|
854
|
-
f"
|
|
879
|
+
f"Error getting data provider for data source "
|
|
855
880
|
f"{data_source.identifier} "
|
|
856
|
-
f"({data_source.symbol})
|
|
857
|
-
f"complete. Missing data points: {len(missing)}"
|
|
881
|
+
f"({data_source.symbol}): {str(e)}"
|
|
858
882
|
)
|
|
859
883
|
|
|
884
|
+
if len(missing_data_info.keys()) > 0:
|
|
885
|
+
return False, missing_data_info
|
|
886
|
+
|
|
887
|
+
return True, missing_data_info
|
|
888
|
+
|
|
860
889
|
def run_vector_backtests(
|
|
861
890
|
self,
|
|
862
891
|
initial_amount,
|
|
@@ -1070,13 +1099,10 @@ class App:
|
|
|
1070
1099
|
progress bar when initializing data sources.
|
|
1071
1100
|
market (str): The market to use for the backtest. This is used
|
|
1072
1101
|
to create a portfolio configuration if no portfolio
|
|
1073
|
-
configuration is
|
|
1074
|
-
the first portfolio configuration found will be used.
|
|
1102
|
+
configuration is provided in the strategy.
|
|
1075
1103
|
trading_symbol (str): The trading symbol to use for the backtest.
|
|
1076
1104
|
This is used to create a portfolio configuration if no
|
|
1077
|
-
portfolio configuration is
|
|
1078
|
-
provided, the first trading symbol found in the portfolio
|
|
1079
|
-
configuration will be used.
|
|
1105
|
+
portfolio configuration is provided in the strategy.
|
|
1080
1106
|
initial_amount (float): The initial amount to start the
|
|
1081
1107
|
backtest with. This will be the amount of trading currency
|
|
1082
1108
|
that the portfolio will start with. If not provided,
|
|
@@ -1180,7 +1206,7 @@ class App:
|
|
|
1180
1206
|
backtest_date_ranges (List[BacktestDateRange]): List of date ranges
|
|
1181
1207
|
initial_amount (float): The initial amount to start the
|
|
1182
1208
|
backtest with. This will be the amount of trading currency
|
|
1183
|
-
that the portfolio will start with.
|
|
1209
|
+
that the backtest portfolio will start with.
|
|
1184
1210
|
snapshot_interval (SnapshotInterval): The snapshot interval to use
|
|
1185
1211
|
for the backtest. This is used to determine how often the
|
|
1186
1212
|
portfolio snapshot should be taken during the backtest.
|
|
@@ -1405,11 +1431,11 @@ class App:
|
|
|
1405
1431
|
the risk-free rate from the US Treasury website.
|
|
1406
1432
|
market (str): The market to use for the backtest. This is used
|
|
1407
1433
|
to create a portfolio configuration if no portfolio
|
|
1408
|
-
configuration is
|
|
1434
|
+
configuration is provided in the strategy. If not provided,
|
|
1409
1435
|
the first portfolio configuration found will be used.
|
|
1410
1436
|
trading_symbol (str): The trading symbol to use for the backtest.
|
|
1411
1437
|
This is used to create a portfolio configuration if no
|
|
1412
|
-
portfolio configuration is
|
|
1438
|
+
portfolio configuration is provided in the strategy. If not
|
|
1413
1439
|
provided, the first trading symbol found in the portfolio
|
|
1414
1440
|
configuration will be used.
|
|
1415
1441
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import List, Any
|
|
1
|
+
from typing import List, Any, Union
|
|
2
2
|
from abc import ABC, abstractmethod
|
|
3
3
|
from datetime import datetime
|
|
4
4
|
from investing_algorithm_framework.domain.exceptions import \
|
|
@@ -282,3 +282,53 @@ class DataProvider(ABC):
|
|
|
282
282
|
configuration.
|
|
283
283
|
"""
|
|
284
284
|
raise NotImplementedError("Subclasses should implement this method.")
|
|
285
|
+
|
|
286
|
+
@abstractmethod
|
|
287
|
+
def get_number_of_data_points(
|
|
288
|
+
self,
|
|
289
|
+
start_date: datetime,
|
|
290
|
+
end_date: datetime,
|
|
291
|
+
) -> int:
|
|
292
|
+
"""
|
|
293
|
+
Returns the number of data points available between the
|
|
294
|
+
given start and end dates.
|
|
295
|
+
|
|
296
|
+
Args:
|
|
297
|
+
start_date (datetime): The start date for the data points.
|
|
298
|
+
end_date (datetime): The end date for the data points.
|
|
299
|
+
Returns:
|
|
300
|
+
int: The number of data points available between the
|
|
301
|
+
given start and end dates.
|
|
302
|
+
"""
|
|
303
|
+
raise NotImplementedError("Subclasses should implement this method.")
|
|
304
|
+
|
|
305
|
+
@abstractmethod
|
|
306
|
+
def get_missing_data_dates(
|
|
307
|
+
self,
|
|
308
|
+
start_date: datetime,
|
|
309
|
+
end_date: datetime,
|
|
310
|
+
) -> List[datetime]:
|
|
311
|
+
"""
|
|
312
|
+
Returns a list of dates for which data is missing between the
|
|
313
|
+
given start and end dates.
|
|
314
|
+
|
|
315
|
+
Args:
|
|
316
|
+
start_date (datetime): The start date for checking missing data.
|
|
317
|
+
end_date (datetime): The end date for checking missing data.
|
|
318
|
+
|
|
319
|
+
Returns:
|
|
320
|
+
List[datetime]: A list of dates for which data is missing
|
|
321
|
+
between the given start and end dates.
|
|
322
|
+
"""
|
|
323
|
+
raise NotImplementedError("Subclasses should implement this method.")
|
|
324
|
+
|
|
325
|
+
@abstractmethod
|
|
326
|
+
def get_data_source_file_path(self) -> Union[str, None]:
|
|
327
|
+
"""
|
|
328
|
+
Returns the file path for the given data source if applicable.
|
|
329
|
+
|
|
330
|
+
Returns:
|
|
331
|
+
Union[str, None]: The file path for the data source or None
|
|
332
|
+
if not applicable.
|
|
333
|
+
"""
|
|
334
|
+
raise NotImplementedError("Subclasses should implement this method.")
|
|
@@ -92,9 +92,18 @@ class DataError(Exception):
|
|
|
92
92
|
during data retrieval or processing
|
|
93
93
|
"""
|
|
94
94
|
|
|
95
|
-
def __init__(
|
|
95
|
+
def __init__(
|
|
96
|
+
self,
|
|
97
|
+
message,
|
|
98
|
+
data_source_file_path: str = None,
|
|
99
|
+
number_of_missing_data_points: int = None,
|
|
100
|
+
total_number_of_data_points: int = None,
|
|
101
|
+
) -> None:
|
|
96
102
|
super(DataError, self).__init__(message)
|
|
97
103
|
self.error_message = message
|
|
104
|
+
self.data_source_file_path = data_source_file_path
|
|
105
|
+
self.number_of_missing_data_points = number_of_missing_data_points
|
|
106
|
+
self.total_number_of_data_points = total_number_of_data_points
|
|
98
107
|
|
|
99
108
|
def to_response(self):
|
|
100
109
|
return {
|
|
@@ -179,3 +179,36 @@ class DataSource:
|
|
|
179
179
|
(self.window_size * timedelta(
|
|
180
180
|
minutes=self.time_frame.amount_of_minutes
|
|
181
181
|
))
|
|
182
|
+
|
|
183
|
+
def get_number_of_required_data_points(
|
|
184
|
+
self, start_date: datetime, end_date: datetime
|
|
185
|
+
) -> int:
|
|
186
|
+
"""
|
|
187
|
+
Returns the number of data points required based on the given
|
|
188
|
+
attributes of the data source. If the required number of data points
|
|
189
|
+
can't be determined, it returns None.
|
|
190
|
+
|
|
191
|
+
E.g., for OHLCV data source, it
|
|
192
|
+
calculates the number of data points needed between the
|
|
193
|
+
start_date and end_date based on the time frame.
|
|
194
|
+
|
|
195
|
+
Args:
|
|
196
|
+
start_date (datetime): The start date for the data points.
|
|
197
|
+
end_date (datetime): The end date for the data points.
|
|
198
|
+
|
|
199
|
+
Returns:
|
|
200
|
+
int: The number of required data points, or None if it can't
|
|
201
|
+
be determined.
|
|
202
|
+
"""
|
|
203
|
+
|
|
204
|
+
if self.time_frame is None:
|
|
205
|
+
return None
|
|
206
|
+
|
|
207
|
+
delta = end_date - start_date
|
|
208
|
+
total_minutes = delta.total_seconds() / 60
|
|
209
|
+
data_points = total_minutes / self.time_frame.amount_of_minutes
|
|
210
|
+
|
|
211
|
+
if self.window_size is not None:
|
|
212
|
+
data_points += self.window_size
|
|
213
|
+
|
|
214
|
+
return int(data_points)
|
|
@@ -6,6 +6,7 @@ def convert_polars_to_pandas(
|
|
|
6
6
|
data: PolarsDataFrame,
|
|
7
7
|
remove_duplicates=True,
|
|
8
8
|
add_index=True,
|
|
9
|
+
add_datetime_column=True,
|
|
9
10
|
datetime_column_name="Datetime"
|
|
10
11
|
):
|
|
11
12
|
"""
|
|
@@ -21,6 +22,8 @@ def convert_polars_to_pandas(
|
|
|
21
22
|
dates will be removed from the dataframe
|
|
22
23
|
add_index: Boolean - If set to true, an index will
|
|
23
24
|
be added to the dataframe
|
|
25
|
+
add_datetime_column: Boolean - If set to true, a datetime
|
|
26
|
+
column will be added to the dataframe
|
|
24
27
|
datetime_column_name: String - the column name that has the
|
|
25
28
|
datetime object. By default this is set to column name Datetime
|
|
26
29
|
This is only used if add_index is set to True
|
|
@@ -35,6 +38,9 @@ def convert_polars_to_pandas(
|
|
|
35
38
|
|
|
36
39
|
df = data.to_pandas().copy()
|
|
37
40
|
|
|
41
|
+
if add_datetime_column and datetime_column_name not in df.columns:
|
|
42
|
+
df[datetime_column_name] = pd.to_datetime(df.index)
|
|
43
|
+
|
|
38
44
|
# Ensure datetime column is datetime type
|
|
39
45
|
df[datetime_column_name] = pd.to_datetime(df[datetime_column_name])
|
|
40
46
|
|
|
@@ -2,7 +2,7 @@ import logging
|
|
|
2
2
|
import os.path
|
|
3
3
|
from datetime import datetime, timedelta, timezone
|
|
4
4
|
from time import sleep
|
|
5
|
-
from typing import Union
|
|
5
|
+
from typing import Union, List
|
|
6
6
|
|
|
7
7
|
import ccxt
|
|
8
8
|
import pandas as pd
|
|
@@ -99,6 +99,9 @@ class CCXTOHLCVDataProvider(DataProvider):
|
|
|
99
99
|
self.pandas = pandas
|
|
100
100
|
self.window_cache = {}
|
|
101
101
|
self.data = None
|
|
102
|
+
self.total_number_of_data_points = 0
|
|
103
|
+
self.missing_data_point_dates = []
|
|
104
|
+
self.data_file_path = None
|
|
102
105
|
|
|
103
106
|
def has_data(
|
|
104
107
|
self,
|
|
@@ -235,6 +238,14 @@ class CCXTOHLCVDataProvider(DataProvider):
|
|
|
235
238
|
self.data = data
|
|
236
239
|
self._start_date_data_source = self.data["Datetime"].min()
|
|
237
240
|
self._end_date_data_source = self.data["Datetime"].max()
|
|
241
|
+
self.total_number_of_data_points = len(self.data)
|
|
242
|
+
|
|
243
|
+
if required_start_date < self._start_date_data_source:
|
|
244
|
+
self.number_of_missing_data_points = (
|
|
245
|
+
self._start_date_data_source - required_start_date
|
|
246
|
+
).total_seconds() / (
|
|
247
|
+
TimeFrame.from_value(self.time_frame).amount_of_minutes * 60
|
|
248
|
+
)
|
|
238
249
|
|
|
239
250
|
if self.window_size is not None:
|
|
240
251
|
# Create cache with sliding windows
|
|
@@ -246,6 +257,22 @@ class CCXTOHLCVDataProvider(DataProvider):
|
|
|
246
257
|
end_date=backtest_end_date
|
|
247
258
|
)
|
|
248
259
|
|
|
260
|
+
n_min = TimeFrame.from_value(self.time_frame).amount_of_minutes
|
|
261
|
+
# Assume self.data is a Polars DataFrame with a "Datetime" column
|
|
262
|
+
expected_dates = pl.datetime_range(
|
|
263
|
+
start=required_start_date,
|
|
264
|
+
end=backtest_end_date,
|
|
265
|
+
interval=f"{n_min}m",
|
|
266
|
+
eager=True
|
|
267
|
+
).to_list()
|
|
268
|
+
|
|
269
|
+
actual_dates = self.data["Datetime"].to_list()
|
|
270
|
+
|
|
271
|
+
# Find missing dates
|
|
272
|
+
self.missing_data_point_dates = sorted(
|
|
273
|
+
set(expected_dates) - set(actual_dates)
|
|
274
|
+
)
|
|
275
|
+
|
|
249
276
|
def get_data(
|
|
250
277
|
self,
|
|
251
278
|
date: datetime = None,
|
|
@@ -418,7 +445,7 @@ class CCXTOHLCVDataProvider(DataProvider):
|
|
|
418
445
|
f"the available data "
|
|
419
446
|
f"{self._start_date_data_source} "
|
|
420
447
|
f"- {self._end_date_data_source}."
|
|
421
|
-
f" for data source {data_source.identifier}."
|
|
448
|
+
f" for data source {data_source.identifier}.",
|
|
422
449
|
)
|
|
423
450
|
|
|
424
451
|
raise OperationalException(
|
|
@@ -426,7 +453,7 @@ class CCXTOHLCVDataProvider(DataProvider):
|
|
|
426
453
|
f"is before the range of "
|
|
427
454
|
f"the available data "
|
|
428
455
|
f"{self._start_date_data_source} "
|
|
429
|
-
f"- {self._end_date_data_source}."
|
|
456
|
+
f"- {self._end_date_data_source}.",
|
|
430
457
|
)
|
|
431
458
|
|
|
432
459
|
if backtest_end_date > self._end_date_data_source:
|
|
@@ -820,6 +847,7 @@ class CCXTOHLCVDataProvider(DataProvider):
|
|
|
820
847
|
# If the data source specification matches,
|
|
821
848
|
# read the file
|
|
822
849
|
file_path = os.path.join(storage_path, file_name)
|
|
850
|
+
self.data_file_path = file_path
|
|
823
851
|
data = pl.read_csv(
|
|
824
852
|
file_path,
|
|
825
853
|
schema_overrides={"Datetime": pl.Datetime},
|
|
@@ -1025,3 +1053,60 @@ class CCXTOHLCVDataProvider(DataProvider):
|
|
|
1025
1053
|
config=self.config,
|
|
1026
1054
|
pandas=data_source.pandas,
|
|
1027
1055
|
)
|
|
1056
|
+
|
|
1057
|
+
def get_number_of_data_points(
|
|
1058
|
+
self,
|
|
1059
|
+
start_date: datetime,
|
|
1060
|
+
end_date: datetime
|
|
1061
|
+
) -> int:
|
|
1062
|
+
|
|
1063
|
+
"""
|
|
1064
|
+
Returns the number of data points available between the given
|
|
1065
|
+
start and end dates.
|
|
1066
|
+
|
|
1067
|
+
Args:
|
|
1068
|
+
start_date (datetime): The start date for checking missing data.
|
|
1069
|
+
end_date (datetime): The end date for checking missing data.
|
|
1070
|
+
|
|
1071
|
+
Returns:
|
|
1072
|
+
int: The number of available data points between the given
|
|
1073
|
+
start and end dates.
|
|
1074
|
+
"""
|
|
1075
|
+
available_dates = [
|
|
1076
|
+
date for date in self.data["Datetime"].to_list()
|
|
1077
|
+
if start_date <= date <= end_date
|
|
1078
|
+
]
|
|
1079
|
+
return len(available_dates)
|
|
1080
|
+
|
|
1081
|
+
def get_missing_data_dates(
|
|
1082
|
+
self,
|
|
1083
|
+
start_date: datetime,
|
|
1084
|
+
end_date: datetime,
|
|
1085
|
+
) -> List[datetime]:
|
|
1086
|
+
"""
|
|
1087
|
+
Returns a list of dates for which data is missing between the
|
|
1088
|
+
given start and end dates.
|
|
1089
|
+
|
|
1090
|
+
Args:
|
|
1091
|
+
start_date (datetime): The start date for checking missing data.
|
|
1092
|
+
end_date (datetime): The end date for checking missing data.
|
|
1093
|
+
|
|
1094
|
+
Returns:
|
|
1095
|
+
List[datetime]: A list of dates for which data is missing
|
|
1096
|
+
between the given start and end dates.
|
|
1097
|
+
"""
|
|
1098
|
+
missing_dates = [
|
|
1099
|
+
date for date in self.missing_data_point_dates
|
|
1100
|
+
if start_date < date < end_date
|
|
1101
|
+
]
|
|
1102
|
+
return missing_dates
|
|
1103
|
+
|
|
1104
|
+
def get_data_source_file_path(self) -> Union[str, None]:
|
|
1105
|
+
"""
|
|
1106
|
+
Get the file path of the data source if stored in local storage.
|
|
1107
|
+
|
|
1108
|
+
Returns:
|
|
1109
|
+
Union[str, None]: The file path of the data source if stored
|
|
1110
|
+
locally, otherwise None.
|
|
1111
|
+
"""
|
|
1112
|
+
return self.data_file_path
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from typing import List, Union
|
|
1
2
|
from datetime import datetime, timezone, timedelta
|
|
2
3
|
|
|
3
4
|
import polars as pl
|
|
@@ -67,6 +68,8 @@ class CSVOHLCVDataProvider(DataProvider):
|
|
|
67
68
|
self.window_cache = {}
|
|
68
69
|
self._load_data(self.storage_path)
|
|
69
70
|
self.pandas = pandas
|
|
71
|
+
self.number_of_missing_data_points = 0
|
|
72
|
+
self.missing_data_point_dates: List[datetime] = []
|
|
70
73
|
|
|
71
74
|
def has_data(
|
|
72
75
|
self,
|
|
@@ -212,8 +215,6 @@ class CSVOHLCVDataProvider(DataProvider):
|
|
|
212
215
|
Prepares backtest data for a given symbol and date range.
|
|
213
216
|
|
|
214
217
|
Args:
|
|
215
|
-
data_source (DataSource): The data source specification that
|
|
216
|
-
matches a data provider.
|
|
217
218
|
backtest_start_date (datetime): The start date for the
|
|
218
219
|
backtest data.
|
|
219
220
|
backtest_end_date (datetime): The end date for the
|
|
@@ -248,14 +249,6 @@ class CSVOHLCVDataProvider(DataProvider):
|
|
|
248
249
|
.amount_of_minutes * self.window_size
|
|
249
250
|
)
|
|
250
251
|
|
|
251
|
-
if required_start_date < self._start_date_data_source:
|
|
252
|
-
raise OperationalException(
|
|
253
|
-
f"Not enough data available for backtest. "
|
|
254
|
-
f"Data earlier then {required_start_date} is "
|
|
255
|
-
"required, but only "
|
|
256
|
-
f"{self._start_date_data_source} is available."
|
|
257
|
-
)
|
|
258
|
-
|
|
259
252
|
# Create cache with sliding windows
|
|
260
253
|
self._precompute_sliding_windows(
|
|
261
254
|
window_size=self.window_size,
|
|
@@ -263,6 +256,30 @@ class CSVOHLCVDataProvider(DataProvider):
|
|
|
263
256
|
end_date=backtest_end_date
|
|
264
257
|
)
|
|
265
258
|
|
|
259
|
+
if required_start_date < self._start_date_data_source:
|
|
260
|
+
self.number_of_missing_data_points = (
|
|
261
|
+
self._start_date_data_source - required_start_date
|
|
262
|
+
).total_seconds() / (
|
|
263
|
+
TimeFrame.from_value(self.time_frame).amount_of_minutes * 60
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
n_min = TimeFrame.from_value(self.time_frame).amount_of_minutes
|
|
267
|
+
|
|
268
|
+
# Assume self.data is a Polars DataFrame with a "Datetime" column
|
|
269
|
+
expected_dates = pl.datetime_range(
|
|
270
|
+
start=required_start_date,
|
|
271
|
+
end=backtest_end_date,
|
|
272
|
+
interval=f"{n_min}m",
|
|
273
|
+
eager=True
|
|
274
|
+
).to_list()
|
|
275
|
+
|
|
276
|
+
actual_dates = self.data["Datetime"].to_list()
|
|
277
|
+
|
|
278
|
+
# Find missing dates
|
|
279
|
+
self.missing_data_point_dates = sorted(
|
|
280
|
+
set(expected_dates) - set(actual_dates)
|
|
281
|
+
)
|
|
282
|
+
|
|
266
283
|
def get_backtest_data(
|
|
267
284
|
self,
|
|
268
285
|
backtest_index_date: datetime,
|
|
@@ -492,3 +509,60 @@ class CSVOHLCVDataProvider(DataProvider):
|
|
|
492
509
|
window_size=data_source.window_size,
|
|
493
510
|
data_provider_identifier=self.data_provider_identifier
|
|
494
511
|
)
|
|
512
|
+
|
|
513
|
+
def get_number_of_data_points(
|
|
514
|
+
self,
|
|
515
|
+
start_date: datetime,
|
|
516
|
+
end_date: datetime
|
|
517
|
+
) -> int:
|
|
518
|
+
|
|
519
|
+
"""
|
|
520
|
+
Returns the number of data points available between the given
|
|
521
|
+
start and end dates.
|
|
522
|
+
|
|
523
|
+
Args:
|
|
524
|
+
start_date (datetime): The start date for checking missing data.
|
|
525
|
+
end_date (datetime): The end date for checking missing data.
|
|
526
|
+
|
|
527
|
+
Returns:
|
|
528
|
+
int: The number of available data points between the given
|
|
529
|
+
start and end dates.
|
|
530
|
+
"""
|
|
531
|
+
available_dates = [
|
|
532
|
+
date for date in self.data["Datetime"].to_list()
|
|
533
|
+
if start_date <= date <= end_date
|
|
534
|
+
]
|
|
535
|
+
return len(available_dates)
|
|
536
|
+
|
|
537
|
+
def get_missing_data_dates(
|
|
538
|
+
self,
|
|
539
|
+
start_date: datetime,
|
|
540
|
+
end_date: datetime,
|
|
541
|
+
) -> List[datetime]:
|
|
542
|
+
"""
|
|
543
|
+
Returns a list of dates for which data is missing between the
|
|
544
|
+
given start and end dates.
|
|
545
|
+
|
|
546
|
+
Args:
|
|
547
|
+
start_date (datetime): The start date for checking missing data.
|
|
548
|
+
end_date (datetime): The end date for checking missing data.
|
|
549
|
+
|
|
550
|
+
Returns:
|
|
551
|
+
List[datetime]: A list of dates for which data is missing
|
|
552
|
+
between the given start and end dates.
|
|
553
|
+
"""
|
|
554
|
+
missing_dates = [
|
|
555
|
+
date for date in self.missing_data_point_dates
|
|
556
|
+
if start_date < date < end_date
|
|
557
|
+
]
|
|
558
|
+
return missing_dates
|
|
559
|
+
|
|
560
|
+
def get_data_source_file_path(self) -> Union[str, None]:
|
|
561
|
+
"""
|
|
562
|
+
Get the file path of the data source if stored in local storage.
|
|
563
|
+
|
|
564
|
+
Returns:
|
|
565
|
+
Union[str, None]: The file path of the data source if stored
|
|
566
|
+
locally, otherwise None.
|
|
567
|
+
"""
|
|
568
|
+
return self.storage_path
|