investing-algorithm-framework 3.8.1__tar.gz → 4.0.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 (172) hide show
  1. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/PKG-INFO +49 -59
  2. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/README.md +42 -58
  3. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/__init__.py +11 -6
  4. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/algorithm.py +40 -26
  5. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/app.py +255 -197
  6. investing_algorithm_framework-4.0.0/investing_algorithm_framework/app/web/__init__.py +5 -0
  7. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/web/create_app.py +4 -2
  8. investing_algorithm_framework-4.0.0/investing_algorithm_framework/cli/create_azure_function_app_skeleton.py +149 -0
  9. investing_algorithm_framework-4.0.0/investing_algorithm_framework/cli/deploy_to_azure_function.py +701 -0
  10. investing_algorithm_framework-4.0.0/investing_algorithm_framework/cli/templates/azure_function_framework_app.py.template +48 -0
  11. investing_algorithm_framework-4.0.0/investing_algorithm_framework/cli/templates/azure_function_function_app.py.template +32 -0
  12. investing_algorithm_framework-4.0.0/investing_algorithm_framework/cli/templates/azure_function_host.json.template +15 -0
  13. investing_algorithm_framework-4.0.0/investing_algorithm_framework/cli/templates/azure_function_local.settings.json.template +8 -0
  14. investing_algorithm_framework-4.0.0/investing_algorithm_framework/cli/templates/azure_function_requirements.txt.template +2 -0
  15. investing_algorithm_framework-4.0.0/investing_algorithm_framework/create_app.py +46 -0
  16. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/__init__.py +6 -4
  17. investing_algorithm_framework-4.0.0/investing_algorithm_framework/domain/config.py +84 -0
  18. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/backtesting/backtest_report.py +23 -1
  19. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/base_model.py +6 -0
  20. investing_algorithm_framework-4.0.0/investing_algorithm_framework/domain/models/market/market_credential.py +87 -0
  21. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/order/order.py +4 -1
  22. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/portfolio/portfolio.py +37 -3
  23. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/position/position.py +3 -0
  24. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/time_unit.py +3 -1
  25. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/trade/trade.py +23 -0
  26. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/utils/__init__.py +4 -2
  27. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/utils/backtesting.py +170 -21
  28. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/indicators/__init__.py +5 -2
  29. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/indicators/trend.py +12 -1
  30. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/indicators/utils.py +129 -16
  31. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/__init__.py +3 -1
  32. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/database/sql_alchemy.py +5 -12
  33. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/ccxt.py +43 -28
  34. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/portfolio/__init__.py +1 -1
  35. investing_algorithm_framework-3.8.1/investing_algorithm_framework/infrastructure/models/portfolio/portfolio.py → investing_algorithm_framework-4.0.0/investing_algorithm_framework/infrastructure/models/portfolio/sql_portfolio.py +10 -1
  36. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/repositories/order_repository.py +1 -0
  37. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/repositories/repository.py +12 -0
  38. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/services/__init__.py +3 -1
  39. investing_algorithm_framework-4.0.0/investing_algorithm_framework/infrastructure/services/azure/__init__.py +5 -0
  40. investing_algorithm_framework-4.0.0/investing_algorithm_framework/infrastructure/services/azure/state_handler.py +148 -0
  41. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/services/market_service/ccxt_market_service.py +5 -1
  42. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/backtesting/backtest_service.py +1 -0
  43. investing_algorithm_framework-4.0.0/investing_algorithm_framework/services/configuration_service.py +80 -0
  44. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/market_credential_service.py +8 -0
  45. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/market_data_source_service/market_data_source_service.py +14 -1
  46. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/order_service/order_backtest_service.py +5 -5
  47. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/order_service/order_service.py +11 -5
  48. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/portfolios/backtest_portfolio_service.py +1 -0
  49. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/portfolios/portfolio_configuration_service.py +5 -0
  50. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/portfolios/portfolio_service.py +52 -1
  51. investing_algorithm_framework-4.0.0/investing_algorithm_framework/services/portfolios/portfolio_sync_service.py +307 -0
  52. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/repository_service.py +3 -0
  53. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/strategy_orchestrator_service.py +1 -3
  54. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/pyproject.toml +12 -2
  55. investing_algorithm_framework-3.8.1/investing_algorithm_framework/app/web/__init__.py +0 -4
  56. investing_algorithm_framework-3.8.1/investing_algorithm_framework/create_app.py +0 -20
  57. investing_algorithm_framework-3.8.1/investing_algorithm_framework/deployment/azure/__init__.py +0 -3
  58. investing_algorithm_framework-3.8.1/investing_algorithm_framework/deployment/azure/azure_functions.py +0 -102
  59. investing_algorithm_framework-3.8.1/investing_algorithm_framework/domain/config.py +0 -143
  60. investing_algorithm_framework-3.8.1/investing_algorithm_framework/domain/models/market/market_credential.py +0 -34
  61. investing_algorithm_framework-3.8.1/investing_algorithm_framework/services/configuration_service.py +0 -29
  62. investing_algorithm_framework-3.8.1/investing_algorithm_framework/services/portfolios/portfolio_sync_service.py +0 -379
  63. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/LICENSE +0 -0
  64. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/__init__.py +0 -0
  65. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/stateless/__init__.py +0 -0
  66. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/stateless/action_handlers/__init__.py +0 -0
  67. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/stateless/action_handlers/action_handler_strategy.py +0 -0
  68. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/stateless/action_handlers/check_online_handler.py +0 -0
  69. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/stateless/action_handlers/run_strategy_handler.py +0 -0
  70. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/stateless/exception_handler.py +0 -0
  71. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/strategy.py +0 -0
  72. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/task.py +0 -0
  73. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/web/controllers/__init__.py +0 -0
  74. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/web/controllers/orders.py +0 -0
  75. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/web/controllers/portfolio.py +0 -0
  76. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/web/controllers/positions.py +0 -0
  77. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/web/error_handler.py +0 -0
  78. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/web/responses.py +0 -0
  79. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/web/run_strategies.py +0 -0
  80. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/web/schemas/__init__.py +0 -0
  81. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/web/schemas/order.py +0 -0
  82. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/web/schemas/portfolio.py +0 -0
  83. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/web/schemas/position.py +0 -0
  84. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/app/web/setup_cors.py +0 -0
  85. {investing_algorithm_framework-3.8.1/investing_algorithm_framework/deployment → investing_algorithm_framework-4.0.0/investing_algorithm_framework/cli}/__init__.py +0 -0
  86. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/dependency_container.py +0 -0
  87. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/constants.py +0 -0
  88. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/data_structures.py +0 -0
  89. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/decimal_parsing.py +0 -0
  90. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/exceptions.py +0 -0
  91. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/metrics/__init__.py +0 -0
  92. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/metrics/price_efficiency.py +0 -0
  93. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/__init__.py +0 -0
  94. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/app_mode.py +0 -0
  95. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/backtesting/__init__.py +0 -0
  96. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/backtesting/backtest_date_range.py +0 -0
  97. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/backtesting/backtest_position.py +0 -0
  98. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/backtesting/backtest_reports_evaluation.py +0 -0
  99. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/date_range.py +0 -0
  100. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/market/__init__.py +0 -0
  101. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/order/__init__.py +0 -0
  102. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/order/order_side.py +0 -0
  103. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/order/order_status.py +0 -0
  104. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/order/order_type.py +0 -0
  105. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/portfolio/__init__.py +0 -0
  106. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/portfolio/portfolio_configuration.py +0 -0
  107. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/portfolio/portfolio_snapshot.py +0 -0
  108. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/position/__init__.py +0 -0
  109. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/position/position_snapshot.py +0 -0
  110. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/strategy_profile.py +0 -0
  111. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/time_frame.py +0 -0
  112. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/time_interval.py +0 -0
  113. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/tracing/__init__.py +0 -0
  114. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/tracing/trace.py +0 -0
  115. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/trade/__init__.py +0 -0
  116. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/trade/trade_status.py +0 -0
  117. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/trading_data_types.py +0 -0
  118. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/models/trading_time_frame.py +0 -0
  119. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/services/__init__.py +0 -0
  120. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/services/market_credential_service.py +0 -0
  121. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/services/market_data_sources.py +0 -0
  122. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/services/market_service.py +0 -0
  123. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/services/portfolios/__init__.py +0 -0
  124. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/services/portfolios/portfolio_sync_service.py +0 -0
  125. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/services/rounding_service.py +0 -0
  126. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/singleton.py +0 -0
  127. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/stateless_actions.py +0 -0
  128. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/strategy.py +0 -0
  129. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/utils/csv.py +0 -0
  130. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/utils/polars.py +0 -0
  131. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/utils/random.py +0 -0
  132. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/utils/signatures.py +0 -0
  133. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/utils/stoppable_thread.py +0 -0
  134. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/domain/utils/synchronized.py +0 -0
  135. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/indicators/advanced.py +0 -0
  136. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/indicators/momentum.py +0 -0
  137. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/database/__init__.py +0 -0
  138. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/__init__.py +0 -0
  139. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/decimal_parser.py +0 -0
  140. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/__init__.py +0 -0
  141. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/csv.py +0 -0
  142. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/pandas.py +0 -0
  143. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/us_treasury_yield.py +0 -0
  144. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/model_extension.py +0 -0
  145. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/order/__init__.py +0 -0
  146. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/order/order.py +0 -0
  147. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/portfolio/portfolio_snapshot.py +0 -0
  148. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/position/__init__.py +0 -0
  149. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/position/position.py +0 -0
  150. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/models/position/position_snapshot.py +0 -0
  151. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/repositories/__init__.py +0 -0
  152. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/repositories/portfolio_repository.py +0 -0
  153. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/repositories/portfolio_snapshot_repository.py +0 -0
  154. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/repositories/position_repository.py +0 -0
  155. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/repositories/position_snapshot_repository.py +0 -0
  156. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/services/market_service/__init__.py +0 -0
  157. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/services/performance_service/__init__.py +0 -0
  158. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/services/performance_service/backtest_performance_service.py +0 -0
  159. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/infrastructure/services/performance_service/performance_service.py +0 -0
  160. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/__init__.py +0 -0
  161. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/backtesting/__init__.py +0 -0
  162. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/backtesting/backtest_report_writer_service.py +0 -0
  163. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/backtesting/graphs.py +0 -0
  164. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/market_data_source_service/__init__.py +0 -0
  165. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/market_data_source_service/backtest_market_data_source_service.py +0 -0
  166. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/order_service/__init__.py +0 -0
  167. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/portfolios/__init__.py +0 -0
  168. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/portfolios/portfolio_snapshot_service.py +0 -0
  169. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/position_service.py +0 -0
  170. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/position_snapshot_service.py +0 -0
  171. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/trade_service/__init__.py +0 -0
  172. {investing_algorithm_framework-3.8.1 → investing_algorithm_framework-4.0.0}/investing_algorithm_framework/services/trade_service/trade_service.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: investing-algorithm-framework
