investing-algorithm-framework 6.5.1__tar.gz → 6.5.3__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 (201) hide show
  1. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/PKG-INFO +1 -1
  2. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/app.py +154 -117
  3. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/context.py +26 -5
  4. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/cli.py +3 -1
  5. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/app-web.py.template +1 -0
  6. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/app.py.template +1 -7
  7. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/app_azure_function.py.template +1 -7
  8. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/app_web.py.template +1 -7
  9. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/order_executor.py +6 -0
  10. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/portfolio_provider.py +10 -0
  11. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/market_data_source_service/market_data_source_service.py +13 -0
  12. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/portfolio_sync_service.py +0 -1
  13. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/pyproject.toml +1 -1
  14. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/LICENSE +0 -0
  15. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/README.md +0 -0
  16. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/__init__.py +0 -0
  17. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/__init__.py +0 -0
  18. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/algorithm.py +0 -0
  19. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/stateless/__init__.py +0 -0
  20. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/stateless/action_handlers/__init__.py +0 -0
  21. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/stateless/action_handlers/action_handler_strategy.py +0 -0
  22. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/stateless/action_handlers/check_online_handler.py +0 -0
  23. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/stateless/action_handlers/run_strategy_handler.py +0 -0
  24. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/stateless/exception_handler.py +0 -0
  25. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/strategy.py +0 -0
  26. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/task.py +0 -0
  27. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/__init__.py +0 -0
  28. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/controllers/__init__.py +0 -0
  29. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/controllers/orders.py +0 -0
  30. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/controllers/portfolio.py +0 -0
  31. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/controllers/positions.py +0 -0
  32. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/create_app.py +0 -0
  33. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/error_handler.py +0 -0
  34. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/responses.py +0 -0
  35. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/run_strategies.py +0 -0
  36. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/schemas/__init__.py +0 -0
  37. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/schemas/order.py +0 -0
  38. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/schemas/portfolio.py +0 -0
  39. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/schemas/position.py +0 -0
  40. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/setup_cors.py +0 -0
  41. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/__init__.py +0 -0
  42. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/deploy_to_azure_function.py +0 -0
  43. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/initialize_app.py +0 -0
  44. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/.gitignore.template +0 -0
  45. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/azure_function_function_app.py.template +0 -0
  46. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/azure_function_host.json.template +0 -0
  47. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/azure_function_local.settings.json.template +0 -0
  48. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/data_providers.py.template +0 -0
  49. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/env.example.template +0 -0
  50. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/env_azure_function.example.template +0 -0
  51. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/market_data_providers.py.template +0 -0
  52. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/readme.md.template +0 -0
  53. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/requirements.txt.template +0 -0
  54. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/requirements_azure_function.txt.template +0 -0
  55. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/run_backtest.py.template +0 -0
  56. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/strategy.py.template +0 -0
  57. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/create_app.py +0 -0
  58. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/dependency_container.py +0 -0
  59. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/__init__.py +0 -0
  60. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/config.py +0 -0
  61. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/constants.py +0 -0
  62. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/data_provider.py +0 -0
  63. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/data_structures.py +0 -0
  64. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/decimal_parsing.py +0 -0
  65. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/exceptions.py +0 -0
  66. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/metrics/__init__.py +0 -0
  67. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/metrics/price_efficiency.py +0 -0
  68. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/__init__.py +0 -0
  69. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/app_mode.py +0 -0
  70. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/backtesting/__init__.py +0 -0
  71. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/backtesting/backtest_date_range.py +0 -0
  72. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/backtesting/backtest_position.py +0 -0
  73. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/backtesting/backtest_report.py +0 -0
  74. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/backtesting/backtest_reports_evaluation.py +0 -0
  75. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/base_model.py +0 -0
  76. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/data_source.py +0 -0
  77. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/date_range.py +0 -0
  78. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/market/__init__.py +0 -0
  79. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/market/market_credential.py +0 -0
  80. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/market_data_type.py +0 -0
  81. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/order/__init__.py +0 -0
  82. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/order/order.py +0 -0
  83. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/order/order_side.py +0 -0
  84. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/order/order_status.py +0 -0
  85. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/order/order_type.py +0 -0
  86. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/portfolio/__init__.py +0 -0
  87. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/portfolio/portfolio.py +0 -0
  88. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/portfolio/portfolio_configuration.py +0 -0
  89. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/portfolio/portfolio_snapshot.py +0 -0
  90. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/position/__init__.py +0 -0
  91. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/position/position.py +0 -0
  92. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/position/position_snapshot.py +0 -0
  93. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/strategy_profile.py +0 -0
  94. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/time_frame.py +0 -0
  95. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/time_interval.py +0 -0
  96. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/time_unit.py +0 -0
  97. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/tracing/__init__.py +0 -0
  98. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/tracing/trace.py +0 -0
  99. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trade/__init__.py +0 -0
  100. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trade/trade.py +0 -0
  101. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trade/trade_risk_type.py +0 -0
  102. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trade/trade_status.py +0 -0
  103. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trade/trade_stop_loss.py +0 -0
  104. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trade/trade_take_profit.py +0 -0
  105. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trading_data_types.py +0 -0
  106. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trading_time_frame.py +0 -0
  107. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/__init__.py +0 -0
  108. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/market_credential_service.py +0 -0
  109. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/market_data_sources.py +0 -0
  110. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/market_service.py +0 -0
  111. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/portfolios/__init__.py +0 -0
  112. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/portfolios/portfolio_sync_service.py +0 -0
  113. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/rounding_service.py +0 -0
  114. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/state_handler.py +0 -0
  115. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/stateless_actions.py +0 -0
  116. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/strategy.py +0 -0
  117. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/__init__.py +0 -0
  118. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/backtesting.py +0 -0
  119. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/csv.py +0 -0
  120. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/polars.py +0 -0
  121. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/random.py +0 -0
  122. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/signatures.py +0 -0
  123. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/stoppable_thread.py +0 -0
  124. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/synchronized.py +0 -0
  125. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/download_data.py +0 -0
  126. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/__init__.py +0 -0
  127. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/data_providers/__init__.py +0 -0
  128. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/data_providers/ccxt.py +0 -0
  129. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/data_providers/csv.py +0 -0
  130. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/database/__init__.py +0 -0
  131. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/database/sql_alchemy.py +0 -0
  132. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/__init__.py +0 -0
  133. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/decimal_parser.py +0 -0
  134. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/market_data_sources/__init__.py +0 -0
  135. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/market_data_sources/ccxt.py +0 -0
  136. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/market_data_sources/csv.py +0 -0
  137. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/market_data_sources/pandas.py +0 -0
  138. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/market_data_sources/us_treasury_yield.py +0 -0
  139. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/model_extension.py +0 -0
  140. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/order/__init__.py +0 -0
  141. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/order/order.py +0 -0
  142. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/order/order_metadata.py +0 -0
  143. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/order_trade_association.py +0 -0
  144. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/portfolio/__init__.py +0 -0
  145. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/portfolio/portfolio_snapshot.py +0 -0
  146. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/portfolio/sql_portfolio.py +0 -0
  147. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/position/__init__.py +0 -0
  148. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/position/position.py +0 -0
  149. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/position/position_snapshot.py +0 -0
  150. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/trades/__init__.py +0 -0
  151. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/trades/trade.py +0 -0
  152. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/trades/trade_stop_loss.py +0 -0
  153. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/trades/trade_take_profit.py +0 -0
  154. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/order_executors/__init__.py +0 -0
  155. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/order_executors/ccxt_order_executor.py +0 -0
  156. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/portfolio_providers/__init__.py +0 -0
  157. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/portfolio_providers/ccxt_portfolio_provider.py +0 -0
  158. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/__init__.py +0 -0
  159. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/order_metadata_repository.py +0 -0
  160. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/order_repository.py +0 -0
  161. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/portfolio_repository.py +0 -0
  162. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/portfolio_snapshot_repository.py +0 -0
  163. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/position_repository.py +0 -0
  164. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/position_snapshot_repository.py +0 -0
  165. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/repository.py +0 -0
  166. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/trade_repository.py +0 -0
  167. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/trade_stop_loss_repository.py +0 -0
  168. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/trade_take_profit_repository.py +0 -0
  169. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/__init__.py +0 -0
  170. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/azure/__init__.py +0 -0
  171. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/azure/state_handler.py +0 -0
  172. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/market_service/__init__.py +0 -0
  173. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/market_service/ccxt_market_service.py +0 -0
  174. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/performance_service/__init__.py +0 -0
  175. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/performance_service/backtest_performance_service.py +0 -0
  176. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/performance_service/performance_service.py +0 -0
  177. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/__init__.py +0 -0
  178. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/backtesting/__init__.py +0 -0
  179. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/backtesting/backtest_service.py +0 -0
  180. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/configuration_service.py +0 -0
  181. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/market_credential_service.py +0 -0
  182. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/market_data_source_service/__init__.py +0 -0
  183. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/market_data_source_service/backtest_market_data_source_service.py +0 -0
  184. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/market_data_source_service/data_provider_service.py +0 -0
  185. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/order_service/__init__.py +0 -0
  186. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/order_service/order_backtest_service.py +0 -0
  187. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/order_service/order_executor_lookup.py +0 -0
  188. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/order_service/order_service.py +0 -0
  189. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/__init__.py +0 -0
  190. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/backtest_portfolio_service.py +0 -0
  191. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/portfolio_configuration_service.py +0 -0
  192. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/portfolio_provider_lookup.py +0 -0
  193. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/portfolio_service.py +0 -0
  194. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/portfolio_snapshot_service.py +0 -0
  195. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/positions/__init__.py +0 -0
  196. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/positions/position_service.py +0 -0
  197. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/positions/position_snapshot_service.py +0 -0
  198. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/repository_service.py +0 -0
  199. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/strategy_orchestrator_service.py +0 -0
  200. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/trade_service/__init__.py +0 -0
  201. {investing_algorithm_framework-6.5.1 → investing_algorithm_framework-6.5.3}/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: 6.5.1
