investing-algorithm-framework 6.5.2__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.
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/PKG-INFO +1 -1
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/app.py +154 -118
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/context.py +2 -2
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/cli.py +3 -1
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/app-web.py.template +1 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/app.py.template +1 -7
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/app_azure_function.py.template +1 -7
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/app_web.py.template +1 -7
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/order_executor.py +6 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/portfolio_provider.py +10 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/market_data_source_service/market_data_source_service.py +13 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/portfolio_sync_service.py +0 -1
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/pyproject.toml +1 -1
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/LICENSE +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/README.md +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/algorithm.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/stateless/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/stateless/action_handlers/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/stateless/action_handlers/action_handler_strategy.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/stateless/action_handlers/check_online_handler.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/stateless/action_handlers/run_strategy_handler.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/stateless/exception_handler.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/strategy.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/task.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/controllers/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/controllers/orders.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/controllers/portfolio.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/controllers/positions.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/create_app.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/error_handler.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/responses.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/run_strategies.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/schemas/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/schemas/order.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/schemas/portfolio.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/schemas/position.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/app/web/setup_cors.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/deploy_to_azure_function.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/initialize_app.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/.gitignore.template +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/azure_function_function_app.py.template +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/azure_function_host.json.template +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/azure_function_local.settings.json.template +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/data_providers.py.template +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/env.example.template +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/env_azure_function.example.template +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/market_data_providers.py.template +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/readme.md.template +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/requirements.txt.template +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/requirements_azure_function.txt.template +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/run_backtest.py.template +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/cli/templates/strategy.py.template +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/create_app.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/dependency_container.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/config.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/constants.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/data_provider.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/data_structures.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/decimal_parsing.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/exceptions.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/metrics/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/metrics/price_efficiency.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/app_mode.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/backtesting/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/backtesting/backtest_date_range.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/backtesting/backtest_position.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/backtesting/backtest_report.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/backtesting/backtest_reports_evaluation.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/base_model.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/data_source.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/date_range.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/market/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/market/market_credential.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/market_data_type.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/order/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/order/order.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/order/order_side.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/order/order_status.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/order/order_type.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/portfolio/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/portfolio/portfolio.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/portfolio/portfolio_configuration.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/portfolio/portfolio_snapshot.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/position/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/position/position.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/position/position_snapshot.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/strategy_profile.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/time_frame.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/time_interval.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/time_unit.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/tracing/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/tracing/trace.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trade/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trade/trade.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trade/trade_risk_type.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trade/trade_status.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trade/trade_stop_loss.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trade/trade_take_profit.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trading_data_types.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/models/trading_time_frame.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/market_credential_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/market_data_sources.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/market_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/portfolios/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/portfolios/portfolio_sync_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/rounding_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/services/state_handler.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/stateless_actions.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/strategy.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/backtesting.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/csv.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/polars.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/random.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/signatures.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/stoppable_thread.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/domain/utils/synchronized.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/download_data.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/data_providers/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/data_providers/ccxt.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/data_providers/csv.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/database/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/database/sql_alchemy.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/decimal_parser.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/market_data_sources/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/market_data_sources/ccxt.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/market_data_sources/csv.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/market_data_sources/pandas.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/market_data_sources/us_treasury_yield.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/model_extension.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/order/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/order/order.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/order/order_metadata.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/order_trade_association.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/portfolio/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/portfolio/portfolio_snapshot.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/portfolio/sql_portfolio.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/position/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/position/position.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/position/position_snapshot.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/trades/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/trades/trade.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/trades/trade_stop_loss.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/models/trades/trade_take_profit.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/order_executors/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/order_executors/ccxt_order_executor.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/portfolio_providers/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/portfolio_providers/ccxt_portfolio_provider.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/order_metadata_repository.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/order_repository.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/portfolio_repository.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/portfolio_snapshot_repository.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/position_repository.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/position_snapshot_repository.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/repository.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/trade_repository.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/trade_stop_loss_repository.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/repositories/trade_take_profit_repository.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/azure/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/azure/state_handler.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/market_service/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/market_service/ccxt_market_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/performance_service/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/performance_service/backtest_performance_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/infrastructure/services/performance_service/performance_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/backtesting/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/backtesting/backtest_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/configuration_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/market_credential_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/market_data_source_service/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/market_data_source_service/backtest_market_data_source_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/market_data_source_service/data_provider_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/order_service/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/order_service/order_backtest_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/order_service/order_executor_lookup.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/order_service/order_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/backtest_portfolio_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/portfolio_configuration_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/portfolio_provider_lookup.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/portfolio_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/portfolios/portfolio_snapshot_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/positions/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/positions/position_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/positions/position_snapshot_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/repository_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/strategy_orchestrator_service.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/trade_service/__init__.py +0 -0
- {investing_algorithm_framework-6.5.2 → investing_algorithm_framework-6.5.3}/investing_algorithm_framework/services/trade_service/trade_service.py +0 -0
|
@@ -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,11 +155,8 @@ class App:
|
|
|
161
155
|
Returns:
|
|
162
156
|
None
|
|
163
157
|
"""
|
|
164
|
-
self.
|
|
165
|
-
|
|
166
|
-
self._market_credential_service = \
|
|
167
|
-
self.container.market_credential_service()
|
|
168
|
-
self._configuration_service = self.container.configuration_service()
|
|
158
|
+
self._initialize_default_order_executors()
|
|
159
|
+
self._initialize_default_portfolio_providers()
|
|
169
160
|
|
|
170
161
|
strategy_orchestrator_service = \
|
|
171
162
|
self.container.strategy_orchestrator_service()
|
|
@@ -173,6 +164,82 @@ class App:
|
|
|
173
164
|
for app_hook in self._on_strategy_run_hooks:
|
|
174
165
|
strategy_orchestrator_service.add_app_hook(app_hook)
|
|
175
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
|
+
|
|
176
243
|
@algorithm.setter
|
|
177
244
|
def algorithm(self, algorithm: Algorithm) -> None:
|
|
178
245
|
self._algorithm = algorithm
|
|
@@ -252,6 +319,39 @@ class App:
|
|
|
252
319
|
if APP_MODE not in config:
|
|
253
320
|
configuration_service.add_value(APP_MODE, AppMode.DEFAULT.value)
|
|
254
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
|
+
|
|
255
355
|
def initialize(self):
|
|
256
356
|
"""
|
|
257
357
|
Method to initialize the app. This method should be called before
|
|
@@ -264,23 +364,14 @@ class App:
|
|
|
264
364
|
None
|
|
265
365
|
"""
|
|
266
366
|
logger.info("Initializing app")
|
|
267
|
-
self.initialize_services()
|
|
268
|
-
self._initialize_default_order_executors()
|
|
269
|
-
self._initialize_default_portfolio_providers()
|
|
270
367
|
|
|
271
368
|
if self.algorithm is None:
|
|
272
369
|
raise OperationalException("No algorithm registered")
|
|
273
370
|
|
|
274
|
-
# Check if the algorithm has data sources registered
|
|
275
|
-
if len(self.algorithm.data_sources) == 0:
|
|
276
|
-
|
|
277
|
-
for data_source in self.algorithm.data_sources:
|
|
278
|
-
self.add_market_data_source(data_source)
|
|
279
|
-
|
|
280
371
|
# Ensure that all resource directories exist
|
|
281
372
|
self._create_resources_if_not_exists()
|
|
282
373
|
|
|
283
|
-
#
|
|
374
|
+
# Set up the database
|
|
284
375
|
setup_sqlalchemy(self)
|
|
285
376
|
create_all_tables()
|
|
286
377
|
|
|
@@ -289,88 +380,11 @@ class App:
|
|
|
289
380
|
|
|
290
381
|
# Initialize services in backtest
|
|
291
382
|
if Environment.BACKTEST.equals(config[ENVIRONMENT]):
|
|
292
|
-
|
|
293
|
-
configuration_service = self.container.configuration_service()
|
|
294
|
-
portfolio_conf_service = self.container \
|
|
295
|
-
.portfolio_configuration_service()
|
|
296
|
-
portfolio_snap_service = self.container \
|
|
297
|
-
.portfolio_snapshot_service()
|
|
298
|
-
market_cred_service = self.container.market_credential_service()
|
|
299
|
-
portfolio_provider_lookup = \
|
|
300
|
-
self.container.portfolio_provider_lookup()
|
|
301
|
-
# Override the portfolio service with the backtest
|
|
302
|
-
# portfolio service
|
|
303
|
-
self.container.portfolio_service.override(
|
|
304
|
-
BacktestPortfolioService(
|
|
305
|
-
configuration_service=configuration_service,
|
|
306
|
-
market_credential_service=market_cred_service,
|
|
307
|
-
position_service=self.container.position_service(),
|
|
308
|
-
order_service=self.container.order_service(),
|
|
309
|
-
portfolio_repository=self.container.portfolio_repository(),
|
|
310
|
-
portfolio_configuration_service=portfolio_conf_service,
|
|
311
|
-
portfolio_snapshot_service=portfolio_snap_service,
|
|
312
|
-
portfolio_provider_lookup=portfolio_provider_lookup
|
|
313
|
-
)
|
|
314
|
-
)
|
|
315
|
-
|
|
316
|
-
# Get all current market data sources
|
|
317
|
-
market_data_sources = self._market_data_source_service \
|
|
318
|
-
.get_market_data_sources()
|
|
319
|
-
|
|
320
|
-
# Override the market data source service with the backtest market
|
|
321
|
-
# data source service
|
|
322
|
-
self.container.market_data_source_service.override(
|
|
323
|
-
BacktestMarketDataSourceService(
|
|
324
|
-
market_service=self.container.market_service(),
|
|
325
|
-
market_credential_service=self.container
|
|
326
|
-
.market_credential_service(),
|
|
327
|
-
configuration_service=self.container
|
|
328
|
-
.configuration_service(),
|
|
329
|
-
market_data_sources=market_data_sources
|
|
330
|
-
)
|
|
331
|
-
)
|
|
332
|
-
|
|
333
|
-
portfolio_conf_service = self.container.\
|
|
334
|
-
portfolio_configuration_service()
|
|
335
|
-
portfolio_snap_service = self.container.\
|
|
336
|
-
portfolio_snapshot_service()
|
|
337
|
-
configuration_service = self.container.configuration_service()
|
|
338
|
-
market_data_source_service = self.container.\
|
|
339
|
-
market_data_source_service()
|
|
340
|
-
# Override the order service with the backtest order service
|
|
341
|
-
self.container.order_service.override(
|
|
342
|
-
OrderBacktestService(
|
|
343
|
-
trade_service=self.container.trade_service(),
|
|
344
|
-
order_repository=self.container.order_repository(),
|
|
345
|
-
position_service=self.container.position_service(),
|
|
346
|
-
portfolio_repository=self.container.portfolio_repository(),
|
|
347
|
-
portfolio_configuration_service=portfolio_conf_service,
|
|
348
|
-
portfolio_snapshot_service=portfolio_snap_service,
|
|
349
|
-
configuration_service=configuration_service,
|
|
350
|
-
market_data_source_service=market_data_source_service
|
|
351
|
-
)
|
|
352
|
-
)
|
|
383
|
+
self.initialize_services_backtest()
|
|
353
384
|
else:
|
|
354
|
-
|
|
355
|
-
self._market_credential_service = self.container.\
|
|
356
|
-
market_credential_service()
|
|
357
|
-
self._market_credential_service.initialize()
|
|
358
|
-
|
|
359
|
-
# Add all market data sources of the strategies to the market data
|
|
360
|
-
# source service
|
|
361
|
-
self._market_data_source_service = self.container.\
|
|
362
|
-
market_data_source_service()
|
|
363
|
-
self._market_data_source_service.market_data_sources = \
|
|
364
|
-
self._market_data_sources
|
|
365
|
-
|
|
366
|
-
for strategy in self.algorithm.strategies:
|
|
367
|
-
|
|
368
|
-
if strategy.market_data_sources is not None:
|
|
369
|
-
for market_data_source in strategy.market_data_sources:
|
|
370
|
-
self._market_data_source_service.add(market_data_source)
|
|
385
|
+
self.initialize_services()
|
|
371
386
|
|
|
372
|
-
|
|
373
|
-
self._market_data_source_service.initialize_market_data_sources()
|
|
387
|
+
self.initialize_data_sources()
|
|
374
388
|
|
|
375
389
|
portfolio_configuration_service = self.container \
|
|
376
390
|
.portfolio_configuration_service()
|
|
@@ -386,7 +400,8 @@ class App:
|
|
|
386
400
|
self.algorithm.initialize_services(
|
|
387
401
|
context=self.container.context(),
|
|
388
402
|
configuration_service=self.container.configuration_service(),
|
|
389
|
-
market_data_source_service=self.
|
|
403
|
+
market_data_source_service=self.container
|
|
404
|
+
.market_data_source_service(),
|
|
390
405
|
market_credential_service=self.container
|
|
391
406
|
.market_credential_service(),
|
|
392
407
|
portfolio_service=self.container.portfolio_service(),
|
|
@@ -400,12 +415,10 @@ class App:
|
|
|
400
415
|
trade_service=self.container.trade_service(),
|
|
401
416
|
)
|
|
402
417
|
|
|
403
|
-
|
|
418
|
+
configuration_service = self.container.configuration_service()
|
|
404
419
|
|
|
405
420
|
if config[APP_MODE] == AppMode.WEB.value:
|
|
406
|
-
|
|
407
|
-
APP_MODE, AppMode.WEB.value
|
|
408
|
-
)
|
|
421
|
+
configuration_service.add_value(APP_MODE, AppMode.WEB.value)
|
|
409
422
|
self._initialize_web()
|
|
410
423
|
|
|
411
424
|
self._initialize_portfolios()
|
|
@@ -742,7 +755,8 @@ class App:
|
|
|
742
755
|
})
|
|
743
756
|
|
|
744
757
|
self.initialize_config()
|
|
745
|
-
|
|
758
|
+
configuration_service = self.container.configuration_service()
|
|
759
|
+
config = configuration_service.get_config()
|
|
746
760
|
path = os.path.join(
|
|
747
761
|
config[DATABASE_DIRECTORY_PATH],
|
|
748
762
|
config[DATABASE_NAME]
|
|
@@ -852,7 +866,8 @@ class App:
|
|
|
852
866
|
})
|
|
853
867
|
self.initialize_config()
|
|
854
868
|
|
|
855
|
-
|
|
869
|
+
configuration_service = self.container.configuration_service()
|
|
870
|
+
config = configuration_service.get_config()
|
|
856
871
|
|
|
857
872
|
path = os.path.join(
|
|
858
873
|
config[DATABASE_DIRECTORY_PATH],
|
|
@@ -898,7 +913,7 @@ class App:
|
|
|
898
913
|
|
|
899
914
|
This is a seperate function from the market data source service. This
|
|
900
915
|
is because the market data source service can be re-initialized.
|
|
901
|
-
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.
|
|
902
917
|
|
|
903
918
|
Args:
|
|
904
919
|
market_data_source: Instance of MarketDataSource
|
|
@@ -918,18 +933,36 @@ class App:
|
|
|
918
933
|
market_data_source.get_identifier():
|
|
919
934
|
return
|
|
920
935
|
|
|
921
|
-
market_data_source.market_credential_service = \
|
|
922
|
-
self._market_credential_service
|
|
923
936
|
self._market_data_sources.append(market_data_source)
|
|
924
937
|
|
|
925
|
-
def add_market_credential(
|
|
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
|
+
"""
|
|
926
951
|
market_credential.market = market_credential.market.upper()
|
|
927
|
-
self.
|
|
952
|
+
market_credential_service = self.container \
|
|
953
|
+
.market_credential_service()
|
|
954
|
+
market_credential_service.add(market_credential)
|
|
928
955
|
|
|
929
956
|
def on_initialize(self, app_hook):
|
|
930
957
|
"""
|
|
931
958
|
Function to add a hook that runs when the app is initialized. The hook
|
|
932
959
|
should be an instance of AppHook.
|
|
960
|
+
|
|
961
|
+
Args:
|
|
962
|
+
app_hook: Instance of AppHook
|
|
963
|
+
|
|
964
|
+
Returns:
|
|
965
|
+
None
|
|
933
966
|
"""
|
|
934
967
|
|
|
935
968
|
# Check if the app_hook inherits from AppHook
|
|
@@ -1243,7 +1276,8 @@ class App:
|
|
|
1243
1276
|
portfolio_provider_lookup = \
|
|
1244
1277
|
self.container.portfolio_provider_lookup()
|
|
1245
1278
|
order_executor_lookup = self.container.order_executor_lookup()
|
|
1246
|
-
|
|
1279
|
+
market_credential_service = \
|
|
1280
|
+
self.container.market_credential_service()
|
|
1247
1281
|
# Register portfolio providers and order executors
|
|
1248
1282
|
for portfolio_configuration in portfolio_configurations:
|
|
1249
1283
|
|
|
@@ -1259,7 +1293,7 @@ class App:
|
|
|
1259
1293
|
)
|
|
1260
1294
|
|
|
1261
1295
|
market_credential = \
|
|
1262
|
-
|
|
1296
|
+
market_credential_service.get(
|
|
1263
1297
|
portfolio_configuration.market
|
|
1264
1298
|
)
|
|
1265
1299
|
|
|
@@ -1280,6 +1314,8 @@ class App:
|
|
|
1280
1314
|
|
|
1281
1315
|
logger.info("Portfolio configurations complete")
|
|
1282
1316
|
logger.info("Syncing portfolios")
|
|
1317
|
+
portfolio_provider_lookup = \
|
|
1318
|
+
self.container.portfolio_provider_lookup()
|
|
1283
1319
|
portfolio_service = self.container.portfolio_service()
|
|
1284
1320
|
portfolio_sync_service = self.container.portfolio_sync_service()
|
|
1285
1321
|
|
|
@@ -1301,7 +1337,7 @@ class App:
|
|
|
1301
1337
|
logger.info("Adding default portfolio providers")
|
|
1302
1338
|
portfolio_provider_lookup = self.container.portfolio_provider_lookup()
|
|
1303
1339
|
portfolio_provider_lookup.add_portfolio_provider(
|
|
1304
|
-
CCXTPortfolioProvider()
|
|
1340
|
+
CCXTPortfolioProvider(priority=2)
|
|
1305
1341
|
)
|
|
1306
1342
|
|
|
1307
1343
|
def _initialize_default_order_executors(self):
|
|
@@ -1317,5 +1353,5 @@ class App:
|
|
|
1317
1353
|
logger.info("Adding default order executors")
|
|
1318
1354
|
order_executor_lookup = self.container.order_executor_lookup()
|
|
1319
1355
|
order_executor_lookup.add_order_executor(
|
|
1320
|
-
CCXTOrderExecutor()
|
|
1356
|
+
CCXTOrderExecutor(priority=2)
|
|
1321
1357
|
)
|
|
@@ -1205,7 +1205,7 @@ class Context:
|
|
|
1205
1205
|
self,
|
|
1206
1206
|
trade,
|
|
1207
1207
|
percentage: float,
|
|
1208
|
-
trade_risk_type
|
|
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
|
|
1251
|
+
trade_risk_type=TradeRiskType.FIXED,
|
|
1252
1252
|
sell_percentage: float = 100,
|
|
1253
1253
|
) -> None:
|
|
1254
1254
|
"""
|
|
@@ -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', '
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|