3
- Version: 3.8.1
3
+ Version: 4.0.0
4
4
  Summary: A framework for creating trading bots
5
5
  Author: MDUYN
6
6
  Requires-Python: >=3.10
@@ -13,6 +13,11 @@ Requires-Dist: Flask-Cors (>=3.0.9,<5.0.0)
13
13
  Requires-Dist: Flask-Migrate (>=2.6.0,<3.0.0)
14
14
  Requires-Dist: MarkupSafe (>=2.1.2,<3.0.0)
15
15
  Requires-Dist: SQLAlchemy (>=2.0.18,<3.0.0)
16
+ Requires-Dist: azure-identity (>=1.19.0,<2.0.0)
17
+ Requires-Dist: azure-mgmt-resource (>=23.2.0,<24.0.0)
18
+ Requires-Dist: azure-mgmt-storage (>=21.2.1,<22.0.0)
19
+ Requires-Dist: azure-mgmt-web (>=7.3.1,<8.0.0)
20
+ Requires-Dist: azure-storage-blob (>=12.24.0,<13.0.0)
16
21
  Requires-Dist: ccxt (>=4.2.48,<5.0.0)
17
22
  Requires-Dist: dependency-injector (>=4.40.0,<5.0.0)
18
23
  Requires-Dist: jupyter (>=1.0.0,<2.0.0)