3
+ Version: 6.5.3
4
4
  Summary: A framework for creating trading bots
5
5
  Author: MDUYN
6
6
  Requires-Python: >=3.10
@@ -24,8 +24,7 @@ from investing_algorithm_framework.domain import DATABASE_NAME, TimeUnit, \
24
24
  from investing_algorithm_framework.infrastructure import setup_sqlalchemy, \
25
25
  create_all_tables, CCXTOrderExecutor, CCXTPortfolioProvider
26
26
  from investing_algorithm_framework.services import OrderBacktestService, \
27
- BacktestMarketDataSourceService, BacktestPortfolioService, \
28
- MarketDataSourceService, MarketCredentialService
27
+ BacktestMarketDataSourceService, BacktestPortfolioService
29
28
 
30
29
  logger = logging.getLogger("investing_algorithm_framework")
31
30
  COLOR_RESET = '\033[0m'
@@ -85,12 +84,7 @@ class App:
85
84
  self.container = None
86
85
  self._started = False
87
86
  self._tasks = []
88
- self._configuration_service = None
89
- self._market_data_source_service: \
90
- Optional[MarketDataSourceService] = None
91
87
  self._market_data_sources = []
92
- self._market_credential_service: \
93
- Optional[MarketCredentialService] = None
94
88
  self._on_initialize_hooks = []
95
89
  self._on_strategy_run_hooks = []
96
90
  self._on_after_initialize_hooks = []
@@ -161,10 +155,8 @@ class App:
161
155
  Returns:
162
156
  None
163
157
  """
164
- self._market_data_source_service = \
165
- self.container.market_data_source_service()
166
- self._market_credential_service = \
167
- self.container.market_credential_service()
158
+ self._initialize_default_order_executors()
159
+ self._initialize_default_portfolio_providers()
168
160
 
169
161
  strategy_orchestrator_service = \
170
162
  self.container.strategy_orchestrator_service()
@@ -172,6 +164,82 @@ class App:
172
164
  for app_hook in self._on_strategy_run_hooks:
173
165
  strategy_orchestrator_service.add_app_hook(app_hook)
174
166
 
167
+ # Initialize all market credentials
168
+ market_credential_service = self.container.market_credential_service()
169
+ market_credential_service.initialize()
170
+
171
+ def initialize_services_backtest(self) -> None:
172
+ """
173
+ Method to initialize the services for the app in backtest mode.
174
+ This method should be called before running the application.
175
+ This method initializes all services so that they are ready to
176
+ be used.
177
+
178
+ The method overrides the portfolio service, market data source
179
+ service and order service with the backtest equivalents.
180
+
181
+ App hooks are not added when running in backtest mode.
182
+ Returns:
183
+ None
184
+ """
185
+ configuration_service = self.container.configuration_service()
186
+ self._initialize_default_order_executors()
187
+ self._initialize_default_portfolio_providers()
188
+ portfolio_conf_service = self.container \
189
+ .portfolio_configuration_service()
190
+ portfolio_snap_service = self.container \
191
+ .portfolio_snapshot_service()
192
+ market_cred_service = self.container.market_credential_service()
193
+ portfolio_provider_lookup = \
194
+ self.container.portfolio_provider_lookup()
195
+ # Override the portfolio service with the backtest
196
+ # portfolio service
197
+ self.container.portfolio_service.override(
198
+ BacktestPortfolioService(
199
+ configuration_service=configuration_service,
200
+ market_credential_service=market_cred_service,
201
+ position_service=self.container.position_service(),
202
+ order_service=self.container.order_service(),
203
+ portfolio_repository=self.container.portfolio_repository(),
204
+ portfolio_configuration_service=portfolio_conf_service,
205
+ portfolio_snapshot_service=portfolio_snap_service,
206
+ portfolio_provider_lookup=portfolio_provider_lookup
207
+ )
208
+ )
209
+
210
+ # Override the market data source service with the backtest market
211
+ # data source service
212
+ self.container.market_data_source_service.override(
213
+ BacktestMarketDataSourceService(
214
+ market_service=self.container.market_service(),
215
+ market_credential_service=self.container
216
+ .market_credential_service(),
217
+ configuration_service=self.container
218
+ .configuration_service(),
219
+ )
220
+ )
221
+
222
+ portfolio_conf_service = self.container. \
223
+ portfolio_configuration_service()
224
+ portfolio_snap_service = self.container. \
225
+ portfolio_snapshot_service()
226
+ configuration_service = self.container.configuration_service()
227
+ market_data_source_service = self.container. \
228
+ market_data_source_service()
229
+ # Override the order service with the backtest order service
230
+ self.container.order_service.override(
231
+ OrderBacktestService(
232
+ trade_service=self.container.trade_service(),
233
+ order_repository=self.container.order_repository(),
234
+ position_service=self.container.position_service(),
235
+ portfolio_repository=self.container.portfolio_repository(),
236
+ portfolio_configuration_service=portfolio_conf_service,
237
+ portfolio_snapshot_service=portfolio_snap_service,
238
+ configuration_service=configuration_service,
239
+ market_data_source_service=market_data_source_service
240
+ )
241
+ )
242
+
175
243
  @algorithm.setter
176
244
  def algorithm(self, algorithm: Algorithm) -> None:
177
245
  self._algorithm = algorithm
@@ -251,6 +319,39 @@ class App:
251
319
  if APP_MODE not in config:
252
320
  configuration_service.add_value(APP_MODE, AppMode.DEFAULT.value)
253
321
 
322
+ def initialize_data_sources(self):
323
+ """
324
+ Function to initialize the data sources for the app. This method
325
+ should be called before running the algorithm. This method
326
+ initializes all data sources so that they are ready to be used.
327
+
328
+ Returns:
329
+ None
330
+ """
331
+ logger.info("Initializing data sources")
332
+ market_data_source_service = self.container \
333
+ .market_data_source_service()
334
+
335
+ # Add all market data sources of the strategies
336
+ # to the market data source service
337
+ market_data_source_service.market_data_sources = \
338
+ self._market_data_sources
339
+
340
+ for strategy in self.algorithm.strategies:
341
+
342
+ if strategy.market_data_sources is not None:
343
+ for market_data_source in strategy.market_data_sources:
344
+ market_data_source_service.add(market_data_source)
345
+
346
+ # Check if the algorithm has data sources registered
347
+ if len(self.algorithm.data_sources) == 0:
348
+
349
+ for data_source in self.algorithm.data_sources:
350
+ self.add_market_data_source(data_source)
351
+
352
+ # Initialize the market data source service
353
+ market_data_source_service.initialize_market_data_sources()
354
+
254
355
  def initialize(self):
255
356
  """
