investing-algorithm-framework 6.1.0__tar.gz → 6.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/PKG-INFO +14 -20
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/README.md +1 -1
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/__init__.py +0 -20
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/app.py +54 -7
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/cli.py +149 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/cli/deploy_to_azure_function.py +70 -52
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/initialize_app.py +312 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/.gitignore.template +178 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/app.py.template +24 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/app_azure_function.py.template +20 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/app_web.py.template +24 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/azure_function_function_app.py.template +65 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/data_providers.py.template +17 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/env.example.template +2 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/env_azure_function.example.template +4 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/readme.md.template +135 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/requirements.txt.template +2 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/requirements_azure_function.txt.template +3 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/run_backtest.py.template +13 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/strategy.py.template +124 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/__init__.py +2 -1
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/domain/models/tracing/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/services/__init__.py +2 -0
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/domain/services/state_handler.py +38 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/utils/backtesting.py +27 -15
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/ccxt.py +4 -9
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/services/azure/state_handler.py +16 -6
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/services/market_service/ccxt_market_service.py +5 -8
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/pyproject.toml +15 -21
- investing_algorithm_framework-6.1.0/investing_algorithm_framework/cli/__init__.py +0 -3
- investing_algorithm_framework-6.1.0/investing_algorithm_framework/cli/create_azure_function_app_skeleton.py +0 -149
- investing_algorithm_framework-6.1.0/investing_algorithm_framework/cli/templates/azure_function_framework_app.py.template +0 -48
- investing_algorithm_framework-6.1.0/investing_algorithm_framework/cli/templates/azure_function_function_app.py.template +0 -32
- investing_algorithm_framework-6.1.0/investing_algorithm_framework/cli/templates/azure_function_requirements.txt.template +0 -2
- investing_algorithm_framework-6.1.0/investing_algorithm_framework/indicators/__init__.py +0 -40
- investing_algorithm_framework-6.1.0/investing_algorithm_framework/indicators/advanced.py +0 -404
- investing_algorithm_framework-6.1.0/investing_algorithm_framework/indicators/momentum.py +0 -41
- investing_algorithm_framework-6.1.0/investing_algorithm_framework/indicators/trend.py +0 -420
- investing_algorithm_framework-6.1.0/investing_algorithm_framework/indicators/utils.py +0 -580
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/LICENSE +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/algorithm.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/context.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/stateless/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/stateless/action_handlers/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/stateless/action_handlers/action_handler_strategy.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/stateless/action_handlers/check_online_handler.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/stateless/action_handlers/run_strategy_handler.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/stateless/exception_handler.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/strategy.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/task.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/controllers/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/controllers/orders.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/controllers/portfolio.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/controllers/positions.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/create_app.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/error_handler.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/responses.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/run_strategies.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/schemas/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/schemas/order.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/schemas/portfolio.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/schemas/position.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/app/web/setup_cors.py +0 -0
- {investing_algorithm_framework-6.1.0/investing_algorithm_framework/domain/models/tracing → investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli}/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/cli/templates/azure_function_host.json.template +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/cli/templates/azure_function_local.settings.json.template +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/create_app.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/dependency_container.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/config.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/constants.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/data_structures.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/decimal_parsing.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/exceptions.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/metrics/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/metrics/price_efficiency.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/app_mode.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/backtesting/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/backtesting/backtest_date_range.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/backtesting/backtest_position.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/backtesting/backtest_report.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/backtesting/backtest_reports_evaluation.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/base_model.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/date_range.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/market/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/market/market_credential.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/market_data_type.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/order/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/order/order.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/order/order_side.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/order/order_status.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/order/order_type.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/portfolio/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/portfolio/portfolio.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/portfolio/portfolio_configuration.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/portfolio/portfolio_snapshot.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/position/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/position/position.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/position/position_snapshot.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/strategy_profile.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/time_frame.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/time_interval.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/time_unit.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/tracing/trace.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/trade/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/trade/trade.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/trade/trade_risk_type.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/trade/trade_status.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/trade/trade_stop_loss.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/trade/trade_take_profit.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/trading_data_types.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/models/trading_time_frame.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/services/market_credential_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/services/market_data_sources.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/services/market_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/services/portfolios/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/services/portfolios/portfolio_sync_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/services/rounding_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/singleton.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/stateless_actions.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/strategy.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/utils/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/utils/csv.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/utils/polars.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/utils/random.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/utils/signatures.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/utils/stoppable_thread.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/domain/utils/synchronized.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/database/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/database/sql_alchemy.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/decimal_parser.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/csv.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/pandas.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/us_treasury_yield.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/model_extension.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/order/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/order/order.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/order/order_metadata.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/order_trade_association.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/portfolio/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/portfolio/portfolio_snapshot.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/portfolio/sql_portfolio.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/position/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/position/position.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/position/position_snapshot.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/trades/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/trades/trade.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/trades/trade_stop_loss.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/models/trades/trade_take_profit.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/repositories/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/repositories/order_metadata_repository.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/repositories/order_repository.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/repositories/portfolio_repository.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/repositories/portfolio_snapshot_repository.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/repositories/position_repository.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/repositories/position_snapshot_repository.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/repositories/repository.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/repositories/trade_repository.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/repositories/trade_stop_loss_repository.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/repositories/trade_take_profit_repository.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/services/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/services/azure/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/services/market_service/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/services/performance_service/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/services/performance_service/backtest_performance_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/infrastructure/services/performance_service/performance_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/backtesting/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/backtesting/backtest_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/configuration_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/market_credential_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/market_data_source_service/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/market_data_source_service/backtest_market_data_source_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/market_data_source_service/market_data_source_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/order_service/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/order_service/order_backtest_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/order_service/order_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/portfolios/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/portfolios/backtest_portfolio_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/portfolios/portfolio_configuration_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/portfolios/portfolio_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/portfolios/portfolio_snapshot_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/portfolios/portfolio_sync_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/position_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/position_snapshot_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/repository_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/strategy_orchestrator_service.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/trade_service/__init__.py +0 -0
- {investing_algorithm_framework-6.1.0 → investing_algorithm_framework-6.2.0}/investing_algorithm_framework/services/trade_service/trade_service.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: investing-algorithm-framework
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.2.0
|
|
4
4
|
Summary: A framework for creating trading bots
|
|
5
5
|
Author: MDUYN
|
|
6
6
|
Requires-Python: >=3.9
|
|
@@ -9,31 +9,26 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.10
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
-
Requires-Dist: Flask (>=2.3.2
|
|
12
|
+
Requires-Dist: Flask (>=2.3.2)
|
|
13
13
|
Requires-Dist: Flask-Cors (>=3.0.9,<5.0.0)
|
|
14
|
-
Requires-Dist: Flask-Migrate (>=2.6.0
|
|
15
|
-
Requires-Dist:
|
|
16
|
-
Requires-Dist: SQLAlchemy (>=2.0.18,<3.0.0)
|
|
14
|
+
Requires-Dist: Flask-Migrate (>=2.6.0)
|
|
15
|
+
Requires-Dist: SQLAlchemy (>=2.0.18)
|
|
17
16
|
Requires-Dist: azure-identity (>=1.19.0,<2.0.0)
|
|
18
17
|
Requires-Dist: azure-mgmt-resource (>=23.2.0,<24.0.0)
|
|
19
18
|
Requires-Dist: azure-mgmt-storage (>=21.2.1,<22.0.0)
|
|
20
19
|
Requires-Dist: azure-mgmt-web (>=7.3.1,<8.0.0)
|
|
21
20
|
Requires-Dist: azure-storage-blob (>=12.24.0,<13.0.0)
|
|
22
|
-
Requires-Dist: ccxt (>=4.2.48
|
|
23
|
-
Requires-Dist: dependency-injector (>=4.40.0
|
|
24
|
-
Requires-Dist: jupyter (>=1.0.0
|
|
25
|
-
Requires-Dist: marshmallow (>=3.5.0
|
|
26
|
-
Requires-Dist: numpy (>=
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist: polars[numpy,pandas] (>=0.20.10,<0.21.0)
|
|
29
|
-
Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
|
|
21
|
+
Requires-Dist: ccxt (>=4.2.48)
|
|
22
|
+
Requires-Dist: dependency-injector (>=4.40.0)
|
|
23
|
+
Requires-Dist: jupyter (>=1.0.0)
|
|
24
|
+
Requires-Dist: marshmallow (>=3.5.0)
|
|
25
|
+
Requires-Dist: polars[numpy,pandas] (>=0.20.10)
|
|
26
|
+
Requires-Dist: python-dateutil (>=2.8.2)
|
|
30
27
|
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
|
|
31
|
-
Requires-Dist: schedule (>=1.1.0
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist:
|
|
34
|
-
Requires-Dist:
|
|
35
|
-
Requires-Dist: tulipy (>=0.4.0,<0.5.0)
|
|
36
|
-
Requires-Dist: wrapt (>=1.16.0,<2.0.0)
|
|
28
|
+
Requires-Dist: schedule (>=1.1.0)
|
|
29
|
+
Requires-Dist: tabulate (>=0.9.0)
|
|
30
|
+
Requires-Dist: tqdm (>=4.66.1)
|
|
31
|
+
Requires-Dist: wrapt (>=1.16.0)
|
|
37
32
|
Description-Content-Type: text/markdown
|
|
38
33
|
|
|
39
34
|
<a href=https://investing-algorithm-framework.com><img src="https://img.shields.io/badge/docs-website-brightgreen"></a>
|
|
@@ -377,4 +372,3 @@ You can pick up a task by assigning yourself to it.
|
|
|
377
372
|
This will ensure that interested parties can give valuable feedback on the feature, and let others know that you are working on it.
|
|
378
373
|
|
|
379
374
|
**Important:** Always create your feature or hotfix against the `develop` branch, not `main`.
|
|
380
|
-
|
|
@@ -338,4 +338,4 @@ You can pick up a task by assigning yourself to it.
|
|
|
338
338
|
**Note** before starting any major new feature work, *please open an issue describing what you are planning to do*.
|
|
339
339
|
This will ensure that interested parties can give valuable feedback on the feature, and let others know that you are working on it.
|
|
340
340
|
|
|
341
|
-
**Important:** Always create your feature or hotfix against the `develop` branch, not `main`.
|
|
341
|
+
**Important:** Always create your feature or hotfix against the `develop` branch, not `main`.
|
|
@@ -17,10 +17,6 @@ from investing_algorithm_framework.infrastructure import \
|
|
|
17
17
|
CCXTTickerMarketDataSource, CSVOHLCVMarketDataSource, \
|
|
18
18
|
CSVTickerMarketDataSource, AzureBlobStorageStateHandler
|
|
19
19
|
from .create_app import create_app
|
|
20
|
-
from investing_algorithm_framework.indicators import get_rsi, get_peaks, \
|
|
21
|
-
is_uptrend, is_downtrend, is_crossover, is_crossunder, is_above, \
|
|
22
|
-
is_below, has_crossed_upward, get_sma, get_up_and_downtrends, \
|
|
23
|
-
get_ema, get_adx, has_crossed_downward, get_willr, is_divergence
|
|
24
20
|
|
|
25
21
|
__all__ = [
|
|
26
22
|
"Algorithm",
|
|
@@ -70,22 +66,6 @@ __all__ = [
|
|
|
70
66
|
"BacktestDateRange",
|
|
71
67
|
"convert_polars_to_pandas",
|
|
72
68
|
"DateRange",
|
|
73
|
-
"get_peaks",
|
|
74
|
-
"is_uptrend",
|
|
75
|
-
"is_downtrend",
|
|
76
|
-
"is_crossover",
|
|
77
|
-
"is_crossunder",
|
|
78
|
-
"is_above",
|
|
79
|
-
"is_below",
|
|
80
|
-
"has_crossed_upward",
|
|
81
|
-
"get_sma",
|
|
82
|
-
"get_up_and_downtrends",
|
|
83
|
-
"get_rsi",
|
|
84
|
-
"get_ema",
|
|
85
|
-
"get_adx",
|
|
86
|
-
"has_crossed_downward",
|
|
87
|
-
"get_willr",
|
|
88
|
-
"is_divergence",
|
|
89
69
|
"get_backtest_report",
|
|
90
70
|
"AzureBlobStorageStateHandler",
|
|
91
71
|
"DEFAULT_LOGGING_CONFIG",
|
|
@@ -11,10 +11,11 @@ from flask import Flask
|
|
|
11
11
|
from investing_algorithm_framework.app.algorithm import Algorithm
|
|
12
12
|
from investing_algorithm_framework.app.stateless import ActionHandler
|
|
13
13
|
from investing_algorithm_framework.app.task import Task
|
|
14
|
+
from investing_algorithm_framework.app.strategy import TradingStrategy
|
|
14
15
|
from investing_algorithm_framework.app.web import create_flask_app
|
|
15
16
|
from investing_algorithm_framework.domain import DATABASE_NAME, TimeUnit, \
|
|
16
17
|
DATABASE_DIRECTORY_PATH, RESOURCE_DIRECTORY, ENVIRONMENT, Environment, \
|
|
17
|
-
SQLALCHEMY_DATABASE_URI, OperationalException, \
|
|
18
|
+
SQLALCHEMY_DATABASE_URI, OperationalException, StateHandler, \
|
|
18
19
|
BACKTESTING_START_DATE, BACKTESTING_END_DATE, BacktestReport, \
|
|
19
20
|
BACKTESTING_PENDING_ORDER_CHECK_INTERVAL, APP_MODE, MarketCredential, \
|
|
20
21
|
AppMode, BacktestDateRange, DATABASE_DIRECTORY_NAME, \
|
|
@@ -470,6 +471,7 @@ class App:
|
|
|
470
471
|
# Load the state if a state handler is provided
|
|
471
472
|
if self._state_handler is not None:
|
|
472
473
|
logger.info("Detected state handler, loading state")
|
|
474
|
+
self._state_handler.initialize()
|
|
473
475
|
config = self.container.configuration_service().get_config()
|
|
474
476
|
self._state_handler.load(config[RESOURCE_DIRECTORY])
|
|
475
477
|
|
|
@@ -518,14 +520,20 @@ class App:
|
|
|
518
520
|
exit(0)
|
|
519
521
|
except Exception as e:
|
|
520
522
|
logger.error(e)
|
|
523
|
+
raise e
|
|
521
524
|
finally:
|
|
522
|
-
self.algorithm.stop()
|
|
523
525
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
self._state_handler
|
|
526
|
+
try:
|
|
527
|
+
self.algorithm.stop()
|
|
528
|
+
|
|
529
|
+
# Upload state if state handler is provided
|
|
530
|
+
if self._state_handler is not None:
|
|
531
|
+
logger.info("Detected state handler, saving state")
|
|
532
|
+
config = \
|
|
533
|
+
self.container.configuration_service().get_config()
|
|
534
|
+
self._state_handler.save(config[RESOURCE_DIRECTORY])
|
|
535
|
+
except Exception as e:
|
|
536
|
+
logger.error(e)
|
|
529
537
|
|
|
530
538
|
def reset(self):
|
|
531
539
|
self._started = False
|
|
@@ -881,8 +889,47 @@ class App:
|
|
|
881
889
|
|
|
882
890
|
def add_strategy(self, strategy):
|
|
883
891
|
"""
|
|
892
|
+
Function to add a strategy to the app. The strategy should be an
|
|
893
|
+
instance of TradingStrategy.
|
|
894
|
+
|
|
895
|
+
Args:
|
|
896
|
+
strategy: Instance of TradingStrategy
|
|
897
|
+
|
|
898
|
+
Returns:
|
|
899
|
+
None
|
|
884
900
|
"""
|
|
901
|
+
|
|
902
|
+
if inspect.isclass(strategy):
|
|
903
|
+
strategy = strategy()
|
|
904
|
+
|
|
905
|
+
if not isinstance(strategy, TradingStrategy):
|
|
906
|
+
raise OperationalException(
|
|
907
|
+
"Strategy should be an instance of TradingStrategy"
|
|
908
|
+
)
|
|
909
|
+
|
|
885
910
|
if self.algorithm is None:
|
|
886
911
|
self.algorithm = Algorithm(name=self._name)
|
|
887
912
|
|
|
888
913
|
self.algorithm.add_strategy(strategy)
|
|
914
|
+
|
|
915
|
+
def add_state_handler(self, state_handler):
|
|
916
|
+
"""
|
|
917
|
+
Function to add a state handler to the app. The state handler should
|
|
918
|
+
be an instance of StateHandler.
|
|
919
|
+
|
|
920
|
+
Args:
|
|
921
|
+
state_handler: Instance of StateHandler
|
|
922
|
+
|
|
923
|
+
Returns:
|
|
924
|
+
None
|
|
925
|
+
"""
|
|
926
|
+
|
|
927
|
+
if inspect.isclass(state_handler):
|
|
928
|
+
state_handler = state_handler()
|
|
929
|
+
|
|
930
|
+
if not isinstance(state_handler, StateHandler):
|
|
931
|
+
raise OperationalException(
|
|
932
|
+
"State handler should be an instance of StateHandler"
|
|
933
|
+
)
|
|
934
|
+
|
|
935
|
+
self._state_handler = state_handler
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from investing_algorithm_framework.cli.initialize_app import \
|
|
3
|
+
command as initialize_app_command
|
|
4
|
+
from investing_algorithm_framework.cli.deploy_to_azure_function import \
|
|
5
|
+
command as deploy_to_azure_function_command
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
CLI for Investing Algorithm Framework
|
|
9
|
+
|
|
10
|
+
This module provides a command-line interface (CLI) for the
|
|
11
|
+
Investing Algorithm Framework.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@click.group()
|
|
16
|
+
def cli():
|
|
17
|
+
"""CLI for Investing Algorithm Framework"""
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@click.command()
|
|
22
|
+
@click.option(
|
|
23
|
+
'--type',
|
|
24
|
+
default="default",
|
|
25
|
+
help="Type of app to create. "
|
|
26
|
+
"Options are: 'default', 'default-web', 'azure-function'."
|
|
27
|
+
)
|
|
28
|
+
@click.option(
|
|
29
|
+
'--path', default=None, help="Path to directory to initialize the app in"
|
|
30
|
+
)
|
|
31
|
+
@click.option(
|
|
32
|
+
'--replace',
|
|
33
|
+
is_flag=True,
|
|
34
|
+
default=False,
|
|
35
|
+
help="If True, duplicate files will be replaced."
|
|
36
|
+
"If False, files will not be replaced."
|
|
37
|
+
)
|
|
38
|
+
def init(type, path, replace):
|
|
39
|
+
"""
|
|
40
|
+
Command-line tool for creating an app skeleton.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
type (str): Type of app to create. Options are: 'default',
|
|
44
|
+
'default-web', 'azure-function'.
|
|
45
|
+
path (str): Path to directory to initialize the app in
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
None
|
|
49
|
+
"""
|
|
50
|
+
initialize_app_command(path=path, app_type=type, replace=replace)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@click.command()
|
|
54
|
+
@click.option(
|
|
55
|
+
'--resource_group',
|
|
56
|
+
required=True,
|
|
57
|
+
help='The name of the resource group.',
|
|
58
|
+
)
|
|
59
|
+
@click.option(
|
|
60
|
+
'--subscription_id',
|
|
61
|
+
required=False,
|
|
62
|
+
help='The subscription ID. If not provided, the default will be used.'
|
|
63
|
+
)
|
|
64
|
+
@click.option(
|
|
65
|
+
'--storage_account_name',
|
|
66
|
+
required=False,
|
|
67
|
+
help='The name of the storage account.',
|
|
68
|
+
)
|
|
69
|
+
@click.option(
|
|
70
|
+
'--container_name',
|
|
71
|
+
required=False,
|
|
72
|
+
help='The name of the blob container.',
|
|
73
|
+
default='iafcontainer'
|
|
74
|
+
)
|
|
75
|
+
@click.option(
|
|
76
|
+
'--deployment_name',
|
|
77
|
+
required=True,
|
|
78
|
+
help='The name of the deployment. This will be" + \
|
|
79
|
+
"used as the name of the Function App.'
|
|
80
|
+
)
|
|
81
|
+
@click.option(
|
|
82
|
+
'--region',
|
|
83
|
+
required=True,
|
|
84
|
+
help='The Azure region for the resources.'
|
|
85
|
+
)
|
|
86
|
+
@click.option(
|
|
87
|
+
'--create_resource_group_if_not_exists',
|
|
88
|
+
is_flag=True,
|
|
89
|
+
help='Flag to create the resource group if it does not exist.'
|
|
90
|
+
)
|
|
91
|
+
@click.option(
|
|
92
|
+
'--skip_login',
|
|
93
|
+
is_flag=True,
|
|
94
|
+
help='Flag to create the resource group if it does not exist.',
|
|
95
|
+
default=False
|
|
96
|
+
)
|
|
97
|
+
def deploy_azure_function(
|
|
98
|
+
resource_group,
|
|
99
|
+
subscription_id,
|
|
100
|
+
storage_account_name,
|
|
101
|
+
container_name,
|
|
102
|
+
deployment_name,
|
|
103
|
+
region,
|
|
104
|
+
create_resource_group_if_not_exists,
|
|
105
|
+
skip_login
|
|
106
|
+
):
|
|
107
|
+
"""
|
|
108
|
+
Command-line tool for deploying a trading bot to Azure Function.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
path (str): Path to directory to initialize the app in
|
|
112
|
+
resource_group (str): The name of the resource group.
|
|
113
|
+
subscription_id (str): The subscription ID. If not provided,
|
|
114
|
+
the default will be used.
|
|
115
|
+
storage_account_name (str): The name of the storage account.
|
|
116
|
+
container_name (str): The name of the blob container.
|
|
117
|
+
deployment_name (str): The name of the deployment. This will be
|
|
118
|
+
used as the name of the Function App.
|
|
119
|
+
region (str): The Azure region for the resources.
|
|
120
|
+
create_resource_group_if_not_exists (bool): Flag to create the
|
|
121
|
+
resource group if it does not exist.
|
|
122
|
+
skip_login (bool): Flag to skip the login process. This is
|
|
123
|
+
useful for CI/CD pipelines where the login is handled
|
|
124
|
+
separately.
|
|
125
|
+
region (str): The Azure region for the resources.
|
|
126
|
+
create_resource_group_if_not_exists (bool): Flag to create the
|
|
127
|
+
resource group if it does not exist.
|
|
128
|
+
skip_login (bool): Flag to skip the login process. This is
|
|
129
|
+
useful for CI/CD pipelines where the login is handled
|
|
130
|
+
separately.
|
|
131
|
+
|
|
132
|
+
Returns:
|
|
133
|
+
None
|
|
134
|
+
"""
|
|
135
|
+
crg = create_resource_group_if_not_exists
|
|
136
|
+
deploy_to_azure_function_command(
|
|
137
|
+
resource_group=resource_group,
|
|
138
|
+
subscription_id=subscription_id,
|
|
139
|
+
storage_account_name=storage_account_name,
|
|
140
|
+
container_name=container_name,
|
|
141
|
+
deployment_name=deployment_name,
|
|
142
|
+
region=region,
|
|
143
|
+
create_resource_group_if_not_exists=crg,
|
|
144
|
+
skip_login=skip_login
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
cli.add_command(init)
|
|
149
|
+
cli.add_command(deploy_azure_function)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import subprocess
|
|
3
3
|
import re
|
|
4
|
-
import click
|
|
5
4
|
import random
|
|
6
5
|
import string
|
|
7
6
|
import asyncio
|
|
7
|
+
import time
|
|
8
8
|
|
|
9
9
|
from azure.identity import DefaultAzureCredential
|
|
10
10
|
from azure.mgmt.resource import ResourceManagementClient
|
|
@@ -52,6 +52,62 @@ def ensure_azure_functools():
|
|
|
52
52
|
exit(1)
|
|
53
53
|
|
|
54
54
|
|
|
55
|
+
async def read_env_file_and_set_function_env_variables(
|
|
56
|
+
function_app_name,
|
|
57
|
+
storage_connection_string,
|
|
58
|
+
storage_container_name,
|
|
59
|
+
resource_group_name
|
|
60
|
+
):
|
|
61
|
+
"""
|
|
62
|
+
Function to read the .env file in the working directory
|
|
63
|
+
and set the environment variables for the Function App.
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
None
|
|
67
|
+
"""
|
|
68
|
+
env_file_path = os.path.join(os.getcwd(), ".env")
|
|
69
|
+
entries = {}
|
|
70
|
+
if os.path.exists(env_file_path):
|
|
71
|
+
with open(env_file_path, "r") as file:
|
|
72
|
+
for line in file:
|
|
73
|
+
if "=" in line:
|
|
74
|
+
key, value = line.strip().split("=", 1)
|
|
75
|
+
entries[key] = value
|
|
76
|
+
|
|
77
|
+
# Convert dictionary to CLI format
|
|
78
|
+
settings = [f"{key}={value}" for key, value in entries.items()]
|
|
79
|
+
|
|
80
|
+
# Construct the command
|
|
81
|
+
command = [
|
|
82
|
+
"az", "functionapp", "config", "appsettings", "set",
|
|
83
|
+
"--name", function_app_name,
|
|
84
|
+
"--resource-group", resource_group_name,
|
|
85
|
+
"--settings"
|
|
86
|
+
] + settings # Append all settings
|
|
87
|
+
|
|
88
|
+
# Run the Azure CLI command asynchronously
|
|
89
|
+
process = await asyncio.create_subprocess_exec(
|
|
90
|
+
*command,
|
|
91
|
+
stdout=asyncio.subprocess.PIPE,
|
|
92
|
+
stderr=asyncio.subprocess.PIPE
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
stdout, stderr = await process.communicate()
|
|
96
|
+
|
|
97
|
+
if process.returncode == 0:
|
|
98
|
+
print(
|
|
99
|
+
"Environment variables successfully set for the function app."
|
|
100
|
+
)
|
|
101
|
+
else:
|
|
102
|
+
print(
|
|
103
|
+
"Error setting environment variables: " +
|
|
104
|
+
f"{stderr.decode().strip()}"
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
else:
|
|
108
|
+
print(f".env file not found at {env_file_path}")
|
|
109
|
+
|
|
110
|
+
|
|
55
111
|
async def publish_function_app(
|
|
56
112
|
function_app_name,
|
|
57
113
|
storage_connection_string,
|
|
@@ -72,6 +128,9 @@ async def publish_function_app(
|
|
|
72
128
|
"""
|
|
73
129
|
print(f"Publishing Function App {function_app_name}")
|
|
74
130
|
|
|
131
|
+
# Wait for 60 seconds to ensure the Function App is ready
|
|
132
|
+
time.sleep(60)
|
|
133
|
+
|
|
75
134
|
try:
|
|
76
135
|
# Step 1: Publish the Azure Function App
|
|
77
136
|
process = await asyncio.create_subprocess_exec(
|
|
@@ -556,12 +615,6 @@ def create_storage_and_function(
|
|
|
556
615
|
template_settings_path, os.path.join(cwd, "local.settings.json")
|
|
557
616
|
)
|
|
558
617
|
|
|
559
|
-
# Ensure the user is logged in
|
|
560
|
-
ensure_az_login(skip_check=skip_login)
|
|
561
|
-
|
|
562
|
-
# ensure_azure_functools()
|
|
563
|
-
ensure_azure_functools()
|
|
564
|
-
|
|
565
618
|
# Fetch default subscription ID if not provided
|
|
566
619
|
if not subscription_id:
|
|
567
620
|
subscription_id = get_default_subscription_id()
|
|
@@ -618,51 +671,7 @@ def create_storage_and_function(
|
|
|
618
671
|
)
|
|
619
672
|
|
|
620
673
|
|
|
621
|
-
|
|
622
|
-
@click.option(
|
|
623
|
-
'--resource_group',
|
|
624
|
-
required=True,
|
|
625
|
-
help='The name of the resource group.',
|
|
626
|
-
)
|
|
627
|
-
@click.option(
|
|
628
|
-
'--subscription_id',
|
|
629
|
-
required=False,
|
|
630
|
-
help='The subscription ID. If not provided, the default will be used.'
|
|
631
|
-
)
|
|
632
|
-
@click.option(
|
|
633
|
-
'--storage_account_name',
|
|
634
|
-
required=False,
|
|
635
|
-
help='The name of the storage account.',
|
|
636
|
-
)
|
|
637
|
-
@click.option(
|
|
638
|
-
'--container_name',
|
|
639
|
-
required=False,
|
|
640
|
-
help='The name of the blob container.',
|
|
641
|
-
default='iafcontainer'
|
|
642
|
-
)
|
|
643
|
-
@click.option(
|
|
644
|
-
'--deployment_name',
|
|
645
|
-
required=True,
|
|
646
|
-
help='The name of the deployment. This will be" + \
|
|
647
|
-
"used as the name of the Function App.'
|
|
648
|
-
)
|
|
649
|
-
@click.option(
|
|
650
|
-
'--region',
|
|
651
|
-
required=True,
|
|
652
|
-
help='The Azure region for the resources.'
|
|
653
|
-
)
|
|
654
|
-
@click.option(
|
|
655
|
-
'--create_resource_group_if_not_exists',
|
|
656
|
-
is_flag=True,
|
|
657
|
-
help='Flag to create the resource group if it does not exist.'
|
|
658
|
-
)
|
|
659
|
-
@click.option(
|
|
660
|
-
'--skip_login',
|
|
661
|
-
is_flag=True,
|
|
662
|
-
help='Flag to create the resource group if it does not exist.',
|
|
663
|
-
default=False
|
|
664
|
-
)
|
|
665
|
-
def cli(
|
|
674
|
+
def command(
|
|
666
675
|
resource_group,
|
|
667
676
|
subscription_id,
|
|
668
677
|
storage_account_name,
|
|
@@ -689,6 +698,15 @@ def cli(
|
|
|
689
698
|
Returns:
|
|
690
699
|
None
|
|
691
700
|
"""
|
|
701
|
+
|
|
702
|
+
print("logging in to Azure...")
|
|
703
|
+
# Ensure the user is logged in
|
|
704
|
+
ensure_az_login(skip_check=skip_login)
|
|
705
|
+
|
|
706
|
+
print("Checking functools...")
|
|
707
|
+
# Ensure azure functions core tools are installed
|
|
708
|
+
ensure_azure_functools()
|
|
709
|
+
|
|
692
710
|
create_storage_and_function(
|
|
693
711
|
resource_group_name=resource_group,
|
|
694
712
|
storage_account_name=storage_account_name,
|