@@ -21,6 +26,7 @@ Requires-Dist: numpy (>=2.1.3,<3.0.0)
21
26
  Requires-Dist: plotly (>=5.22.0,<6.0.0)
22
27
  Requires-Dist: polars[numpy,pandas] (>=0.20.10,<0.21.0)
23
28
  Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
29
+ Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
24
30
  Requires-Dist: schedule (>=1.1.0,<2.0.0)
25
31
  Requires-Dist: scipy (>=1.14.1,<2.0.0)
26
32
  Requires-Dist: tabulate (>=0.9.0,<0.10.0)
@@ -38,6 +44,7 @@ Description-Content-Type: text/markdown
38
44
  [![GitHub stars](https://img.shields.io/github/stars/coding-kitties/investing-algorithm-framework.svg?style=social&label=Star&maxAge=1)](https://github.com/SeaQL/sea-orm/stargazers/) If you like what we do, consider starring, sharing and contributing!
39
45
 
40
46
  ###### Sponsors
47
+
41
48
  <p align="left">
42
49
  <a href="https://finterion.com">
43
50
  <img alt="Finterion" src="static/sponsors/finterion.png" width="200px" />
@@ -50,7 +57,7 @@ The Investing Algorithm Framework is a Python framework that enables swift and e
50
57
 
51
58
  Features:
52
59
 
53
- * Indicators module: A collection of indicators and utility functions that can be used in your trading strategies.
60
+ * Indicators module: A collection of indicators and utility functions that can be used in your trading strategies.
54
61
  * Order execution and tracking
55
62
  * Broker and exchange connections through [ccxt](https://github.com/ccxt/ccxt)
56
63
  * Backtesting and performance analysis reports [example](./examples/backtest_example)
@@ -67,23 +74,13 @@ Features:
67
74
  The following algorithm connects to binance and buys BTC every 5 seconds. It also exposes an REST API that allows you to interact with the algorithm.
68
75
 
69
76
  ```python
70
- import pathlib
77
+ import logging
71
78
  from investing_algorithm_framework import create_app, PortfolioConfiguration, \
72
- RESOURCE_DIRECTORY, TimeUnit, CCXTOHLCVMarketDataSource, Algorithm, \
73
- CCXTTickerMarketDataSource, MarketCredential, SYMBOLS
74
-
75
- # Define the symbols you want to trade for optimization, otherwise the
76
- # algorithm will check if you have orders and balances on all available
77
- # symbols on the market
78
- symbols = ["BTC/EUR"]
79
+ TimeUnit, CCXTOHLCVMarketDataSource, Algorithm, \
80
+ CCXTTickerMarketDataSource, MarketCredential, DEFAULT_LOGGING_CONFIG
79
81
 
80
- # Define resource directory and the symbols you want to trade
81
- config = {
82
- RESOURCE_DIRECTORY: pathlib.Path(__file__).parent.resolve(),
83
- SYMBOLS: symbols
84
- }
82
+ logging.config.dictConfig(DEFAULT_LOGGING_CONFIG)
85
83
 
86
- # Define market data sources
87
84
  # OHLCV data for candles
88
85
  bitvavo_btc_eur_ohlcv_2h = CCXTOHLCVMarketDataSource(
89
86
  identifier="BTC-ohlcv",
@@ -98,13 +95,10 @@ bitvavo_btc_eur_ticker = CCXTTickerMarketDataSource(
98
95
  market="BITVAVO",
99
96
  symbol="BTC/EUR",
100
97
  )
101
- app = create_app(config=config)
98
+ app = create_app()
102
99
  algorithm = Algorithm()
103
- app.add_market_credential(MarketCredential(
104
- market="bitvavo",
105
- api_key="<your api key>",
106
- secret_key="<your secret key>",
107
- ))
100
+ # Bitvavo market credentials are read from .env file
101
+ app.add_market_credential(MarketCredential(market="bitvavo"))
108
102
  app.add_portfolio_configuration(
109
103
  PortfolioConfiguration(
110
104
  market="bitvavo",
@@ -114,42 +108,39 @@ app.add_portfolio_configuration(
114
108
  )
115
109
  app.add_algorithm(algorithm)
116
110
 
111
+ # Run every two hours and register the data sources
117
112
  @algorithm.strategy(
118
- # Run every two hours
119
- time_unit=TimeUnit.HOUR,
120
- interval=2,
121
- # Specify market data sources that need to be passed to the strategy
113
+ time_unit=TimeUnit.HOUR,
114
+ interval=2,
122
115
  market_data_sources=[bitvavo_btc_eur_ticker, bitvavo_btc_eur_ohlcv_2h]
123
116
  )
124
117
  def perform_strategy(algorithm: Algorithm, market_data: dict):
125
- # By default, ohlcv data is passed as polars df in the form of
126
- # {"<identifier>": <dataframe>} https://pola.rs/,
127
- # call to_pandas() to convert to pandas
128
- polars_df = market_data["BTC-ohlcv"]
129
- print(f"I have access to {len(polars_df)} candles of ohlcv data")
118
+ # Access the data sources with the indentifier
119
+ polars_df = market_data["BTC-ohlcv"]
130
120
 
131
- # Ticker data is passed as {"<identifier>": <ticker dict>}
121
+ # Convert the polars dataframe to a pandas dataframe
122
+ pandas_df = polars_df.to_pandas()
132
123
  ticker_data = market_data["BTC-ticker"]
133
124
  unallocated_balance = algorithm.get_unallocated()
134
125
  positions = algorithm.get_positions()
135
126
  trades = algorithm.get_trades()
136
127
  open_trades = algorithm.get_open_trades()
137
128
  closed_trades = algorithm.get_closed_trades()
138
-
139
- # Create a buy oder
129
+
130
+ # Create a buy oder
140
131
  algorithm.create_limit_order(
141
132
  target_symbol="BTC/EUR",
142
133
  order_side="buy",
143
134
  amount=0.01,
144
135
  price=ticker_data["ask"],
145
136
  )
146
-
137
+
147
138
  # Close a trade
148
139
  algorithm.close_trade(trades[0].id)
149
-
140
+
150
141
  # Close a position
151
142
  algorithm.close_position(positions[0].get_symbol())
152
-
143
+
153
144
  if __name__ == "__main__":
154
145
  app.run()
155
146
  ```
@@ -167,14 +158,14 @@ To run a single backtest you can use the example code that can be found [here](.
167
158
  You can use the ```pretty_print_backtest``` function to print a backtest report.
168
159
  For example if you run the [moving average example trading bot](./examples/crossover_moving_average_trading_bot)
169
160
  you will get the following backtesting report:
170
-
161
+
171
162
  ```bash
172
163
 
173
164
  :%%%#+- .=*#%%% Backtest report
174
165
  *%%%%%%%+------=*%%%%%%%- ---------------------------
175
166
  *%%%%%%%%%%%%%%%%%%%%%%%- Start date: 2023-08-24 00:00:00
176
167
  .%%%%%%%%%%%%%%%%%%%%%%# End date: 2023-12-02 00:00:00
177
- #%%%####%%%%%%%%**#%%%+ Number of days: 100
168
+ #%%%####%%%%%%%%**#%%%+ Number of days: 100
178
169
  .:-+*%%%%- -+..#%%%+.+- +%%%#*=-: Number of runs: 1201
179
170
  .:-=*%%%%. += .%%# -+.-%%%%=-:.. Number of orders: 40
180
171
  .:=+#%%%%%*###%%%%#*+#%%%%%%*+-: Initial balance: 400.0
@@ -187,10 +178,10 @@ you will get the following backtesting report:
187
178
  .++- -%%%%%%%%%%%+= Percentage negative trades: 70.0%
188
179
  .++- .%%%%%%%%%%%%%+= Average trade size: 100.9692 EUR
189
180
  .++- *%%%%%%%%%%%%%*+: Average trade duration: 83.6 hours
190
- .++- %%%%%%%%%%%%%%#+=
191
- =++........:::%%%%%%%%%%%%%%*+-
192
- .=++++++++++**#%%%%%%%%%%%%%++.
193
-
181
+ .++- %%%%%%%%%%%%%%#+=
182
+ =++........:::%%%%%%%%%%%%%%*+-
183
+ .=++++++++++**#%%%%%%%%%%%%%++.
184
+
194
185
  Price noise
195
186
 
196
187
  Positions overview
@@ -251,8 +242,8 @@ Trades overview
251
242
 
252
243
  ### Backtest experiments
253
244
 
254
- The framework also supports backtest experiments. Backtest experiments allows you to
255
- compare multiple algorithms and evaluate their performance. Ideally,
245
+ The framework also supports backtest experiments. Backtest experiments allows you to
246
+ compare multiple algorithms and evaluate their performance. Ideally,
256
247
  you would do this by parameterizing your strategy and creating a factory function that
257
248
  creates the algorithm with the different parameters. You can find an example of this
258
249
  in the [backtest experiments example](./examples/backtest_experiment).
@@ -268,16 +259,15 @@ from investing_algorithm_framework import PortfolioConfiguration, \
268
259
  app = create_app()
269
260
  app.add_market_credential(
270
261
  MarketCredential(
271
- market="<your market>",
262
+ market="<your market>",
272
263
  api_key="<your api key>",
273
264
  secret_key="<your secret key>",
274
265
  )
275
266
  )
276
267
  app.add_portfolio_configuration(
277
268
  PortfolioConfiguration(
278
- market="<your market>",
269
+ market="<your market>",
279
270
  initial_balance=400,
280
- track_from="01/01/2022",
281
271
  trading_symbol="EUR"
282
272
  )
283
273
  )
@@ -298,27 +288,27 @@ pip install investing-algorithm-framework
298
288
 
299
289
  ## Disclaimer
300
290
 
301
- If you use this framework for your investments, do not risk money
302
- which you are afraid to lose, until you have clear understanding how
291
+ If you use this framework for your investments, do not risk money
292
+ which you are afraid to lose, until you have clear understanding how
303
293
  the framework works. We can't stress this enough:
304
294
 
305
- BEFORE YOU START USING MONEY WITH THE FRAMEWORK, MAKE SURE THAT YOU TESTED
306
- YOUR COMPONENTS THOROUGHLY. USE THE SOFTWARE AT YOUR OWN RISK.
295
+ BEFORE YOU START USING MONEY WITH THE FRAMEWORK, MAKE SURE THAT YOU TESTED
296
+ YOUR COMPONENTS THOROUGHLY. USE THE SOFTWARE AT YOUR OWN RISK.
307
297
  THE AUTHORS AND ALL AFFILIATES ASSUME NO RESPONSIBILITY FOR YOUR INVESTMENT RESULTS.
308
298
 
309
- Also, make sure that you read the source code of any plugin you use or
299
+ Also, make sure that you read the source code of any plugin you use or
310
300
  implementation of an algorithm made with this framework.
311
301
 
312
302
  ## Documentation
313
303
 
314
- All the documentation can be found online
304
+ All the documentation can be found online
315
305
  at the [documentation webstie](https://investing-algorithm-framework.com)
316
306
 
317
- In most cases, you'll probably never have to change code on this repo directly
318
- if you are building your algorithm/bot. But if you do, check out the
307
+ In most cases, you'll probably never have to change code on this repo directly
308
+ if you are building your algorithm/bot. But if you do, check out the
319
309
  contributing page at the website.
320
310
 
321
- If you'd like to chat with investing-algorithm-framework users
311
+ If you'd like to chat with investing-algorithm-framework users
322
312
  and developers, [join us on Slack](https://inv-algo-framework.slack.com) or [join us on reddit](https://www.reddit.com/r/InvestingBots/)
323
313
 
324
314
  ## Acknowledgements
@@ -333,12 +323,12 @@ first. If it hasn't been reported, please [create a new issue](https://github.co
333
323
 
334
324
  ### Contributing
335
325
 
336
- The investing algorithm framework is a community driven project.
326
+ The investing algorithm framework is a community driven project.
337
327
  We welcome you to participate, contribute and together help build the future trading bots developed in python.
338
328
 
339
329
  Feel like the framework is missing a feature? We welcome your pull requests!
340
330
  If you want to contribute to the project roadmap, please take a look at the [project board](https://github.com/coding-kitties/investing-algorithm-framework/projects?query=is%3Aopen).
341
- You can pick up a task by assigning yourself to it.
331
+ You can pick up a task by assigning yourself to it.
342
332
 
343
333
  **Note** before starting any major new feature work, *please open an issue describing what you are planning to do*.
344
334
  This will ensure that interested parties can give valuable feedback on the feature, and let others know that you are working on it.
@@ -7,6 +7,7 @@
7
7
  [![GitHub stars](https://img.shields.io/github/stars/coding-kitties/investing-algorithm-framework.svg?style=social&label=Star&maxAge=1)](https://github.com/SeaQL/sea-orm/stargazers/) If you like what we do, consider starring, sharing and contributing!
8
8
 
9
9
  ###### Sponsors
10
+
10
11
  <p align="left">
11
12
  <a href="https://finterion.com">
12
13
  <img alt="Finterion" src="static/sponsors/finterion.png" width="200px" />
@@ -19,7 +20,7 @@ The Investing Algorithm Framework is a Python framework that enables swift and e
19
20
 
20
21
  Features:
21
22
 
22
- * Indicators module: A collection of indicators and utility functions that can be used in your trading strategies.
23
+ * Indicators module: A collection of indicators and utility functions that can be used in your trading strategies.
23
24
  * Order execution and tracking
24
25
  * Broker and exchange connections through [ccxt](https://github.com/ccxt/ccxt)
25
26
  * Backtesting and performance analysis reports [example](./examples/backtest_example)
@@ -36,23 +37,13 @@ Features:
36
37
  The following algorithm connects to binance and buys BTC every 5 seconds. It also exposes an REST API that allows you to interact with the algorithm.
37
38
 
38
39
  ```python
39
- import pathlib
40
+ import logging
40
41
  from investing_algorithm_framework import create_app, PortfolioConfiguration, \
41
- RESOURCE_DIRECTORY, TimeUnit, CCXTOHLCVMarketDataSource, Algorithm, \
42
- CCXTTickerMarketDataSource, MarketCredential, SYMBOLS
43
-
44
- # Define the symbols you want to trade for optimization, otherwise the
45
- # algorithm will check if you have orders and balances on all available
46
- # symbols on the market
47
- symbols = ["BTC/EUR"]
42
+ TimeUnit, CCXTOHLCVMarketDataSource, Algorithm, \
43
+ CCXTTickerMarketDataSource, MarketCredential, DEFAULT_LOGGING_CONFIG
48
44
 
49
- # Define resource directory and the symbols you want to trade
50
- config = {
51
- RESOURCE_DIRECTORY: pathlib.Path(__file__).parent.resolve(),
52
- SYMBOLS: symbols
53
- }
45
+ logging.config.dictConfig(DEFAULT_LOGGING_CONFIG)
54
46
 
55
- # Define market data sources
56
47
  # OHLCV data for candles
57
48
  bitvavo_btc_eur_ohlcv_2h = CCXTOHLCVMarketDataSource(
58
49
  identifier="BTC-ohlcv",
@@ -67,13 +58,10 @@ bitvavo_btc_eur_ticker = CCXTTickerMarketDataSource(
67
58
  market="BITVAVO",
68
59
  symbol="BTC/EUR",
69
60
  )
70
- app = create_app(config=config)
61
+ app = create_app()
71
62
  algorithm = Algorithm()
72
- app.add_market_credential(MarketCredential(
73
- market="bitvavo",
74
- api_key="<your api key>",
75
- secret_key="<your secret key>",
76
- ))
63
+ # Bitvavo market credentials are read from .env file
64
+ app.add_market_credential(MarketCredential(market="bitvavo"))
77
65
  app.add_portfolio_configuration(
78
66
  PortfolioConfiguration(
79
67
  market="bitvavo",
@@ -83,42 +71,39 @@ app.add_portfolio_configuration(
83
71
  )
84
72
  app.add_algorithm(algorithm)
85
73
 
74
+ # Run every two hours and register the data sources
86
75
  @algorithm.strategy(
87
- # Run every two hours
88
- time_unit=TimeUnit.HOUR,
89
- interval=2,
90
- # Specify market data sources that need to be passed to the strategy
76
+ time_unit=TimeUnit.HOUR,
77
+ interval=2,
91
78
  market_data_sources=[bitvavo_btc_eur_ticker, bitvavo_btc_eur_ohlcv_2h]
92
79
  )
93
80
  def perform_strategy(algorithm: Algorithm, market_data: dict):
94
- # By default, ohlcv data is passed as polars df in the form of
95
- # {"<identifier>": <dataframe>} https://pola.rs/,
96
- # call to_pandas() to convert to pandas
97
- polars_df = market_data["BTC-ohlcv"]
98
- print(f"I have access to {len(polars_df)} candles of ohlcv data")
81
+ # Access the data sources with the indentifier
82
+ polars_df = market_data["BTC-ohlcv"]
99
83
 
100
- # Ticker data is passed as {"<identifier>": <ticker dict>}
84
+ # Convert the polars dataframe to a pandas dataframe
85
+ pandas_df = polars_df.to_pandas()
101
86
  ticker_data = market_data["BTC-ticker"]
102
87
  unallocated_balance = algorithm.get_unallocated()
103
88
  positions = algorithm.get_positions()
104
89
  trades = algorithm.get_trades()
105
90
  open_trades = algorithm.get_open_trades()
106
91
  closed_trades = algorithm.get_closed_trades()
107
-
108
- # Create a buy oder
92
+
93
+ # Create a buy oder
109
94
  algorithm.create_limit_order(
110
95
  target_symbol="BTC/EUR",
111
96
  order_side="buy",
112
97
  amount=0.01,
113
98
  price=ticker_data["ask"],
114
99
  )
115
-
100
+
116
101
  # Close a trade
117
102
  algorithm.close_trade(trades[0].id)
118
-
103
+
119
104
  # Close a position
120
105
  algorithm.close_position(positions[0].get_symbol())
121
-
106
+
122
107
  if __name__ == "__main__":
123
108
  app.run()
124
109
  ```
@@ -136,14 +121,14 @@ To run a single backtest you can use the example code that can be found [here](.
136
121
  You can use the ```pretty_print_backtest``` function to print a backtest report.
137
122
  For example if you run the [moving average example trading bot](./examples/crossover_moving_average_trading_bot)
138
123
  you will get the following backtesting report:
139
-
124
+
140
125
  ```bash
141
126
 
142
127
  :%%%#+- .=*#%%% Backtest report
143
128
  *%%%%%%%+------=*%%%%%%%- ---------------------------
144
129
  *%%%%%%%%%%%%%%%%%%%%%%%- Start date: 2023-08-24 00:00:00
145
130
  .%%%%%%%%%%%%%%%%%%%%%%# End date: 2023-12-02 00:00:00
146
- #%%%####%%%%%%%%**#%%%+ Number of days: 100
131
+ #%%%####%%%%%%%%**#%%%+ Number of days: 100
147
132
  .:-+*%%%%- -+..#%%%+.+- +%%%#*=-: Number of runs: 1201
148
133
  .:-=*%%%%. += .%%# -+.-%%%%=-:.. Number of orders: 40
149
134
  .:=+#%%%%%*###%%%%#*+#%%%%%%*+-: Initial balance: 400.0
@@ -156,10 +141,10 @@ you will get the following backtesting report:
156
141
  .++- -%%%%%%%%%%%+= Percentage negative trades: 70.0%
157
142
  .++- .%%%%%%%%%%%%%+= Average trade size: 100.9692 EUR
158
143
  .++- *%%%%%%%%%%%%%*+: Average trade duration: 83.6 hours
159
- .++- %%%%%%%%%%%%%%#+=
160
- =++........:::%%%%%%%%%%%%%%*+-
161
- .=++++++++++**#%%%%%%%%%%%%%++.
162
-
144
+ .++- %%%%%%%%%%%%%%#+=
145
+ =++........:::%%%%%%%%%%%%%%*+-
146
+ .=++++++++++**#%%%%%%%%%%%%%++.
147
+
163
148
  Price noise
164
149
 
165
150
  Positions overview
@@ -220,8 +205,8 @@ Trades overview
220
205
 
221
206
  ### Backtest experiments
222
207
 
223
- The framework also supports backtest experiments. Backtest experiments allows you to
224
- compare multiple algorithms and evaluate their performance. Ideally,
208
+ The framework also supports backtest experiments. Backtest experiments allows you to
209
+ compare multiple algorithms and evaluate their performance. Ideally,
225
210
  you would do this by parameterizing your strategy and creating a factory function that
226
211
  creates the algorithm with the different parameters. You can find an example of this
227
212
  in the [backtest experiments example](./examples/backtest_experiment).
@@ -237,16 +222,15 @@ from investing_algorithm_framework import PortfolioConfiguration, \
237
222
  app = create_app()
238
223
  app.add_market_credential(
239
224
  MarketCredential(
240
- market="<your market>",
225
+ market="<your market>",
241
226
  api_key="<your api key>",
242
227
  secret_key="<your secret key>",
243
228
  )
244
229
  )
245
230
  app.add_portfolio_configuration(
246
231
  PortfolioConfiguration(
247
- market="<your market>",
232
+ market="<your market>",
248
233
  initial_balance=400,
249
- track_from="01/01/2022",
250
234
  trading_symbol="EUR"
251
235
  )
252
236
  )
@@ -267,27 +251,27 @@ pip install investing-algorithm-framework
267
251
 
268
252
  ## Disclaimer
269
253
 
270
- If you use this framework for your investments, do not risk money
271
- which you are afraid to lose, until you have clear understanding how
254
+ If you use this framework for your investments, do not risk money
255
+ which you are afraid to lose, until you have clear understanding how
272
256
  the framework works. We can't stress this enough:
273
257
 
274
- BEFORE YOU START USING MONEY WITH THE FRAMEWORK, MAKE SURE THAT YOU TESTED
275
- YOUR COMPONENTS THOROUGHLY. USE THE SOFTWARE AT YOUR OWN RISK.
258
+ BEFORE YOU START USING MONEY WITH THE FRAMEWORK, MAKE SURE THAT YOU TESTED
259
+ YOUR COMPONENTS THOROUGHLY. USE THE SOFTWARE AT YOUR OWN RISK.
276
260
  THE AUTHORS AND ALL AFFILIATES ASSUME NO RESPONSIBILITY FOR YOUR INVESTMENT RESULTS.
277
261
 
278
- Also, make sure that you read the source code of any plugin you use or
262
+ Also, make sure that you read the source code of any plugin you use or
279
263
  implementation of an algorithm made with this framework.
280
264
 
281
265
  ## Documentation
282
266
 
283
- All the documentation can be found online
267
+ All the documentation can be found online
284
268
  at the [documentation webstie](https://investing-algorithm-framework.com)
285
269
 
286
- In most cases, you'll probably never have to change code on this repo directly
287
- if you are building your algorithm/bot. But if you do, check out the
270
+ In most cases, you'll probably never have to change code on this repo directly
271
+ if you are building your algorithm/bot. But if you do, check out the
288
272
  contributing page at the website.
289
273
 
290
- If you'd like to chat with investing-algorithm-framework users
274
+ If you'd like to chat with investing-algorithm-framework users
291
275
  and developers, [join us on Slack](https://inv-algo-framework.slack.com) or [join us on reddit](https://www.reddit.com/r/InvestingBots/)
292
276
 
293
277
  ## Acknowledgements
@@ -302,12 +286,12 @@ first. If it hasn't been reported, please [create a new issue](https://github.co
302
286
 
303
287
  ### Contributing
304
288
 
305
- The investing algorithm framework is a community driven project.
289
+ The investing algorithm framework is a community driven project.
306
290
  We welcome you to participate, contribute and together help build the future trading bots developed in python.
307
291
 
308
292
  Feel like the framework is missing a feature? We welcome your pull requests!
309
293
  If you want to contribute to the project roadmap, please take a look at the [project board](https://github.com/coding-kitties/investing-algorithm-framework/projects?query=is%3Aopen).
310
- You can pick up a task by assigning yourself to it.
294
+ You can pick up a task by assigning yourself to it.
311
295
 
312
296
  **Note** before starting any major new feature work, *please open an issue describing what you are planning to do*.
313
297
  This will ensure that interested parties can give valuable feedback on the feature, and let others know that you are working on it.
@@ -3,7 +3,7 @@ from investing_algorithm_framework.app import TradingStrategy, \
3
3
  StatelessAction, Task
4
4
  from investing_algorithm_framework.domain import ApiException, \
5
5
  TradingDataType, TradingTimeFrame, OrderType, OperationalException, \
6
- OrderStatus, OrderSide, Config, TimeUnit, TimeInterval, Order, Portfolio, \
6
+ OrderStatus, OrderSide, TimeUnit, TimeInterval, Order, Portfolio, \
7
7
  Position, TimeFrame, BACKTESTING_INDEX_DATETIME, MarketCredential, \
8
8
  PortfolioConfiguration, RESOURCE_DIRECTORY, pretty_print_backtest, \
9
9
  Trade, OHLCVMarketDataSource, OrderBookMarketDataSource, SYMBOLS, \
@@ -11,12 +11,16 @@ from investing_algorithm_framework.domain import ApiException, \
11
11
  pretty_print_backtest_reports_evaluation, load_backtest_reports, \
12
12
  RESERVED_BALANCES, APP_MODE, AppMode, DATETIME_FORMAT, \
13
13
  load_backtest_report, BacktestDateRange, convert_polars_to_pandas, \
14
- DateRange
14
+ DateRange, get_backtest_report, DEFAULT_LOGGING_CONFIG
15
15
  from investing_algorithm_framework.infrastructure import \
16
16
  CCXTOrderBookMarketDataSource, CCXTOHLCVMarketDataSource, \
17
17
  CCXTTickerMarketDataSource, CSVOHLCVMarketDataSource, \
18
- CSVTickerMarketDataSource
18
+ CSVTickerMarketDataSource, AzureBlobStorageStateHandler
19
19
  from .create_app import create_app
20
+ from investing_algorithm_framework.indicators import get_rsi, get_peaks, \
21
+ is_uptrend, is_downtrend, is_crossover, is_crossunder, is_above, \
22
+ is_below, has_crossed_upward, get_sma, get_up_and_downtrends, \
23
+ get_ema, get_adx, has_crossed_downward, get_willr, is_divergence
20
24
 
21
25
  __all__ = [
22
26
  "Algorithm",
@@ -30,7 +34,6 @@ __all__ = [
30
34
  "OrderType",
31
35
  "OrderStatus",
32
36
  "OrderSide",
33
- "Config",
34
37
  "PortfolioConfiguration",
35
38
  "TimeUnit",
36
39
  "TimeInterval",
@@ -83,6 +86,8 @@ __all__ = [
83
86
  "get_adx",
84
87
  "has_crossed_downward",
85
88
  "get_willr",
86
- "is_bearish_divergence",
87
- "is_bullish_divergence",
89
+ "is_divergence",
90
+ "get_backtest_report",
91
+ "AzureBlobStorageStateHandler",
92
+ "DEFAULT_LOGGING_CONFIG"
88
93
  ]
@@ -23,13 +23,13 @@ class Algorithm:
23
23
  class is responsible for managing the strategies and executing
24
24
  them in the correct order.
25
25
 
26
- :param (optional) name: The name of the algorithm
27
- :param (optional) description: The description of the algorithm
28
- :param (optional) context: The context of the algorithm,
29
- for backtest references
30
- :param (optional) strategy: A single strategy to add to the algorithm
31
- :param (optional) data_sources: The list of data sources to
32
- add to the algorithm
26
+ Args:
27
+ name (str): The name of the algorithm
28
+ description (str): The description of the algorithm
29
+ context (dict): The context of the algorithm, for backtest
30
+ references
31
+ strategy: A single strategy to add to the algorithm
32
+ data_sources: The list of data sources to add to the algorithm
33
33
  """
34
34
  def __init__(
35
35
  self,
@@ -135,13 +135,25 @@ class Algorithm:
135
135
  self._strategies
136
136
  )
137
137
 
138
- def start(self, number_of_iterations=None, stateless=False):
138
+ def start(self, number_of_iterations: int = None):
139
+ """
140
+ Function to start the algorithm.
141
+ This function will start the algorithm by scheduling all
142
+ jobs in the strategy orchestrator service. The jobs are not
143
+ run immediately, but are scheduled to run in the future by the
144
+ app.
139
145
 
140
- if not stateless:
141
- self.strategy_orchestrator_service.start(
142
- algorithm=self,
143
- number_of_iterations=number_of_iterations
144
- )
146
+ Args:
147
+ number_of_iterations (int): (Optional) The number of
148
+ iterations to run the algorithm
149
+
150
+ Returns:
151
+ None
152
+ """
153
+ self.strategy_orchestrator_service.start(
154
+ algorithm=self,
155
+ number_of_iterations=number_of_iterations
156
+ )
145
157
 
146
158
  @property
147
159
  def name(self):
@@ -229,17 +241,20 @@ class Algorithm:
229
241
  and execute it if the execute parameter is set to True. If the
230
242
  validate parameter is set to True, the order will be validated
231
243
 
232
- :param target_symbol: The symbol of the asset to trade
233
- :param price: The price of the asset
234
- :param order_type: The type of the order
235
- :param order_side: The side of the order
236
- :param amount: The amount of the asset to trade
237
- :param market: The market to trade the asset
238
- :param execute: If set to True, the order will be executed
239
- :param validate: If set to True, the order will be validated
240
- :param sync: If set to True, the created order will be synced
241
- with the portfolio of the algorithm.
242
- :return: The order created
244
+ Args:
245
+ target_symbol: The symbol of the asset to trade
246
+ price: The price of the asset
247
+ order_type: The type of the order
248
+ order_side: The side of the order
249
+ amount: The amount of the asset to trade
250
+ market: The market to trade the asset
251
+ execute: If set to True, the order will be executed
252
+ validate: If set to True, the order will be validated
253
+ sync: If set to True, the created order will be synced
254
+ with the portfolio of the algorithm.
255
+
256
+ Returns:
257
+ The order created
243
258
  """
244
259
  portfolio = self.portfolio_service.find({"market": market})
245
260
  order_data = {
@@ -345,9 +360,8 @@ class Algorithm:
345
360
  "Percentage of portfolio is only supported for BUY orders."
346
361
  )
347
362
 
348
- percentage_of_portfolio = percentage_of_portfolio
349
363
  net_size = portfolio.get_net_size()
350
- size = net_size * percentage_of_portfolio / 100
364
+ size = net_size * (percentage_of_portfolio / 100)
351
365
  amount = size / price
352
366
 
353
367
  elif percentage_of_position is not None: