investing-algorithm-framework 9.0.0a2__tar.gz → 9.0.0a4__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.
Files changed (369) hide show
  1. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/PKG-INFO +34 -15
  2. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/README.md +22 -5
  3. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/__init__.py +12 -1
  4. investing_algorithm_framework-9.0.0a4/investing_algorithm_framework/app/algorithm_runner.py +236 -0
  5. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/app.py +533 -1779
  6. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/context.py +26 -0
  7. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/eventloop.py +139 -42
  8. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/charts/__init__.py +0 -2
  9. investing_algorithm_framework-9.0.0a4/investing_algorithm_framework/app/reporting/charts/_finterion_render.py +71 -0
  10. investing_algorithm_framework-9.0.0a4/investing_algorithm_framework/app/reporting/charts/entry_exist_signals.py +54 -0
  11. investing_algorithm_framework-9.0.0a4/investing_algorithm_framework/app/reporting/charts/equity_curve.py +38 -0
  12. investing_algorithm_framework-9.0.0a4/investing_algorithm_framework/app/reporting/charts/equity_curve_drawdown.py +51 -0
  13. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/charts/monthly_returns_heatmap.py +15 -35
  14. investing_algorithm_framework-9.0.0a4/investing_algorithm_framework/app/reporting/charts/ohlcv_data_completeness.py +45 -0
  15. investing_algorithm_framework-9.0.0a4/investing_algorithm_framework/app/reporting/charts/rolling_sharp_ratio.py +49 -0
  16. investing_algorithm_framework-9.0.0a4/investing_algorithm_framework/app/reporting/charts/yearly_returns_barchart.py +40 -0
  17. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/controllers/__init__.py +6 -0
  18. investing_algorithm_framework-9.0.0a4/investing_algorithm_framework/app/web/controllers/algorithm.py +155 -0
  19. investing_algorithm_framework-9.0.0a4/investing_algorithm_framework/app/web/controllers/trades.py +28 -0
  20. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/schemas/__init__.py +3 -0
  21. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/schemas/backtest_result.py +2 -0
  22. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/schemas/order.py +1 -0
  23. investing_algorithm_framework-9.0.0a4/investing_algorithm_framework/app/web/schemas/trade.py +21 -0
  24. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/cli.py +9 -3
  25. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/deploy_to_aws_lambda.py +10 -1
  26. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/deploy_to_azure_function.py +16 -4
  27. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/app_aws_lambda_function.py.template +23 -1
  28. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/azure_function_function_app.py.template +43 -0
  29. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/strategy.py.template +43 -14
  30. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/dependency_container.py +5 -0
  31. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/data/data_source.py +12 -19
  32. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/order/order.py +11 -0
  33. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/trade/trade.py +16 -0
  34. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/data_providers/ccxt.py +315 -260
  35. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/data_providers/csv.py +8 -1
  36. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/data_providers/ohlcv_base.py +5 -2
  37. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/database/sql_alchemy.py +5 -0
  38. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/order/order.py +2 -0
  39. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/trades/trade.py +12 -0
  40. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/services/aws/state_handler.py +12 -2
  41. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/services/azure/state_handler.py +4 -1
  42. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/services/backtesting/backtest_service.py +13 -36
  43. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/services/backtesting/event_backtest_service.py +12 -31
  44. investing_algorithm_framework-9.0.0a4/investing_algorithm_framework/infrastructure/services/backtesting/schedule_generation.py +75 -0
  45. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/services/backtesting/vector_backtest_service.py +2 -0
  46. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/notebook/magic.py +50 -30
  47. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/data_providers/data_provider_service.py +11 -5
  48. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/trade_order_evaluator/backtest_trade_oder_evaluator.py +6 -3
  49. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/trade_order_evaluator/default_trade_order_evaluator.py +7 -2
  50. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/trade_order_evaluator/trade_order_evaluator.py +13 -8
  51. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/trade_service/trade_service.py +6 -2
  52. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/pyproject.toml +15 -13
  53. investing_algorithm_framework-9.0.0a2/investing_algorithm_framework/app/reporting/backtest_report_old.py +0 -352
  54. investing_algorithm_framework-9.0.0a2/investing_algorithm_framework/app/reporting/charts/entry_exist_signals.py +0 -66
  55. investing_algorithm_framework-9.0.0a2/investing_algorithm_framework/app/reporting/charts/equity_curve.py +0 -37
  56. investing_algorithm_framework-9.0.0a2/investing_algorithm_framework/app/reporting/charts/equity_curve_drawdown.py +0 -74
  57. investing_algorithm_framework-9.0.0a2/investing_algorithm_framework/app/reporting/charts/line_chart.py +0 -11
  58. investing_algorithm_framework-9.0.0a2/investing_algorithm_framework/app/reporting/charts/ohlcv_data_completeness.py +0 -51
  59. investing_algorithm_framework-9.0.0a2/investing_algorithm_framework/app/reporting/charts/rolling_sharp_ratio.py +0 -79
  60. investing_algorithm_framework-9.0.0a2/investing_algorithm_framework/app/reporting/charts/yearly_returns_barchart.py +0 -55
  61. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/LICENSE +0 -0
  62. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/analysis/__init__.py +0 -0
  63. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/analysis/backtest_data_ranges.py +0 -0
  64. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/analysis/backtest_window_analysis.py +0 -0
  65. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/analysis/bundle_inspection.py +0 -0
  66. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/analysis/markdown.py +0 -0
  67. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/analysis/ranking.py +0 -0
  68. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/analysis/robustness.py +0 -0
  69. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/analysis/top_selection.py +0 -0
  70. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/__init__.py +0 -0
  71. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/algorithm/__init__.py +0 -0
  72. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/algorithm/algorithm.py +0 -0
  73. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/algorithm/algorithm_factory.py +0 -0
  74. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/app_hook.py +0 -0
  75. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/__init__.py +0 -0
  76. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/ascii.py +0 -0
  77. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/backtest_report.py +0 -0
  78. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/generate.py +0 -0
  79. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/tables/__init__.py +0 -0
  80. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/tables/key_metrics_table.py +0 -0
  81. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/tables/stop_loss_table.py +0 -0
  82. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/tables/time_metrics_table.py +0 -0
  83. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/tables/trade_metrics_table.py +0 -0
  84. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/tables/trades_table.py +0 -0
  85. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/tables/utils.py +0 -0
  86. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/templates/dashboard.css +0 -0
  87. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/templates/dashboard.js +0 -0
  88. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/templates/dashboard_template.html.j2 +0 -0
  89. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/reporting/templates/report_template.html.j2 +0 -0
  90. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/stateless/__init__.py +0 -0
  91. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/stateless/action_handlers/__init__.py +0 -0
  92. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/stateless/action_handlers/action_handler_strategy.py +0 -0
  93. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/stateless/action_handlers/check_online_handler.py +0 -0
  94. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/stateless/action_handlers/run_strategy_handler.py +0 -0
  95. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/stateless/exception_handler.py +0 -0
  96. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/strategy.py +0 -0
  97. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/task.py +0 -0
  98. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/__init__.py +0 -0
  99. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/controllers/backtest_results.py +0 -0
  100. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/controllers/orders.py +0 -0
  101. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/controllers/portfolio.py +0 -0
  102. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/controllers/positions.py +0 -0
  103. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/create_app.py +0 -0
  104. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/error_handler.py +0 -0
  105. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/responses.py +0 -0
  106. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/run_strategies.py +0 -0
  107. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/schemas/portfolio.py +0 -0
  108. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/schemas/position.py +0 -0
  109. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/app/web/setup_cors.py +0 -0
  110. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/__init__.py +0 -0
  111. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/index_command.py +0 -0
  112. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/initialize_app.py +0 -0
  113. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/mcp_server.py +0 -0
  114. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/migrate_store_command.py +0 -0
  115. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/.gitignore.template +0 -0
  116. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/app.py.template +0 -0
  117. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/app_azure_function.py.template +0 -0
  118. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/app_web.py.template +0 -0
  119. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/aws_lambda_dockerfile.template +0 -0
  120. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/aws_lambda_dockerignore.template +0 -0
  121. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/aws_lambda_readme.md.template +0 -0
  122. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/aws_lambda_requirements.txt.template +0 -0
  123. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/azure_function_host.json.template +0 -0
  124. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/azure_function_local.settings.json.template +0 -0
  125. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/azure_function_requirements.txt.template +0 -0
  126. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/data_providers.py.template +0 -0
  127. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/env.example.template +0 -0
  128. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/env_azure_function.example.template +0 -0
  129. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/market_data_providers.py.template +0 -0
  130. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/readme.md.template +0 -0
  131. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/requirements.txt.template +0 -0
  132. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/templates/run_backtest.py.template +0 -0
  133. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/cli/validate_backtest_checkpoints.py +0 -0
  134. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/create_app.py +0 -0
  135. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/__init__.py +0 -0
  136. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/algorithm_id.py +0 -0
  137. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/__init__.py +0 -0
  138. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/backtest.py +0 -0
  139. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/backtest_date_range.py +0 -0
  140. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/backtest_engine.py +0 -0
  141. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/backtest_evaluation_focuss.py +0 -0
  142. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/backtest_index_row.py +0 -0
  143. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/backtest_metrics.py +0 -0
  144. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/backtest_monte_carlo_test.py +0 -0
  145. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/backtest_run.py +0 -0
  146. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/backtest_summary_metrics.py +0 -0
  147. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/backtest_utils.py +0 -0
  148. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/backtest_window.py +0 -0
  149. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/bundle.py +0 -0
  150. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/combine_backtests.py +0 -0
  151. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/consistency.py +0 -0
  152. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/execution_config.py +0 -0
  153. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/study.py +0 -0
  154. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/templates/backtest.html +0 -0
  155. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/templates/finterion-dark.png +0 -0
  156. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/templates/finterion-light.png +0 -0
  157. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/backtesting/universe.py +0 -0
  158. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/blotter.py +0 -0
  159. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/config.py +0 -0
  160. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/constants.py +0 -0
  161. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/data_provider.py +0 -0
  162. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/data_structures.py +0 -0
  163. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/datetime_parsing.py +0 -0
  164. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/decimal_parsing.py +0 -0
  165. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/exceptions.py +0 -0
  166. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/fx.py +0 -0
  167. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/__init__.py +0 -0
  168. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/app_mode.py +0 -0
  169. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/base_model.py +0 -0
  170. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/conflict_policy.py +0 -0
  171. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/data/__init__.py +0 -0
  172. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/data/data_type.py +0 -0
  173. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/event.py +0 -0
  174. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/market/__init__.py +0 -0
  175. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/market/market_credential.py +0 -0
  176. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/order/__init__.py +0 -0
  177. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/order/order_side.py +0 -0
  178. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/order/order_status.py +0 -0
  179. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/order/order_type.py +0 -0
  180. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/portfolio/__init__.py +0 -0
  181. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/portfolio/portfolio.py +0 -0
  182. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/portfolio/portfolio_configuration.py +0 -0
  183. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/portfolio/portfolio_snapshot.py +0 -0
  184. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/portfolio/sync.py +0 -0
  185. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/position/__init__.py +0 -0
  186. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/position/position.py +0 -0
  187. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/position/position_size.py +0 -0
  188. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/position/position_snapshot.py +0 -0
  189. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/risk_rules/__init__.py +0 -0
  190. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/risk_rules/cooldown_rule.py +0 -0
  191. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/risk_rules/scaling_rule.py +0 -0
  192. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/risk_rules/stop_loss_rule.py +0 -0
  193. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/risk_rules/take_profit_rule.py +0 -0
  194. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/risk_rules/trading_cost.py +0 -0
  195. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/scheduling/__init__.py +0 -0
  196. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/scheduling/date_rule.py +0 -0
  197. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/scheduling/schedule.py +0 -0
  198. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/scheduling/scheduled_function.py +0 -0
  199. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/scheduling/time_rule.py +0 -0
  200. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/signal.py +0 -0
  201. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/signal_helpers.py +0 -0
  202. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/signal_series.py +0 -0
  203. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/snapshot_interval.py +0 -0
  204. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/strategy_profile.py +0 -0
  205. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/time_frame.py +0 -0
  206. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/time_interval.py +0 -0
  207. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/time_unit.py +0 -0
  208. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/tracing/__init__.py +0 -0
  209. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/tracing/trace.py +0 -0
  210. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/trade/__init__.py +0 -0
  211. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/trade/trade_status.py +0 -0
  212. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/trade/trade_stop_loss.py +0 -0
  213. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/models/trade/trade_take_profit.py +0 -0
  214. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/order_executor.py +0 -0
  215. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/pipeline/__init__.py +0 -0
  216. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/pipeline/custom_factor.py +0 -0
  217. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/pipeline/factor.py +0 -0
  218. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/pipeline/factors/__init__.py +0 -0
  219. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/pipeline/factors/builtin.py +0 -0
  220. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/pipeline/filter.py +0 -0
  221. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/pipeline/pipeline.py +0 -0
  222. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/portfolio_provider.py +0 -0
  223. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/services/__init__.py +0 -0
  224. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/services/market_credential_service.py +0 -0
  225. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/services/portfolios/__init__.py +0 -0
  226. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/services/portfolios/portfolio_sync_service.py +0 -0
  227. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/services/rounding_service.py +0 -0
  228. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/services/state_handler.py +0 -0
  229. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/stateless_actions.py +0 -0
  230. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/strategy.py +0 -0
  231. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/utils/__init__.py +0 -0
  232. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/utils/csv.py +0 -0
  233. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/utils/custom_tqdm.py +0 -0
  234. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/utils/dates.py +0 -0
  235. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/utils/jupyter_notebook_detection.py +0 -0
  236. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/utils/polars.py +0 -0
  237. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/utils/random.py +0 -0
  238. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/utils/signatures.py +0 -0
  239. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/utils/stoppable_thread.py +0 -0
  240. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/domain/utils/synchronized.py +0 -0
  241. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/download_data.py +0 -0
  242. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/__init__.py +0 -0
  243. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/data_providers/__init__.py +0 -0
  244. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/data_providers/alpha_vantage.py +0 -0
  245. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/data_providers/base_url.py +0 -0
  246. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/data_providers/csv_url.py +0 -0
  247. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/data_providers/json_url.py +0 -0
  248. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/data_providers/pandas.py +0 -0
  249. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/data_providers/parquet_url.py +0 -0
  250. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/data_providers/polygon.py +0 -0
  251. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/data_providers/yahoo.py +0 -0
  252. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/database/__init__.py +0 -0
  253. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/__init__.py +0 -0
  254. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/decimal_parser.py +0 -0
  255. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/model_extension.py +0 -0
  256. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/order/__init__.py +0 -0
  257. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/order/trade_allocation.py +0 -0
  258. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/order_trade_association.py +0 -0
  259. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/portfolio/__init__.py +0 -0
  260. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/portfolio/portfolio_snapshot.py +0 -0
  261. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/portfolio/sql_portfolio.py +0 -0
  262. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/position/__init__.py +0 -0
  263. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/position/position.py +0 -0
  264. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/position/position_snapshot.py +0 -0
  265. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/trades/__init__.py +0 -0
  266. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/trades/trade_stop_loss.py +0 -0
  267. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/models/trades/trade_take_profit.py +0 -0
  268. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/order_executors/__init__.py +0 -0
  269. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/order_executors/ccxt_order_executor.py +0 -0
  270. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/portfolio_providers/__init__.py +0 -0
  271. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/portfolio_providers/ccxt_portfolio_provider.py +0 -0
  272. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/repositories/__init__.py +0 -0
  273. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/repositories/order_repository.py +0 -0
  274. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/repositories/portfolio_repository.py +0 -0
  275. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/repositories/portfolio_snapshot_repository.py +0 -0
  276. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/repositories/position_repository.py +0 -0
  277. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/repositories/position_snapshot_repository.py +0 -0
  278. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/repositories/repository.py +0 -0
  279. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/repositories/trade_allocation_repository.py +0 -0
  280. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/repositories/trade_repository.py +0 -0
  281. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/repositories/trade_stop_loss_repository.py +0 -0
  282. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/repositories/trade_take_profit_repository.py +0 -0
  283. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/services/__init__.py +0 -0
  284. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/services/aws/__init__.py +0 -0
  285. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/services/azure/__init__.py +0 -0
  286. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/services/backtesting/__init__.py +0 -0
  287. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/infrastructure/services/backtesting/checkpoint_manifest.py +0 -0
  288. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/notebook/__init__.py +0 -0
  289. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/__init__.py +0 -0
  290. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/backtest_index/__init__.py +0 -0
  291. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/backtest_index/sqlite_index.py +0 -0
  292. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/backtest_store/__init__.py +0 -0
  293. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/backtest_store/base.py +0 -0
  294. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/backtest_store/decompose.py +0 -0
  295. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/backtest_store/local_dir_store.py +0 -0
  296. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/backtest_store/local_tiered_store.py +0 -0
  297. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/configuration_service.py +0 -0
  298. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/data_providers/__init__.py +0 -0
  299. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/data_providers/data.py +0 -0
  300. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/executors/__init__.py +0 -0
  301. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/executors/base.py +0 -0
  302. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/executors/limit.py +0 -0
  303. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/executors/market.py +0 -0
  304. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/market_credential_service.py +0 -0
  305. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/__init__.py +0 -0
  306. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/_returns_helper.py +0 -0
  307. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/alpha.py +0 -0
  308. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/beta.py +0 -0
  309. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/cagr.py +0 -0
  310. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/calmar_ratio.py +0 -0
  311. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/consistency.py +0 -0
  312. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/drawdown.py +0 -0
  313. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/equity_curve.py +0 -0
  314. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/exposure.py +0 -0
  315. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/generate.py +0 -0
  316. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/mae_mfe.py +0 -0
  317. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/mean_daily_return.py +0 -0
  318. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/omega_ratio.py +0 -0
  319. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/price_efficiency.py +0 -0
  320. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/profit_factor.py +0 -0
  321. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/recovery.py +0 -0
  322. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/returns.py +0 -0
  323. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/risk_free_rate.py +0 -0
  324. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/sharpe_ratio.py +0 -0
  325. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/sortino_ratio.py +0 -0
  326. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/standard_deviation.py +0 -0
  327. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/trades.py +0 -0
  328. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/treynor_ratio.py +0 -0
  329. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/ulcer.py +0 -0
  330. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/value_at_risk.py +0 -0
  331. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/volatility.py +0 -0
  332. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/metrics/win_rate.py +0 -0
  333. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/order_service/__init__.py +0 -0
  334. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/order_service/order_backtest_service.py +0 -0
  335. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/order_service/order_executor_lookup.py +0 -0
  336. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/order_service/order_service.py +0 -0
  337. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/pipeline/__init__.py +0 -0
  338. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/pipeline/pipeline_engine.py +0 -0
  339. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/pipeline/vector_pipeline_engine.py +0 -0
  340. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/portfolios/__init__.py +0 -0
  341. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/portfolios/backtest_portfolio_service.py +0 -0
  342. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/portfolios/broker_balance_tracker.py +0 -0
  343. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/portfolios/portfolio_configuration_service.py +0 -0
  344. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/portfolios/portfolio_provider_lookup.py +0 -0
  345. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/portfolios/portfolio_service.py +0 -0
  346. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/portfolios/portfolio_snapshot_service.py +0 -0
  347. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/portfolios/portfolio_sync_service.py +0 -0
  348. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/positions/__init__.py +0 -0
  349. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/positions/position_service.py +0 -0
  350. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/positions/position_snapshot_service.py +0 -0
  351. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/repository_service.py +0 -0
  352. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/strategy_phases/__init__.py +0 -0
  353. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/strategy_phases/apply_risk_budget.py +0 -0
  354. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/strategy_phases/attach_risk_rules.py +0 -0
  355. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/strategy_phases/base.py +0 -0
  356. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/strategy_phases/collect_signals.py +0 -0
  357. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/strategy_phases/default.py +0 -0
  358. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/strategy_phases/emit_orders.py +0 -0
  359. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/strategy_phases/evaluate_pipelines.py +0 -0
  360. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/strategy_phases/phase_state.py +0 -0
  361. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/strategy_phases/record_cooldown.py +0 -0
  362. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/strategy_phases/resolve_conflicts.py +0 -0
  363. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/strategy_phases/size_positions.py +0 -0
  364. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/trade_hooks/__init__.py +0 -0
  365. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/trade_hooks/trade_hook_dispatcher.py +0 -0
  366. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/trade_order_evaluator/__init__.py +0 -0
  367. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/trade_service/__init__.py +0 -0
  368. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/trade_service/trade_stop_loss_service.py +0 -0
  369. {investing_algorithm_framework-9.0.0a2 → investing_algorithm_framework-9.0.0a4}/investing_algorithm_framework/services/trade_service/trade_take_profit_service.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: investing-algorithm-framework