256
357
  Method to initialize the app. This method should be called before
@@ -263,23 +364,14 @@ class App:
263
364
  None
264
365
  """
265
366
  logger.info("Initializing app")
266
- self.initialize_services()
267
- self._initialize_default_order_executors()
268
- self._initialize_default_portfolio_providers()
269
367
 
270
368
  if self.algorithm is None:
271
369
  raise OperationalException("No algorithm registered")
272
370
 
273
- # Check if the algorithm has data sources registered
274
- if len(self.algorithm.data_sources) == 0:
275
-
276
- for data_source in self.algorithm.data_sources:
277
- self.add_market_data_source(data_source)
278
-
279
371
  # Ensure that all resource directories exist
280
372
  self._create_resources_if_not_exists()
281
373
 
282
- # Setup the database
374
+ # Set up the database
283
375
  setup_sqlalchemy(self)
284
376
  create_all_tables()
285
377
 
@@ -288,88 +380,11 @@ class App:
288
380
 
289
381
  # Initialize services in backtest
290
382
  if Environment.BACKTEST.equals(config[ENVIRONMENT]):
291
-
292
- configuration_service = self.container.configuration_service()
293
- portfolio_conf_service = self.container \
294
- .portfolio_configuration_service()
295
- portfolio_snap_service = self.container \
296
- .portfolio_snapshot_service()
297
- market_cred_service = self.container.market_credential_service()
298
- portfolio_provider_lookup = \
299
- self.container.portfolio_provider_lookup()
300
- # Override the portfolio service with the backtest
301
- # portfolio service
302
- self.container.portfolio_service.override(
303
- BacktestPortfolioService(
304
- configuration_service=configuration_service,
305
- market_credential_service=market_cred_service,
306
- position_service=self.container.position_service(),
307
- order_service=self.container.order_service(),
308
- portfolio_repository=self.container.portfolio_repository(),
309
- portfolio_configuration_service=portfolio_conf_service,
310
- portfolio_snapshot_service=portfolio_snap_service,
311
- portfolio_provider_lookup=portfolio_provider_lookup
312
- )
313
- )
314
-
315
- # Get all current market data sources
316
- market_data_sources = self._market_data_source_service \
317
- .get_market_data_sources()
318
-
319
- # Override the market data source service with the backtest market
320
- # data source service
321
- self.container.market_data_source_service.override(
322
- BacktestMarketDataSourceService(
323
- market_service=self.container.market_service(),
324
- market_credential_service=self.container
325
- .market_credential_service(),
326
- configuration_service=self.container
327
- .configuration_service(),
328
- market_data_sources=market_data_sources
329
- )
330
- )
331
-
332
- portfolio_conf_service = self.container.\
333
- portfolio_configuration_service()
334
- portfolio_snap_service = self.container.\
335
- portfolio_snapshot_service()
336
- configuration_service = self.container.configuration_service()
337
- market_data_source_service = self.container.\
338
- market_data_source_service()
339
- # Override the order service with the backtest order service
340
- self.container.order_service.override(
341
- OrderBacktestService(
342
- trade_service=self.container.trade_service(),
343
- order_repository=self.container.order_repository(),
344
- position_service=self.container.position_service(),
345
- portfolio_repository=self.container.portfolio_repository(),
346
- portfolio_configuration_service=portfolio_conf_service,
347
- portfolio_snapshot_service=portfolio_snap_service,
348
- configuration_service=configuration_service,
349
- market_data_source_service=market_data_source_service
350
- )
351
- )
383
+ self.initialize_services_backtest()
352
384
  else:
353
- # Initialize all market credentials
354
- self._market_credential_service = self.container.\
355
- market_credential_service()
356
- self._market_credential_service.initialize()
357
-
358
- # Add all market data sources of the strategies to the market data
359
- # source service
360
- self._market_data_source_service = self.container.\
361
- market_data_source_service()
362
- self._market_data_source_service.market_data_sources = \
363
- self._market_data_sources
364
-
365
- for strategy in self.algorithm.strategies:
366
-
367
- if strategy.market_data_sources is not None:
368
- for market_data_source in strategy.market_data_sources:
369
- self._market_data_source_service.add(market_data_source)
385
+ self.initialize_services()
370
386
 
371
- # Initialize the market data source service
372
- self._market_data_source_service.initialize_market_data_sources()
387
+ self.initialize_data_sources()
373
388
 
374
389
  portfolio_configuration_service = self.container \
375
390
  .portfolio_configuration_service()
@@ -385,7 +400,8 @@ class App:
385
400
  self.algorithm.initialize_services(
386
401
  context=self.container.context(),
387
402
  configuration_service=self.container.configuration_service(),
388
- market_data_source_service=self._market_data_source_service,
403
+ market_data_source_service=self.container
404
+ .market_data_source_service(),
389
405
  market_credential_service=self.container
390
406
  .market_credential_service(),
391
407
  portfolio_service=self.container.portfolio_service(),
@@ -399,12 +415,10 @@ class App:
399
415
  trade_service=self.container.trade_service(),
400
416
  )
401
417
 
402
- config = self.container.configuration_service().get_config()
418
+ configuration_service = self.container.configuration_service()
403
419
 
404
420
  if config[APP_MODE] == AppMode.WEB.value:
405
- self._configuration_service.add_value(
406
- APP_MODE, AppMode.WEB.value
407
- )
421
+ configuration_service.add_value(APP_MODE, AppMode.WEB.value)
408
422
  self._initialize_web()
409
423
 
410
424
  self._initialize_portfolios()
@@ -741,7 +755,8 @@ class App:
741
755
  })
742
756
 
743
757
  self.initialize_config()
744
- config = self._configuration_service.get_config()
758
+ configuration_service = self.container.configuration_service()
759
+ config = configuration_service.get_config()
745
760
  path = os.path.join(
746
761
  config[DATABASE_DIRECTORY_PATH],
747
762
  config[DATABASE_NAME]
@@ -851,7 +866,8 @@ class App:
851
866
  })
852
867
  self.initialize_config()
853
868
 
854
- config = self._configuration_service.get_config()
869
+ configuration_service = self.container.configuration_service()
870
+ config = configuration_service.get_config()
855
871
 
856
872
  path = os.path.join(
857
873
  config[DATABASE_DIRECTORY_PATH],
@@ -897,7 +913,7 @@ class App:
897
913
 
898
914
  This is a seperate function from the market data source service. This
899
915
  is because the market data source service can be re-initialized.
900
- Therefore we need a persistent list of market data sources in the app.
916
+ Therefore, we need a persistent list of market data sources in the app.
901
917
 
902
918
  Args:
903
919
  market_data_source: Instance of MarketDataSource
@@ -917,18 +933,36 @@ class App:
917
933
  market_data_source.get_identifier():
918
934
  return
919
935
 
920
- market_data_source.market_credential_service = \
921
- self._market_credential_service
922
936
  self._market_data_sources.append(market_data_source)
923
937
 
924
- def add_market_credential(self, market_credential: MarketCredential):
938
+ def add_market_credential(
939
+ self, market_credential: MarketCredential
940
+ ) -> None:
941
+ """
942
+ Function to add a market credential to the app. The market
943
+ credential should be an instance of MarketCredential.
944
+
945
+ Args:
946
+ market_credential:
947
+
948
+ Returns:
949
+ None
950
+ """
925
951
  market_credential.market = market_credential.market.upper()
926
- self._market_credential_service.add(market_credential)
952
+ market_credential_service = self.container \
953
+ .market_credential_service()
954
+ market_credential_service.add(market_credential)
927
955
 
928
956
  def on_initialize(self, app_hook):
929
957
  """
