investing-algorithm-framework 7.35.0__tar.gz → 7.36.0__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 (278) hide show
  1. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/PKG-INFO +108 -26
  2. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/README.md +107 -25
  3. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/__init__.py +3 -0
  4. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/app.py +12 -2
  5. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/backtest_report.py +85 -1
  6. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/templates/dashboard.css +10 -0
  7. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/templates/dashboard.js +568 -53
  8. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/templates/dashboard_template.html.j2 +76 -2
  9. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/strategy.py +266 -8
  10. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/cli.py +4 -2
  11. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/mcp_server.py +36 -13
  12. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/dependency_container.py +5 -3
  13. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/__init__.py +3 -1
  14. investing_algorithm_framework-7.36.0/investing_algorithm_framework/domain/backtesting/templates/backtest.html +2619 -0
  15. investing_algorithm_framework-7.36.0/investing_algorithm_framework/domain/backtesting/templates/finterion-dark.png +0 -0
  16. investing_algorithm_framework-7.36.0/investing_algorithm_framework/domain/backtesting/templates/finterion-light.png +0 -0
  17. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/__init__.py +4 -1
  18. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/order/order.py +4 -0
  19. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/portfolio/portfolio_configuration.py +12 -0
  20. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/risk_rules/__init__.py +4 -0
  21. investing_algorithm_framework-7.36.0/investing_algorithm_framework/domain/models/risk_rules/scaling_rule.py +133 -0
  22. investing_algorithm_framework-7.36.0/investing_algorithm_framework/domain/models/risk_rules/trading_cost.py +89 -0
  23. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/trade/trade.py +2 -0
  24. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/download_data.py +41 -2
  25. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/__init__.py +2 -2
  26. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/database/__init__.py +3 -2
  27. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/database/sql_alchemy.py +36 -1
  28. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/__init__.py +2 -2
  29. investing_algorithm_framework-7.36.0/investing_algorithm_framework/infrastructure/models/order/__init__.py +4 -0
  30. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/order/order.py +14 -11
  31. investing_algorithm_framework-7.36.0/investing_algorithm_framework/infrastructure/models/order/trade_allocation.py +101 -0
  32. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/portfolio/portfolio_snapshot.py +12 -10
  33. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/portfolio/sql_portfolio.py +12 -10
  34. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/position/position.py +6 -4
  35. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/position/position_snapshot.py +6 -4
  36. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/trades/trade.py +13 -11
  37. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/trades/trade_stop_loss.py +11 -9
  38. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/trades/trade_take_profit.py +11 -9
  39. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/repositories/__init__.py +2 -2
  40. investing_algorithm_framework-7.35.0/investing_algorithm_framework/infrastructure/repositories/order_metadata_repository.py → investing_algorithm_framework-7.36.0/investing_algorithm_framework/infrastructure/repositories/trade_allocation_repository.py +6 -5
  41. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/services/backtesting/backtest_service.py +15 -1
  42. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/services/backtesting/vector_backtest_service.py +418 -120
  43. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/order_service/order_service.py +65 -140
  44. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/trade_order_evaluator/backtest_trade_oder_evaluator.py +47 -15
  45. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/trade_service/trade_service.py +271 -228
  46. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/pyproject.toml +1 -1
  47. investing_algorithm_framework-7.35.0/investing_algorithm_framework/infrastructure/models/order/__init__.py +0 -4
  48. investing_algorithm_framework-7.35.0/investing_algorithm_framework/infrastructure/models/order/order_metadata.py +0 -44
  49. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/LICENSE +0 -0
  50. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/analysis/__init__.py +0 -0
  51. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/analysis/backtest_data_ranges.py +0 -0
  52. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/analysis/markdown.py +0 -0
  53. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/analysis/ranking.py +0 -0
  54. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/__init__.py +0 -0
  55. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/algorithm/__init__.py +0 -0
  56. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/algorithm/algorithm.py +0 -0
  57. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/algorithm/algorithm_factory.py +0 -0
  58. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/app_hook.py +0 -0
  59. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/context.py +0 -0
  60. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/eventloop.py +0 -0
  61. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/__init__.py +0 -0
  62. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/ascii.py +0 -0
  63. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/charts/__init__.py +0 -0
  64. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/charts/entry_exist_signals.py +0 -0
  65. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/charts/equity_curve.py +0 -0
  66. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/charts/equity_curve_drawdown.py +0 -0
  67. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/charts/line_chart.py +0 -0
  68. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/charts/monthly_returns_heatmap.py +0 -0
  69. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/charts/ohlcv_data_completeness.py +0 -0
  70. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/charts/rolling_sharp_ratio.py +0 -0
  71. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/charts/yearly_returns_barchart.py +0 -0
  72. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/generate.py +0 -0
  73. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/tables/__init__.py +0 -0
  74. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/tables/key_metrics_table.py +0 -0
  75. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/tables/stop_loss_table.py +0 -0
  76. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/tables/time_metrics_table.py +0 -0
  77. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/tables/trade_metrics_table.py +0 -0
  78. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/tables/trades_table.py +0 -0
  79. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/tables/utils.py +0 -0
  80. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/reporting/templates/report_template.html.j2 +0 -0
  81. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/stateless/__init__.py +0 -0
  82. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/stateless/action_handlers/__init__.py +0 -0
  83. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/stateless/action_handlers/action_handler_strategy.py +0 -0
  84. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/stateless/action_handlers/check_online_handler.py +0 -0
  85. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/stateless/action_handlers/run_strategy_handler.py +0 -0
  86. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/stateless/exception_handler.py +0 -0
  87. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/task.py +0 -0
  88. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/__init__.py +0 -0
  89. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/controllers/__init__.py +0 -0
  90. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/controllers/orders.py +0 -0
  91. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/controllers/portfolio.py +0 -0
  92. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/controllers/positions.py +0 -0
  93. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/create_app.py +0 -0
  94. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/error_handler.py +0 -0
  95. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/responses.py +0 -0
  96. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/run_strategies.py +0 -0
  97. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/schemas/__init__.py +0 -0
  98. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/schemas/order.py +0 -0
  99. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/schemas/portfolio.py +0 -0
  100. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/schemas/position.py +0 -0
  101. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/app/web/setup_cors.py +0 -0
  102. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/__init__.py +0 -0
  103. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/deploy_to_aws_lambda.py +0 -0
  104. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/deploy_to_azure_function.py +0 -0
  105. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/initialize_app.py +0 -0
  106. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/.gitignore.template +0 -0
  107. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/app.py.template +0 -0
  108. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/app_aws_lambda_function.py.template +0 -0
  109. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/app_azure_function.py.template +0 -0
  110. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/app_web.py.template +0 -0
  111. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/aws_lambda_dockerfile.template +0 -0
  112. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/aws_lambda_dockerignore.template +0 -0
  113. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/aws_lambda_readme.md.template +0 -0
  114. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/aws_lambda_requirements.txt.template +0 -0
  115. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/azure_function_function_app.py.template +0 -0
  116. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/azure_function_host.json.template +0 -0
  117. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/azure_function_local.settings.json.template +0 -0
  118. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/azure_function_requirements.txt.template +0 -0
  119. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/data_providers.py.template +0 -0
  120. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/env.example.template +0 -0
  121. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/env_azure_function.example.template +0 -0
  122. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/market_data_providers.py.template +0 -0
  123. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/readme.md.template +0 -0
  124. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/requirements.txt.template +0 -0
  125. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/run_backtest.py.template +0 -0
  126. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/templates/strategy.py.template +0 -0
  127. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/cli/validate_backtest_checkpoints.py +0 -0
  128. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/create_app.py +0 -0
  129. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/algorithm_id.py +0 -0
  130. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/backtesting/__init__.py +0 -0
  131. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/backtesting/backtest.py +0 -0
  132. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/backtesting/backtest_date_range.py +0 -0
  133. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/backtesting/backtest_evaluation_focuss.py +0 -0
  134. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/backtesting/backtest_metrics.py +0 -0
  135. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/backtesting/backtest_permutation_test.py +0 -0
  136. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/backtesting/backtest_run.py +0 -0
  137. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/backtesting/backtest_summary_metrics.py +0 -0
  138. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/backtesting/backtest_utils.py +0 -0
  139. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/backtesting/combine_backtests.py +0 -0
  140. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/config.py +0 -0
  141. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/constants.py +0 -0
  142. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/data_provider.py +0 -0
  143. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/data_structures.py +0 -0
  144. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/decimal_parsing.py +0 -0
  145. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/exceptions.py +0 -0
  146. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/app_mode.py +0 -0
  147. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/base_model.py +0 -0
  148. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/data/__init__.py +0 -0
  149. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/data/data_source.py +0 -0
  150. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/data/data_type.py +0 -0
  151. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/event.py +0 -0
  152. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/market/__init__.py +0 -0
  153. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/market/market_credential.py +0 -0
  154. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/order/__init__.py +0 -0
  155. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/order/order_side.py +0 -0
  156. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/order/order_status.py +0 -0
  157. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/order/order_type.py +0 -0
  158. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/portfolio/__init__.py +0 -0
  159. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/portfolio/portfolio.py +0 -0
  160. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/portfolio/portfolio_snapshot.py +0 -0
  161. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/position/__init__.py +0 -0
  162. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/position/position.py +0 -0
  163. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/position/position_size.py +0 -0
  164. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/position/position_snapshot.py +0 -0
  165. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/risk_rules/stop_loss_rule.py +0 -0
  166. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/risk_rules/take_profit_rule.py +0 -0
  167. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/snapshot_interval.py +0 -0
  168. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/strategy_profile.py +0 -0
  169. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/time_frame.py +0 -0
  170. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/time_interval.py +0 -0
  171. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/time_unit.py +0 -0
  172. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/tracing/__init__.py +0 -0
  173. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/tracing/trace.py +0 -0
  174. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/trade/__init__.py +0 -0
  175. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/trade/trade_status.py +0 -0
  176. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/trade/trade_stop_loss.py +0 -0
  177. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/models/trade/trade_take_profit.py +0 -0
  178. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/order_executor.py +0 -0
  179. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/portfolio_provider.py +0 -0
  180. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/services/__init__.py +0 -0
  181. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/services/market_credential_service.py +0 -0
  182. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/services/portfolios/__init__.py +0 -0
  183. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/services/portfolios/portfolio_sync_service.py +0 -0
  184. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/services/rounding_service.py +0 -0
  185. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/services/state_handler.py +0 -0
  186. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/stateless_actions.py +0 -0
  187. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/strategy.py +0 -0
  188. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/utils/__init__.py +0 -0
  189. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/utils/csv.py +0 -0
  190. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/utils/custom_tqdm.py +0 -0
  191. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/utils/dates.py +0 -0
  192. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/utils/jupyter_notebook_detection.py +0 -0
  193. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/utils/polars.py +0 -0
  194. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/utils/random.py +0 -0
  195. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/utils/signatures.py +0 -0
  196. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/utils/stoppable_thread.py +0 -0
  197. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/domain/utils/synchronized.py +0 -0
  198. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/data_providers/__init__.py +0 -0
  199. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/data_providers/ccxt.py +0 -0
  200. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/data_providers/csv.py +0 -0
  201. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/data_providers/pandas.py +0 -0
  202. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/decimal_parser.py +0 -0
  203. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/model_extension.py +0 -0
  204. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/order_trade_association.py +0 -0
  205. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/portfolio/__init__.py +0 -0
  206. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/position/__init__.py +0 -0
  207. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/models/trades/__init__.py +0 -0
  208. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/order_executors/__init__.py +0 -0
  209. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/order_executors/backtest_oder_executor.py +0 -0
  210. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/order_executors/ccxt_order_executor.py +0 -0
  211. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/portfolio_providers/__init__.py +0 -0
  212. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/portfolio_providers/ccxt_portfolio_provider.py +0 -0
  213. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/repositories/order_repository.py +0 -0
  214. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/repositories/portfolio_repository.py +0 -0
  215. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/repositories/portfolio_snapshot_repository.py +0 -0
  216. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/repositories/position_repository.py +0 -0
  217. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/repositories/position_snapshot_repository.py +0 -0
  218. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/repositories/repository.py +0 -0
  219. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/repositories/trade_repository.py +0 -0
  220. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/repositories/trade_stop_loss_repository.py +0 -0
  221. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/repositories/trade_take_profit_repository.py +0 -0
  222. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/services/__init__.py +0 -0
  223. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/services/aws/__init__.py +0 -0
  224. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/services/aws/state_handler.py +0 -0
  225. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/services/azure/__init__.py +0 -0
  226. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/services/azure/state_handler.py +0 -0
  227. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/services/backtesting/__init__.py +0 -0
  228. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/infrastructure/services/backtesting/event_backtest_service.py +0 -0
  229. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/__init__.py +0 -0
  230. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/configuration_service.py +0 -0
  231. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/data_providers/__init__.py +0 -0
  232. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/data_providers/data.py +0 -0
  233. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/data_providers/data_provider_service.py +0 -0
  234. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/market_credential_service.py +0 -0
  235. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/__init__.py +0 -0
  236. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/alpha.py +0 -0
  237. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/beta.py +0 -0
  238. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/cagr.py +0 -0
  239. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/calmar_ratio.py +0 -0
  240. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/drawdown.py +0 -0
  241. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/equity_curve.py +0 -0
  242. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/exposure.py +0 -0
  243. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/generate.py +0 -0
  244. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/mean_daily_return.py +0 -0
  245. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/price_efficiency.py +0 -0
  246. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/profit_factor.py +0 -0
  247. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/recovery.py +0 -0
  248. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/returns.py +0 -0
  249. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/risk_free_rate.py +0 -0
  250. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/sharpe_ratio.py +0 -0
  251. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/sortino_ratio.py +0 -0
  252. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/standard_deviation.py +0 -0
  253. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/trades.py +0 -0
  254. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/treynor_ratio.py +0 -0
  255. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/ulcer.py +0 -0
  256. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/value_at_risk.py +0 -0
  257. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/volatility.py +0 -0
  258. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/metrics/win_rate.py +0 -0
  259. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/order_service/__init__.py +0 -0
  260. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/order_service/order_backtest_service.py +0 -0
  261. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/order_service/order_executor_lookup.py +0 -0
  262. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/portfolios/__init__.py +0 -0
  263. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/portfolios/backtest_portfolio_service.py +0 -0
  264. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/portfolios/portfolio_configuration_service.py +0 -0
  265. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/portfolios/portfolio_provider_lookup.py +0 -0
  266. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/portfolios/portfolio_service.py +0 -0
  267. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/portfolios/portfolio_snapshot_service.py +0 -0
  268. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/portfolios/portfolio_sync_service.py +0 -0
  269. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/positions/__init__.py +0 -0
  270. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/positions/position_service.py +0 -0
  271. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/positions/position_snapshot_service.py +0 -0
  272. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/repository_service.py +0 -0
  273. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/trade_order_evaluator/__init__.py +0 -0
  274. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/trade_order_evaluator/default_trade_order_evaluator.py +0 -0
  275. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/trade_order_evaluator/trade_order_evaluator.py +0 -0
  276. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/trade_service/__init__.py +0 -0
  277. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/investing_algorithm_framework/services/trade_service/trade_stop_loss_service.py +0 -0
  278. {investing_algorithm_framework-7.35.0 → investing_algorithm_framework-7.36.0}/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: 7.35.0