3
- Version: 9.0.0a2
3
+ Version: 9.0.0a4
4
4
  Summary: A framework for creating trading bots
5
5
  Author: MDUYN
6
6
  Requires-Python: >=3.10,<4.0
@@ -10,25 +10,27 @@ Classifier: Programming Language :: Python :: 3.11
10
10
  Classifier: Programming Language :: Python :: 3.12
11
11
  Provides-Extra: all
12
12
  Provides-Extra: alpha-vantage
13
+ Provides-Extra: aws
14
+ Provides-Extra: azure
15
+ Provides-Extra: notebook
13
16
  Provides-Extra: polygon
14
17
  Provides-Extra: yahoo
15
18
  Requires-Dist: Flask (>=3.1.0)
16
19
  Requires-Dist: Flask-Cors (>=3.0.9,<7.0.0)
17
- Requires-Dist: Flask-Migrate (>=2.6.0)
18
20
  Requires-Dist: SQLAlchemy (>=2.0.18)
19
21
  Requires-Dist: alpha_vantage (>=3.0.0,<4.0.0) ; extra == "alpha-vantage" or extra == "all"
20
- Requires-Dist: azure-identity (>=1.19.0,<2.0.0)
21
- Requires-Dist: azure-mgmt-resource (>=23.2.0,<24.0.0)
22
- Requires-Dist: azure-mgmt-storage (>=21.2.1,<22.0.0)
23
- Requires-Dist: azure-mgmt-web (>=7.3.1,<8.0.0)
24
- Requires-Dist: azure-storage-blob (>=12.24.0,<13.0.0)
25
- Requires-Dist: boto3 (>=1.38.41,<2.0.0)
22
+ Requires-Dist: azure-identity (>=1.19.0,<2.0.0) ; extra == "azure" or extra == "all"
23
+ Requires-Dist: azure-mgmt-resource (>=23.2.0,<24.0.0) ; extra == "azure" or extra == "all"
24
+ Requires-Dist: azure-mgmt-storage (>=21.2.1,<22.0.0) ; extra == "azure" or extra == "all"
25
+ Requires-Dist: azure-mgmt-web (>=7.3.1,<8.0.0) ; extra == "azure" or extra == "all"
26
+ Requires-Dist: azure-storage-blob (>=12.24.0,<13.0.0) ; extra == "azure" or extra == "all"
27
+ Requires-Dist: boto3 (>=1.38.41,<2.0.0) ; extra == "aws" or extra == "all"
26
28
  Requires-Dist: ccxt (>=4.2.48)