930
958
  Function to add a hook that runs when the app is initialized. The hook
931
959
  should be an instance of AppHook.
960
+
961
+ Args:
962
+ app_hook: Instance of AppHook
963
+
964
+ Returns:
965
+ None
932
966
  """
933
967
 
934
968
  # Check if the app_hook inherits from AppHook
@@ -1242,7 +1276,8 @@ class App:
1242
1276
  portfolio_provider_lookup = \
1243
1277
  self.container.portfolio_provider_lookup()
1244
1278
  order_executor_lookup = self.container.order_executor_lookup()
1245
-
1279
+ market_credential_service = \
1280
+ self.container.market_credential_service()
1246
1281
  # Register portfolio providers and order executors
1247
1282
  for portfolio_configuration in portfolio_configurations:
1248
1283
 
@@ -1258,7 +1293,7 @@ class App:
1258
1293
  )
1259
1294
 
1260
1295
  market_credential = \
1261
- self._market_credential_service.get(
1296
+ market_credential_service.get(
1262
1297
  portfolio_configuration.market
1263
1298
  )
1264
1299
 
@@ -1279,6 +1314,8 @@ class App:
1279
1314
 
1280
1315
  logger.info("Portfolio configurations complete")
1281
1316
  logger.info("Syncing portfolios")
1317
+ portfolio_provider_lookup = \
1318
+ self.container.portfolio_provider_lookup()
1282
1319
  portfolio_service = self.container.portfolio_service()
1283
1320
  portfolio_sync_service = self.container.portfolio_sync_service()
1284
1321
 
@@ -1300,7 +1337,7 @@ class App:
1300
1337
  logger.info("Adding default portfolio providers")
1301
1338
  portfolio_provider_lookup = self.container.portfolio_provider_lookup()
1302
1339
  portfolio_provider_lookup.add_portfolio_provider(
1303
- CCXTPortfolioProvider()
1340
+ CCXTPortfolioProvider(priority=2)
1304
1341
  )
1305
1342
 
1306
1343
  def _initialize_default_order_executors(self):
@@ -1316,5 +1353,5 @@ class App:
1316
1353
  logger.info("Adding default order executors")
1317
1354
  order_executor_lookup = self.container.order_executor_lookup()
1318
1355
  order_executor_lookup.add_order_executor(
1319
- CCXTOrderExecutor()
1356
+ CCXTOrderExecutor(priority=2)
1320
1357
  )
@@ -8,7 +8,7 @@ from investing_algorithm_framework.services import ConfigurationService, \
8
8
  from investing_algorithm_framework.domain import OrderStatus, OrderType, \
9
9
  OrderSide, OperationalException, Portfolio, RoundingService, \
10
10
  BACKTESTING_FLAG, BACKTESTING_INDEX_DATETIME, TradeRiskType, Order, \
11
- Position, Trade, TradeStatus, MarketService
11
+ Position, Trade, TradeStatus, MarketService, MarketCredential
12
12
 
13
13
  logger = logging.getLogger("investing_algorithm_framework")
14
14
 
@@ -1205,7 +1205,7 @@ class Context:
1205
1205
  self,
1206
1206
  trade,
1207
1207
  percentage: float,
1208
- trade_risk_type: TradeRiskType = TradeRiskType.FIXED,
1208
+ trade_risk_type=TradeRiskType.FIXED,
1209
1209
  sell_percentage: float = 100,
1210
1210
  ):
1211
1211
  """
@@ -1248,7 +1248,7 @@ class Context:
1248
1248
  self,
1249
1249
  trade,
1250
1250
  percentage: float,
1251
- trade_risk_type: TradeRiskType = TradeRiskType.FIXED,
1251
+ trade_risk_type=TradeRiskType.FIXED,
1252
1252
  sell_percentage: float = 100,
1253
1253
  ) -> None:
1254
1254
  """
@@ -1431,7 +1431,7 @@ class Context:
1431
1431
  )
1432
1432
 
1433
1433
  return sum(
1434
- [order.get_amount() * order.get_price()
1434
+ [order.get_remaining() * order.get_price()
1435
1435
  for order in pending_orders]
1436
1436
  )
1437
1437
 
@@ -1444,6 +1444,27 @@ class Context:
1444
1444
  )
1445
1445
 
1446
1446
  return sum(
1447
- [order.get_amount() * order.get_price()
1447
+ [order.get_remaining() * order.get_price()
1448
1448
  for order in pending_orders]
1449
1449
  )
1450
+
1451
+ def get_market_credential(self, market) -> MarketCredential:
1452
+ """
1453
+ Function to get the market credential for a given market.
1454
+
1455
+ Args:
1456
+ market: The market to get the credential for
1457
+
1458
+ Returns:
1459
+ MarketCredential: The market credential for the given market
1460
+ """
1461
+ return self.market_credential_service.get(market)
1462
+
1463
+ def get_market_credentials(self) -> List[MarketCredential]:
1464
+ """
1465
+ Function to get all market credentials.
1466
+
1467
+ Returns:
1468
+ List[MarketCredential]: A list of all market credentials
1469
+ """
1470
+ return self.market_credential_service.get_all()
@@ -23,7 +23,7 @@ def cli():
23
23
  '--type',
24
24
  default="default",
25
25
  help="Type of app to create. "
26
- "Options are: 'default', 'default-web', 'azure-function'."
26
+ "Options are: 'default', 'default_web', 'azure_function'."
27
27
  )
28
28
  @click.option(
29
29
  '--path', default=None, help="Path to directory to initialize the app in"
@@ -43,6 +43,8 @@ def init(type, path, replace):
43
43
  type (str): Type of app to create. Options are: 'default',
44
44
  'default-web', 'azure-function'.
45
45
  path (str): Path to directory to initialize the app in
46
+ replace (bool): If True, existing files will be replaced.
47
+ If False, existing files will not be replaced.
46
48
 
47
49
  Returns:
48
50
  None
@@ -9,6 +9,7 @@ load_dotenv()
9
9
  logging.config.dictConfig(DEFAULT_LOGGING_CONFIG)
10
10
 
11
11
  app = create_app(web=True)
12
+ app.add_market(market="binance", initial_balance=1000, trading_symbol="EUR")
12
13
  algorithm = Algorithm(name="MyTradingBot")
13
14
  algorithm.add_strategy(MyTradingStrategy)
14
15
  app.add_algorithm(algorithm)
@@ -9,13 +9,7 @@ load_dotenv()
9
9
  logging.config.dictConfig(DEFAULT_LOGGING_CONFIG)
10
10
 
11
11
  app = create_app()
12
- app.add_portfolio_configuration(
13
- PortfolioConfiguration(
14
- initial_balance=1000,
15
- trading_symbol="EUR",
16
- market="bitvavo"
17
- )
18
- )
12
+ app.add_market(market="binance", initial_balance=1000, trading_symbol="EUR")
19
13
  algorithm = Algorithm(name="MyTradingBot")
20
14
  algorithm.add_strategy(MyTradingStrategy)
21
15
  app.add_algorithm(algorithm)
@@ -8,13 +8,7 @@ from strategies.strategy import MyTradingStrategy
8
8
  load_dotenv()
9
9
 
10
10
  app = create_app()
11
- app.add_portfolio_configuration(
12
- PortfolioConfiguration(
13
- initial_balance=1000,
14
- trading_symbol="EUR",
15
- market="bitvavo"
16
- )
17
- )
11
+ app.add_market(market="binance", initial_balance=1000, trading_symbol="EUR")
18
12
  algorithm = Algorithm(name="MyTradingBot")
19
13
  algorithm.add_strategy(MyTradingStrategy)
20
14
  app.add_algorithm(algorithm)
@@ -9,13 +9,7 @@ load_dotenv()
9
9
  logging.config.dictConfig(DEFAULT_LOGGING_CONFIG)
10
10
 
11
11
  app = create_app(web=True)
12
- app.add_portfolio_configuration(
13
- PortfolioConfiguration(
14
- initial_balance=1000,
15
- trading_symbol="EUR",
16
- market="bitvavo"
17
- )
18
- )
12
+ app.add_market(market="binance", initial_balance=1000, trading_symbol="EUR")
19
13
  algorithm = Algorithm(name="MyTradingBot")
20
14
  algorithm.add_strategy(MyTradingStrategy)
21
15
  app.add_algorithm(algorithm)
@@ -85,3 +85,9 @@ class OrderExecutor(ABC):
85
85
  raise NotImplementedError(
86
86
  "Subclasses must implement this method."
87
87
  )
88
+
89
+ def __repr__(self):
90
+ """
91
+ Returns a string representation of the order executor.
92
+ """
93
+ return f"{self.__class__.__name__}(priority={self._priority})"
@@ -26,6 +26,13 @@ class PortfolioProvider(ABC):
26
26
  """
27
27
  return self._priority
28
28
 
29
+ @priority.setter
30
+ def priority(self, value: int):
31
+ """
32
+ Sets the priority of the portfolio provider.
33
+ """
34
+ self._priority = value
35
+
29
36
  @abstractmethod
30
37
  def get_order(
31
38
  self, portfolio, order, market_credential
@@ -87,3 +94,6 @@ class PortfolioProvider(ABC):
87
94
  bool: True if the market is supported, False otherwise
88
95
  """
89
96
  raise NotImplementedError("Subclasses must implement this method.")
97
+
98
+ def __repr__(self):
99
+ return f"{self.__class__.__name__}(priority={self.priority})"
@@ -20,6 +20,19 @@ class MarketDataSourceService:
20
20
  source that matches the symbol, market and time frame provided by the user.
21
21
  If there is, it will use that market data source to get the data. If there
22
22
  is not, it will use the MarketService to get the data.
23
+
24
+ Attributes:
25
+ market_service: MarketService - The market service to use to get
26
+ the data if there is no market data source that matches the
27
+ symbol, market and time frame provided by the user.
28
+ market_credential_service: MarketCredentialService - The market
29
+ credential service to use to get the credentials for the market
30
+ data sources.
31
+ configuration_service: ConfigurationService - The configuration
32
+ service to use to get the configuration for the market data
33
+ sources.
34
+ market_data_sources: List[MarketDataSource] - The list of market
35
+ data sources to use to get the data.
23
36
  """
24
37
  _market_data_sources: List[MarketDataSource] = []
25
38
 
@@ -87,7 +87,6 @@ class PortfolioSyncService(AbstractPortfolioSyncService):
87
87
 
88
88
  portfolio_provider = self.portfolio_provider_lookup\
89
89
  .get_portfolio_provider(portfolio.market)
90
-
91
90
  position = portfolio_provider.get_position(
92
91
  portfolio, portfolio.trading_symbol, market_credential
93
92
  )
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "investing-algorithm-framework"
3
- version = "v6.5.1"
3
+ version = "v6.5.3"
4
4
  description = "A framework for creating trading bots"
5
5
  authors = ["MDUYN"]
6
6
  readme = "README.md"