3
+ Version: 7.36.0
4
4
  Summary: A framework for creating trading bots
5
5
  Author: MDUYN
6
6
  Requires-Python: >=3.10
@@ -134,36 +134,118 @@ The [documentation](https://coding-kitties.github.io/investing-algorithm-framewo
134
134
  The framework is designed around the `TradingStrategy` class. You define **what data** your strategy needs and **when to buy or sell** — the framework handles execution, position management, and reporting.
135
135
 
136
136
  ```python
137
+ from typing import Dict, Any
138
+
139
+ import pandas as pd
140
+ from pyindicators import ema, rsi, crossover, crossunder
141
+
137
142
  from investing_algorithm_framework import (
138
- TradingStrategy, TimeUnit, Context, OrderSide
143
+ TradingStrategy, DataSource, TimeUnit, DataType,
144
+ PositionSize, ScalingRule, StopLossRule,
139
145
  )
140
146
 
141
- class MyStrategy(TradingStrategy):
147
+
148
+ class RSIEMACrossoverStrategy(TradingStrategy):
149
+ """
150
+ EMA crossover + RSI filter strategy with position scaling and stop losses.
151
+
152
+ Buy when RSI is oversold AND a recent EMA crossover occurred.
153
+ Sell when RSI is overbought AND a recent EMA crossunder occurred.
154
+ Scale into winners, trail a stop loss, and let the framework handle the rest.
155
+ """
142
156
  time_unit = TimeUnit.HOUR
143
157
  interval = 2
144
- symbol_pairs = ["BTC/EUR"]
145
-
146
- def apply_strategy(self, context: Context, market_data):
147
- for pair in self.symbol_pairs:
148
- symbol = pair.split("/")[0]
149
- ohlcv = market_data[f"{pair}-ohlcv-2h"]
150
- price = ohlcv["Close"].iloc[-1]
151
-
152
- if self.should_buy(ohlcv) and not context.has_position(symbol):
153
- context.create_limit_order(
154
- target_symbol=symbol,
155
- order_side=OrderSide.BUY,
156
- price=price,
157
- percentage_of_portfolio=25,
158
- )
159
-
160
- if self.should_sell(ohlcv) and context.has_position(symbol):
161
- context.create_limit_order(
162
- target_symbol=symbol,
163
- order_side=OrderSide.SELL,
164
- price=price,
165
- percentage_of_portfolio=100,
166
- )
158
+ symbols = ["BTC", "ETH"]
159
+ data_sources = [
160
+ DataSource(
161
+ identifier="BTC_ohlcv", symbol="BTC/EUR",
162
+ data_type=DataType.OHLCV, time_frame="2h",
163
+ market="BITVAVO", pandas=True, warmup_window=100,
164
+ ),
165
+ DataSource(
166
+ identifier="ETH_ohlcv", symbol="ETH/EUR",
167
+ data_type=DataType.OHLCV, time_frame="2h",
168
+ market="BITVAVO", pandas=True, warmup_window=100,
169
+ ),
170
+ ]
171
+
172
+ # Risk management
173
+ position_sizes = [
174
+ PositionSize(symbol="BTC", percentage_of_portfolio=20),
175
+ PositionSize(symbol="ETH", percentage_of_portfolio=20),
176
+ ]
177
+ scaling_rules = [
178
+ ScalingRule(
179
+ symbol="BTC", max_entries=3,
180
+ scale_in_percentage=[50, 25], cooldown_in_bars=5,
181
+ ),
182
+ ScalingRule(
183
+ symbol="ETH", max_entries=3,
184
+ scale_in_percentage=[50, 25], cooldown_in_bars=5,
185
+ ),
186
+ ]
187
+ stop_losses = [
188
+ StopLossRule(
189
+ symbol="BTC", percentage_threshold=5,
190
+ sell_percentage=100, trailing=True,
191
+ ),
192
+ StopLossRule(
193
+ symbol="ETH", percentage_threshold=5,
194
+ sell_percentage=100, trailing=True,
195
+ ),
196
+ ]
197
+
198
+ def generate_buy_signals(
199
+ self, data: Dict[str, Any]
200
+ ) -> Dict[str, pd.Series]:
201
+ signals = {}
202
+
203
+ for symbol in self.symbols:
204
+ df = data[f"{symbol}_ohlcv"]
205
+ ema_short = ema(df, period=12, source_column="Close",
206
+ result_column="ema_short")
207
+ ema_long = ema(ema_short, period=26, source_column="Close",
208
+ result_column="ema_long")
209
+ ema_cross = crossover(ema_long,
210
+ first_column="ema_short",
211
+ second_column="ema_long",
212
+ result_column="ema_crossover")
213
+ rsi_data = rsi(df, period=14, source_column="Close",
214
+ result_column="rsi")
215
+
216
+ rsi_oversold = rsi_data["rsi"] < 30
217
+ recent_crossover = (
218
+ ema_cross["ema_crossover"].rolling(window=10).max() > 0
219
+ )
220
+ signals[symbol] = (rsi_oversold & recent_crossover).fillna(False)
221
+
222
+ return signals
223
+
224
+ def generate_sell_signals(
225
+ self, data: Dict[str, Any]
226
+ ) -> Dict[str, pd.Series]:
227
+ signals = {}
228
+
229
+ for symbol in self.symbols:
230
+ df = data[f"{symbol}_ohlcv"]
231
+ ema_short = ema(df, period=12, source_column="Close",
232
+ result_column="ema_short")
233
+ ema_long = ema(ema_short, period=26, source_column="Close",
234
+ result_column="ema_long")
235
+ ema_cross = crossunder(ema_long,
236
+ first_column="ema_short",
237
+ second_column="ema_long",
238
+ result_column="ema_crossunder")
239
+ rsi_data = rsi(df, period=14, source_column="Close",
240
+ result_column="rsi")
241
+
242
+ rsi_overbought = rsi_data["rsi"] >= 70
243
+ recent_crossunder = (
244
+ ema_cross["ema_crossunder"].rolling(window=10).max() > 0
245
+ )
246
+ signals[symbol] = (rsi_overbought & recent_crossunder).fillna(False)
247
+
248
+ return signals
167
249
  ```
168
250
 
169
251
  Create as many strategy variants as you want — different parameters, different indicators, different symbols — then backtest them all and compare in a single report.
@@ -99,36 +99,118 @@ The [documentation](https://coding-kitties.github.io/investing-algorithm-framewo
99
99
  The framework is designed around the `TradingStrategy` class. You define **what data** your strategy needs and **when to buy or sell** — the framework handles execution, position management, and reporting.
100
100
 
101
101
  ```python
102
+ from typing import Dict, Any
103
+
104
+ import pandas as pd
105
+ from pyindicators import ema, rsi, crossover, crossunder
106
+
102
107
  from investing_algorithm_framework import (
103
- TradingStrategy, TimeUnit, Context, OrderSide
108
+ TradingStrategy, DataSource, TimeUnit, DataType,
109
+ PositionSize, ScalingRule, StopLossRule,
104
110
  )
105
111
 
106
- class MyStrategy(TradingStrategy):
112
+
113
+ class RSIEMACrossoverStrategy(TradingStrategy):
114
+ """
115
+ EMA crossover + RSI filter strategy with position scaling and stop losses.
116
+
117
+ Buy when RSI is oversold AND a recent EMA crossover occurred.
118
+ Sell when RSI is overbought AND a recent EMA crossunder occurred.
119
+ Scale into winners, trail a stop loss, and let the framework handle the rest.
120
+ """
107
121
  time_unit = TimeUnit.HOUR
108
122
  interval = 2
109
- symbol_pairs = ["BTC/EUR"]
110
-
111
- def apply_strategy(self, context: Context, market_data):
112
- for pair in self.symbol_pairs:
113
- symbol = pair.split("/")[0]
114
- ohlcv = market_data[f"{pair}-ohlcv-2h"]
115
- price = ohlcv["Close"].iloc[-1]
116
-
117
- if self.should_buy(ohlcv) and not context.has_position(symbol):
118
- context.create_limit_order(
119
- target_symbol=symbol,
120
- order_side=OrderSide.BUY,
121
- price=price,
122
- percentage_of_portfolio=25,
123
- )
124
-
125
- if self.should_sell(ohlcv) and context.has_position(symbol):
126
- context.create_limit_order(
127
- target_symbol=symbol,
128
- order_side=OrderSide.SELL,
129
- price=price,
130
- percentage_of_portfolio=100,
131
- )
123
+ symbols = ["BTC", "ETH"]
124
+ data_sources = [
125
+ DataSource(
126
+ identifier="BTC_ohlcv", symbol="BTC/EUR",
127
+ data_type=DataType.OHLCV, time_frame="2h",
128
+ market="BITVAVO", pandas=True, warmup_window=100,
129
+ ),
130
+ DataSource(
131
+ identifier="ETH_ohlcv", symbol="ETH/EUR",
132
+ data_type=DataType.OHLCV, time_frame="2h",
133
+ market="BITVAVO", pandas=True, warmup_window=100,
134
+ ),
135
+ ]
136
+
137
+ # Risk management
138
+ position_sizes = [
139
+ PositionSize(symbol="BTC", percentage_of_portfolio=20),
140
+ PositionSize(symbol="ETH", percentage_of_portfolio=20),
141
+ ]
142
+ scaling_rules = [
143
+ ScalingRule(
144
+ symbol="BTC", max_entries=3,
145
+ scale_in_percentage=[50, 25], cooldown_in_bars=5,
146
+ ),
147
+ ScalingRule(
148
+ symbol="ETH", max_entries=3,
149
+ scale_in_percentage=[50, 25], cooldown_in_bars=5,
150
+ ),
151
+ ]
152
+ stop_losses = [
153
+ StopLossRule(
154
+ symbol="BTC", percentage_threshold=5,
155
+ sell_percentage=100, trailing=True,
156
+ ),
157
+ StopLossRule(
158
+ symbol="ETH", percentage_threshold=5,
159
+ sell_percentage=100, trailing=True,
160
+ ),
161
+ ]
162
+
163
+ def generate_buy_signals(
164
+ self, data: Dict[str, Any]
165
+ ) -> Dict[str, pd.Series]:
166
+ signals = {}
167
+
168
+ for symbol in self.symbols:
169
+ df = data[f"{symbol}_ohlcv"]
170
+ ema_short = ema(df, period=12, source_column="Close",
171
+ result_column="ema_short")
172
+ ema_long = ema(ema_short, period=26, source_column="Close",
173
+ result_column="ema_long")
174
+ ema_cross = crossover(ema_long,
175
+ first_column="ema_short",
176
+ second_column="ema_long",
177
+ result_column="ema_crossover")
178
+ rsi_data = rsi(df, period=14, source_column="Close",
179
+ result_column="rsi")
180
+
181
+ rsi_oversold = rsi_data["rsi"] < 30
182
+ recent_crossover = (
183
+ ema_cross["ema_crossover"].rolling(window=10).max() > 0
184
+ )
185
+ signals[symbol] = (rsi_oversold & recent_crossover).fillna(False)
186
+
187
+ return signals
188
+
189
+ def generate_sell_signals(
190
+ self, data: Dict[str, Any]
191
+ ) -> Dict[str, pd.Series]:
192
+ signals = {}
193
+
194
+ for symbol in self.symbols:
195
+ df = data[f"{symbol}_ohlcv"]
196
+ ema_short = ema(df, period=12, source_column="Close",
197
+ result_column="ema_short")
198
+ ema_long = ema(ema_short, period=26, source_column="Close",
199
+ result_column="ema_long")
200
+ ema_cross = crossunder(ema_long,
201
+ first_column="ema_short",
202
+ second_column="ema_long",
203
+ result_column="ema_crossunder")
204
+ rsi_data = rsi(df, period=14, source_column="Close",
205
+ result_column="rsi")
206
+
207
+ rsi_overbought = rsi_data["rsi"] >= 70
208
+ recent_crossunder = (
209
+ ema_cross["ema_crossunder"].rolling(window=10).max() > 0
210
+ )
211
+ signals[symbol] = (rsi_overbought & recent_crossunder).fillna(False)
212
+
213
+ return signals
132
214
  ```
133
215
 
134
216
  Create as many strategy variants as you want — different parameters, different indicators, different symbols — then backtest them all and compare in a single report.
@@ -19,6 +19,7 @@ from .domain import ApiException, combine_backtests, PositionSize, \
19
19
  Trade, APP_MODE, AppMode, DATETIME_FORMAT, load_backtests_from_directory, \
20
20
  BacktestDateRange, convert_polars_to_pandas, BacktestRun, \
21
21
  DEFAULT_LOGGING_CONFIG, DataType, DataProvider, StopLossRule, \
22
+ ScalingRule, TradingCost, \
22
23
  TradeStatus, generate_backtest_summary_metrics, generate_algorithm_id, \
23
24
  APPLICATION_DIRECTORY, DataSource, OrderExecutor, PortfolioProvider, \
24
25
  SnapshotInterval, AWS_S3_STATE_BUCKET_NAME, BacktestEvaluationFocus, \
@@ -206,6 +207,8 @@ __all__ = [
206
207
  "recalculate_backtests",
207
208
  "TakeProfitRule",
208
209
  "StopLossRule",
210
+ "ScalingRule",
211
+ "TradingCost",
209
212
  "TradeStopLossService",
210
213
  "TradeTakeProfitService",
211
214
  "generate_algorithm_id",
@@ -2165,7 +2165,9 @@ class App:
2165
2165
  trading_symbol,
2166
2166
  api_key=None,
2167
2167
  secret_key=None,
2168
- initial_balance=None
2168
+ initial_balance=None,
2169
+ fee_percentage=0.0,
2170
+ slippage_percentage=0.0,
2169
2171
  ):
2170
2172
  """
2171
2173
  Function to add a market to the app. This function is a utility
@@ -2178,6 +2180,12 @@ class App:
2178
2180
  api_key: API key for the market
2179
2181
  secret_key: Secret key for the market
2180
2182
  initial_balance: Initial balance for the market
2183
+ fee_percentage: Default fee percentage for all trades
2184
+ on this market (e.g. 0.1 for 0.1%). Can be overridden
2185
+ per-symbol via TradingCost on the strategy.
2186
+ slippage_percentage: Default slippage percentage for all
2187
+ trades on this market (e.g. 0.05 for 0.05%). Can be
2188
+ overridden per-symbol via TradingCost on the strategy.
2181
2189
 
2182
2190
  Returns:
2183
2191
  None
@@ -2186,7 +2194,9 @@ class App:
2186
2194
  portfolio_configuration = PortfolioConfiguration(
2187
2195
  market=market,
2188
2196
  trading_symbol=trading_symbol,
2189
- initial_balance=initial_balance
2197
+ initial_balance=initial_balance,
2198
+ fee_percentage=fee_percentage,
2199
+ slippage_percentage=slippage_percentage,
2190
2200
  )
2191
2201
 
2192
2202
  self.add_portfolio_configuration(portfolio_configuration)
@@ -77,6 +77,17 @@ def _fmt_date(dt):
77
77
  return dt.strftime('%Y-%m-%d')
78
78
 
79
79
 
80
+ def _is_na(val):
81
+ """Check whether *val* is a pandas-like NA/NaN sentinel."""
82
+ try:
83
+ import pandas as pd
84
+ if pd.isna(val):
85
+ return True
86
+ except (ImportError, TypeError, ValueError):
87
+ pass
88
+ return False
89
+
90
+
80
91
  @dataclass
81
92
  class BacktestReport:
82
93
  backtests: List[Backtest] = field(default_factory=list)
@@ -451,6 +462,7 @@ class BacktestReport:
451
462
  pct = (ng / cost * 100) if cost else 0
452
463
  op_dt = t.opened_at
453
464
  cl_dt = t.closed_at
465
+ total_fees = getattr(t, 'total_fees', 0) or 0
454
466
  trades_list.append({
455
467
  'id': idx_t,
456
468
  'sym': sym,
@@ -461,6 +473,7 @@ class BacktestReport:
461
473
  ),
462
474
  'close_price': round(cp, 2),
463
475
  'cost': round(cost, 2),
476
+ 'total_fees': round(total_fees, 4),
464
477
  'net_gain': round(ng, 2),
465
478
  'pct': round(pct, 2),
466
479
  })
@@ -518,7 +531,11 @@ class BacktestReport:
518
531
  'best_year', 'worst_year',
519
532
  ):
520
533
  tval = getattr(m, tattr, None)
521
- if tval and tval[0] is not None:
534
+ if (
535
+ tval
536
+ and tval[0] is not None
537
+ and not _is_na(tval[0])
538
+ ):
522
539
  metrics_dict[tattr] = {
523
540
  'value': tval[0],
524
541
  'date': _fmt_date(tval[1]) if tval[1]
@@ -555,6 +572,71 @@ class BacktestReport:
555
572
  ),
556
573
  }
557
574
 
575
+ # Orders
576
+ orders_list = []
577
+ if run.orders:
578
+ for o in run.orders:
579
+ o_dt = getattr(o, 'created_at', None)
580
+ u_dt = getattr(o, 'updated_at', None)
581
+ o_fee = getattr(o, 'order_fee', None)
582
+ if o_fee is None:
583
+ o_fee = getattr(o, 'fee', 0)
584
+ o_fee = o_fee or 0
585
+ o_fee_rate = getattr(
586
+ o, 'order_fee_rate', 0
587
+ ) or 0
588
+ o_slippage = getattr(o, 'slippage', None)
589
+ if o_slippage is None:
590
+ o_slippage = 0
591
+ orders_list.append({
592
+ 'sym': getattr(o, 'target_symbol', '')
593
+ or '',
594
+ 'side': getattr(o, 'order_side', '')
595
+ or '',
596
+ 'type': getattr(o, 'order_type', '')
597
+ or '',
598
+ 'status': getattr(o, 'status', '')
599
+ or '',
600
+ 'price': round(
601
+ getattr(o, 'price', 0) or 0, 4
602
+ ),
603
+ 'amount': round(
604
+ getattr(o, 'amount', 0) or 0, 6
605
+ ),
606
+ 'filled': round(
607
+ getattr(o, 'filled', 0) or 0, 6
608
+ ),
609
+ 'cost': round(
610
+ (getattr(o, 'amount', 0) or 0)
611
+ * (getattr(o, 'price', 0) or 0), 2
612
+ ),
613
+ 'fee': round(float(o_fee), 4),
614
+ 'fee_rate': round(
615
+ float(o_fee_rate), 4
616
+ ),
617
+ 'slippage': round(
618
+ float(o_slippage), 4
619
+ ),
620
+ 'created': _fmt_date(o_dt)
621
+ if o_dt else '',
622
+ 'updated': _fmt_date(u_dt)
623
+ if u_dt else '',
624
+ })
625
+
626
+ # Positions
627
+ positions_list = []
628
+ if run.positions:
629
+ for p in run.positions:
630
+ positions_list.append({
631
+ 'sym': getattr(p, 'symbol', '') or '',
632
+ 'amount': round(
633
+ getattr(p, 'amount', 0) or 0, 6
634
+ ),
635
+ 'cost': round(
636
+ getattr(p, 'cost', 0) or 0, 2
637
+ ),
638
+ })
639
+
558
640
  run_data[rid] = {
559
641
  'label': label,
560
642
  'EQ': eq,
@@ -565,6 +647,8 @@ class BacktestReport:
565
647
  'YR': yr,
566
648
  'MONTHLY_HEATMAP': heatmap,
567
649
  'TRADES': trades_list,
650
+ 'ORDERS': orders_list,
651
+ 'POSITIONS': positions_list,
568
652
  'SYM_STATS': sym_stats,
569
653
  'metrics': metrics_dict,
570
654
  'snapshot': snapshot,
@@ -74,6 +74,7 @@ body { font-family:'Inter',-apple-system,sans-serif; background:var(--bg); color
74
74
  .challenger-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); }
75
75
  .challenger-row { background:rgba(34,211,238,0.06) !important; }
76
76
  .challenger-row td { border-bottom:1px solid var(--accent) !important; }
77
+ .challenger-col { background:rgba(34,211,238,0.06) !important; border-bottom:2px solid var(--accent) !important; }
77
78
  .sb-challenger { margin-left:auto; font-size:11px; color:var(--accent); }
78
79
  .sb-item .sb-cb { width:13px; height:13px; accent-color:var(--accent); cursor:pointer; flex-shrink:0; margin:0; }
79
80
  .sb-item .sb-chal-btn { background:none; border:1px solid var(--border); border-radius:3px; cursor:pointer; font-size:11px; color:var(--text-dim); padding:0 3px; margin-left:auto; line-height:1.2; transition:all 0.15s; flex-shrink:0; }
@@ -173,6 +174,15 @@ body { font-family:'Inter',-apple-system,sans-serif; background:var(--bg); color
173
174
  .tab-panel { display:none; }
174
175
  .tab-panel.active { display:block; }
175
176
 
177
+ /* pagination */
178
+ .pagination { display:flex; align-items:center; justify-content:space-between; padding:0.6rem 0.25rem; font-size:0.78rem; color:var(--text-dim); }
179
+ .pagination-btns { display:flex; gap:0.35rem; align-items:center; }
180
+ .pagination-btns button { font-family:inherit; font-size:0.75rem; font-weight:500; padding:0.3rem 0.7rem; border-radius:6px; border:1px solid var(--border); background:var(--surface2); color:var(--text-secondary); cursor:pointer; transition:all 0.15s; }
181
+ .pagination-btns button:hover:not(:disabled) { border-color:var(--accent); color:var(--accent); }
182
+ .pagination-btns button:disabled { opacity:0.35; cursor:default; }
183
+ .pagination-btns button.active { background:var(--accent); color:#000; border-color:var(--accent); }
184
+ .page-size-select { font-family:inherit; font-size:0.75rem; padding:0.25rem 0.5rem; border-radius:6px; border:1px solid var(--border); background:var(--surface2); color:var(--text-secondary); cursor:pointer; }
185
+
176
186
  /* run selector pills */
177
187
  .run-selector { display:flex; gap:0.4rem; flex-wrap:wrap; margin-bottom:1.25rem; padding:0.25rem 0; }
178
188
  .run-pill { font-family:'Inter',sans-serif; font-size:0.72rem; font-weight:500; padding:0.3rem 0.75rem; border-radius:16px; border:1px solid var(--border); background:var(--surface2); color:var(--text-secondary); cursor:pointer; transition:all 0.15s; }