27
29
  Requires-Dist: dependency-injector (>=4.40.0)
28
- Requires-Dist: jupyter (>=1.0.0)
30
+ Requires-Dist: finterion-charts (==1.4.0)
31
+ Requires-Dist: ipython (>=8.0.0) ; extra == "notebook" or extra == "all"
29
32
  Requires-Dist: marshmallow (>=3.5.0)
30
33
  Requires-Dist: msgpack (>=1.0.0)
31
- Requires-Dist: plotly (>=6.1.2,<7.0.0)
32
34
  Requires-Dist: polars[numpy,pandas] (>=0.20.10)
33
35
  Requires-Dist: polygon-api-client (>=1.14.0,<2.0.0) ; extra == "polygon" or extra == "all"
34
36
  Requires-Dist: pyarrow (>=14.0.0)
@@ -318,16 +320,33 @@ Every backtest produces a **self-contained HTML dashboard** — open it in any b
318
320
  Every backtest API — vector or event-driven — returns the same `Backtest` object, which the `BacktestReport` consumes directly. So whether you're iterating over an in-memory list or a folder of persisted `.obtf` bundles, the path to the dashboard is the same:
319
321
 
320
322
  ```python
321
- from investing_algorithm_framework import BacktestReport
323
+ from investing_algorithm_framework import (
324
+ BacktestReport, Study, Universe, BacktestWindow, BacktestEngine,
325
+ )
322
326
 
323
327
  # --- Single event-driven backtest ---
324
- backtest = app.run_backtest(backtest_date_range=date_range)
325
- BacktestReport(backtests=[backtest]).save("event_report.html")
328
+ event_study = Study(
329
+ universe=Universe(market="BITVAVO", trading_symbol="EUR"),
330
+ initial_capital=1000,
331
+ backtest_windows=[BacktestWindow(train_range=date_range)],
332
+ engines=[BacktestEngine.EVENT_DRIVEN],
333
+ )
334
+ backtests = app.run_backtest(strategy=strategy, study=event_study)
335
+ BacktestReport(backtests=backtests).save("event_report.html")
326
336
 
327
337
  # --- A sweep of vector backtests (parameter grid / multi-window) ---
328
- backtests = app.run_vector_backtests(
338
+ sweep_study = Study(
339
+ universe=Universe(market="BITVAVO", trading_symbol="EUR"),
340
+ initial_capital=1000,
341
+ backtest_windows=[
342
+ BacktestWindow(train_range=dr)
343
+ for dr in [range_2022, range_2023, range_2024]
344
+ ],
345
+ engines=[BacktestEngine.VECTOR],
346
+ )
347
+ backtests = app.run_backtests(
329
348
  strategies=[StrategyA(), StrategyB(), StrategyC()],
330
- backtest_date_ranges=[range_2022, range_2023, range_2024],
349
+ study=sweep_study,
331
350
  n_workers=-1,
332
351
  backtest_storage_directory="./my-backtests/", # persists .obtf bundles
333
352
  show_progress=True,
@@ -274,16 +274,33 @@ Every backtest produces a **self-contained HTML dashboard** — open it in any b
274
274
  Every backtest API — vector or event-driven — returns the same `Backtest` object, which the `BacktestReport` consumes directly. So whether you're iterating over an in-memory list or a folder of persisted `.obtf` bundles, the path to the dashboard is the same:
275
275
 
276
276
  ```python
277
- from investing_algorithm_framework import BacktestReport
277
+ from investing_algorithm_framework import (
278
+ BacktestReport, Study, Universe, BacktestWindow, BacktestEngine,
279
+ )
278
280
 
279
281
  # --- Single event-driven backtest ---
280
- backtest = app.run_backtest(backtest_date_range=date_range)
281
- BacktestReport(backtests=[backtest]).save("event_report.html")
282
+ event_study = Study(
283
+ universe=Universe(market="BITVAVO", trading_symbol="EUR"),
284
+ initial_capital=1000,
285
+ backtest_windows=[BacktestWindow(train_range=date_range)],
286
+ engines=[BacktestEngine.EVENT_DRIVEN],
287
+ )
288
+ backtests = app.run_backtest(strategy=strategy, study=event_study)
289
+ BacktestReport(backtests=backtests).save("event_report.html")
282
290
 
283
291
  # --- A sweep of vector backtests (parameter grid / multi-window) ---
284
- backtests = app.run_vector_backtests(
292
+ sweep_study = Study(
293
+ universe=Universe(market="BITVAVO", trading_symbol="EUR"),
294
+ initial_capital=1000,
295
+ backtest_windows=[
296
+ BacktestWindow(train_range=dr)
297
+ for dr in [range_2022, range_2023, range_2024]
298
+ ],
299
+ engines=[BacktestEngine.VECTOR],
300
+ )
301
+ backtests = app.run_backtests(
285
302
  strategies=[StrategyA(), StrategyB(), StrategyC()],
286
- backtest_date_ranges=[range_2022, range_2023, range_2024],
303
+ study=sweep_study,
287
304
  n_workers=-1,
288
305
  backtest_storage_directory="./my-backtests/", # persists .obtf bundles
289
306
  show_progress=True,
@@ -142,7 +142,18 @@ from .services import (
142
142
  TradeTakeProfitService,
143
143
  TradeStopLossService,
144
144
  )
145
- from .notebook.magic import load_ipython_extension # noqa: F401
145
+ try:
146
+ from .notebook.magic import load_ipython_extension # noqa: F401
147
+ except ImportError:
148
+ # IPython is an optional dependency (install with
149
+ # `pip install investing-algorithm-framework[notebook]`) — don't
150
+ # let its absence break importing the framework itself.
151
+ def load_ipython_extension(ipython): # pragma: no cover
152
+ raise ImportError(
153
+ "IPython is required to use the %backtest magic. Install "
154
+ "it with `pip install investing-algorithm-framework"
155
+ "[notebook]`."
156
+ )
146
157
 
147
158
 
148
159
  __all__ = [
@@ -0,0 +1,236 @@
1
+ import json
2
+ import logging
3
+ import os
4
+ import threading
5
+ from datetime import datetime, timezone
6
+ from typing import Optional
7
+
8
+ from investing_algorithm_framework.domain import OperationalException
9
+
10
+ logger = logging.getLogger("investing_algorithm_framework")
11
+
12
+ NOT_STARTED = "NOT_STARTED"
13
+ RUNNING = "RUNNING"
14
+ STOPPING = "STOPPING"
15
+ STOPPED = "STOPPED"
16
+
17
+ CONTROL_FILE_NAME = "algorithm_control.json"
18
+
19
+
20
+ class AlgorithmRunner:
21
+ """
22
+ Thread-safe controller that runs an ``EventLoopService`` in a
23
+ background thread so the trading algorithm can be started and
24
+ stopped on demand (e.g. from the web API) without killing the
25
+ process that hosts it.
26
+ """
27
+
28
+ def __init__(self):
29
+ self._lock = threading.Lock()
30
+ self._thread: Optional[threading.Thread] = None
31
+ self._event_loop_service = None
32
+ self._run_kwargs = {}
33
+ self._status = NOT_STARTED
34
+ self._started_at = None
35
+ self._stopped_at = None
36
+ self._error = None
37
+ self._resource_directory = None
38
+ self._state_handler = None
39
+
40
+ def bind_persistence(self, resource_directory, state_handler=None) -> None:
41
+ """
42
+ Wires where the enabled/disabled control flag is persisted.
43
+
44
+ This is what makes ``enable()``/``disable()`` meaningful for
45
+ *stateless* deployments (AWS Lambda, Azure Functions): the
46
+ flag file lives inside ``resource_directory``, the same
47
+ directory a configured ``state_handler`` already uploads/
48
+ downloads on every run. Passing the state handler here makes a
49
+ toggle take effect immediately (pushed on the spot) instead of
50
+ waiting for the next natural save.
51
+ """
52
+ with self._lock:
53
+ self._resource_directory = resource_directory
54
+ self._state_handler = state_handler
55
+
56
+ def _control_file_path(self) -> Optional[str]:
57
+ if self._resource_directory is None:
58
+ return None
59
+ os.makedirs(self._resource_directory, exist_ok=True)
60
+ return os.path.join(self._resource_directory, CONTROL_FILE_NAME)
61
+
62
+ def get_control_state(self) -> dict:
63
+ """Returns the persisted enabled/disabled control state."""
64
+ default = {"enabled": True, "reason": None, "updated_at": None}
65
+ path = self._control_file_path()
66
+
67
+ if path is None or not os.path.exists(path):
68
+ return default
69
+
70
+ try:
71
+ with open(path, "r") as f:
72
+ return {**default, **json.load(f)}
73
+ except (OSError, ValueError) as e:
74
+ logger.warning(f"Could not read algorithm control file: {e}")
75
+ return default
76
+
77
+ def is_enabled(self) -> bool:
78
+ """Enabled by default when no control file has been written yet."""
79
+ return self.get_control_state().get("enabled", True)
80
+
81
+ def _persist_enabled(
82
+ self, enabled: bool, reason: Optional[str] = None
83
+ ) -> None:
84
+ path = self._control_file_path()
85
+
86
+ if path is None:
87
+ return
88
+
89
+ state = {
90
+ "enabled": enabled,
91
+ "reason": reason,
92
+ "updated_at": datetime.now(timezone.utc).isoformat(),
93
+ }
94
+
95
+ with open(path, "w") as f:
96
+ json.dump(state, f)
97
+
98
+ if self._state_handler is not None:
99
+ try:
100
+ self._state_handler.save(self._resource_directory)
101
+ except Exception as e:
102
+ logger.warning(
103
+ "Could not push algorithm control state via the "
104
+ f"configured state handler: {e}"
105
+ )
106
+
107
+ def enable(self, reason: Optional[str] = None) -> None:
108
+ """Persists 'enabled', independent of any in-process thread."""
109
+ self._persist_enabled(True, reason=reason)
110
+
111
+ def disable(self, reason: Optional[str] = None) -> None:
112
+ """Persists 'disabled', independent of any in-process thread."""
113
+ self._persist_enabled(False, reason=reason)
114
+
115
+ def configure(self, event_loop_service, **run_kwargs) -> None:
116
+ """
117
+ Wires the event loop service (and any kwargs for its
118
+ ``start()`` method) that ``start``/``stop`` will control.
119
+ Safe to call again after a ``stop()`` to reconfigure before
120
+ the next ``start()``.
121
+ """
122
+ with self._lock:
123
+ self._event_loop_service = event_loop_service
124
+ self._run_kwargs = run_kwargs
125
+
126
+ @property
127
+ def status(self) -> str:
128
+ with self._lock:
129
+ return self._status
130
+
131
+ @property
132
+ def is_running(self) -> bool:
133
+ return self.status == RUNNING
134
+
135
+ def get_status_report(self) -> dict:
136
+ with self._lock:
137
+ return {
138
+ "status": self._status,
139
+ "started_at": self._started_at.isoformat()
140
+ if self._started_at else None,
141
+ "stopped_at": self._stopped_at.isoformat()
142
+ if self._stopped_at else None,
143
+ "error": self._error,
144
+ }
145
+
146
+ def start(self) -> bool:
147
+ """
148
+ Starts (or resumes) the algorithm loop in a background thread.
149
+
150
+ Returns:
151
+ bool: True if a new run was started, False if the
152
+ algorithm was already running.
153
+
154
+ Raises:
155
+ OperationalException: If the runner has not been
156
+ configured with an event loop service yet (i.e. the
157
+ app has never been run).
158
+ """
159
+ with self._lock:
160
+ if self._event_loop_service is None:
161
+ raise OperationalException(
162
+ "The algorithm has not been initialized yet. Run "
163
+ "the app at least once before starting it "
164
+ "through the API."
165
+ )
166
+
167
+ if self._status == RUNNING:
168
+ self.enable()
169
+ return False
170
+
171
+ self._event_loop_service.reset_stop()
172
+ self._error = None
173
+ self._started_at = datetime.now(timezone.utc)
174
+ self._stopped_at = None
175
+ self._status = RUNNING
176
+ event_loop_service = self._event_loop_service
177
+ run_kwargs = self._run_kwargs
178
+
179
+ def _run():
180
+ try:
181
+ event_loop_service.start(**run_kwargs)
182
+ except Exception as e:
183
+ logger.error(f"Algorithm loop stopped with an error: {e}")
184
+ with self._lock:
185
+ self._error = str(e)
186
+ finally:
187
+ with self._lock:
188
+ self._status = STOPPED
189
+ self._stopped_at = datetime.now(timezone.utc)
190
+
191
+ self._thread = threading.Thread(
192
+ name="Algorithm Loop", target=_run, daemon=True
193
+ )
194
+ self._thread.start()
195
+ self.enable()
196
+ return True
197
+
198
+ def stop(
199
+ self,
200
+ wait: bool = False,
201
+ timeout: float = 10,
202
+ reason: Optional[str] = None,
203
+ ) -> bool:
204
+ """
205
+ Signals the running algorithm loop to stop after its current
206
+ iteration completes, and persists 'disabled' regardless of
207
+ whether a loop is currently running in-process (this is what a
208
+ stateless/serverless deployment, e.g. AWS Lambda or Azure
209
+ Functions, checks on its next scheduled invocation).
210
+
211
+ Args:
212
+ wait: If True, blocks until the background thread has
213
+ actually exited (bounded by ``timeout`` seconds).
214
+ timeout: Max seconds to wait for the thread to exit when
215
+ ``wait`` is True.
216
+ reason: Optional human-readable reason, persisted alongside
217
+ the disabled state.
218
+
219
+ Returns:
220
+ bool: True if a running in-process loop was signaled to
221
+ stop, False if it was not running (the disabled state
222
+ is still persisted either way).
223
+ """
224
+ self.disable(reason=reason)
225
+
226
+ with self._lock:
227
+ if self._status != RUNNING:
228
+ return False
229
+ self._status = STOPPING
230
+ self._event_loop_service.request_stop()
231
+ thread = self._thread
232
+
233
+ if wait and thread is not None:
234
+ thread.join(timeout=timeout)
235
+
236
+ return True