investing-algorithm-framework 6.2.0__tar.gz → 6.3.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.2.0 → investing_algorithm_framework-6.3.0}/PKG-INFO +54 -17
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/README.md +52 -14
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/__init__.py +4 -2
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/algorithm.py +1 -1
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/app.py +64 -39
- investing_algorithm_framework-6.3.0/investing_algorithm_framework/cli/templates/app-web.py.template +17 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/app.py.template +1 -1
- investing_algorithm_framework-6.3.0/investing_algorithm_framework/cli/templates/market_data_providers.py.template +9 -0
- investing_algorithm_framework-6.3.0/investing_algorithm_framework/cli/templates/requirements.txt.template +2 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/run_backtest.py.template +1 -1
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/create_app.py +8 -2
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/__init__.py +4 -4
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/constants.py +1 -2
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/ccxt.py +9 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/services/market_service/ccxt_market_service.py +1 -2
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/backtesting/backtest_service.py +234 -42
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/pyproject.toml +2 -2
- investing_algorithm_framework-6.2.0/investing_algorithm_framework/cli/templates/requirements.txt.template +0 -2
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/LICENSE +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/context.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/stateless/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/stateless/action_handlers/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/stateless/action_handlers/action_handler_strategy.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/stateless/action_handlers/check_online_handler.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/stateless/action_handlers/run_strategy_handler.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/stateless/exception_handler.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/strategy.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/task.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/controllers/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/controllers/orders.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/controllers/portfolio.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/controllers/positions.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/create_app.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/error_handler.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/responses.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/run_strategies.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/schemas/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/schemas/order.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/schemas/portfolio.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/schemas/position.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/app/web/setup_cors.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/cli.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/deploy_to_azure_function.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/initialize_app.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/.gitignore.template +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/app_azure_function.py.template +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/app_web.py.template +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/azure_function_function_app.py.template +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/azure_function_host.json.template +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/azure_function_local.settings.json.template +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/data_providers.py.template +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/env.example.template +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/env_azure_function.example.template +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/readme.md.template +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/requirements_azure_function.txt.template +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/cli/templates/strategy.py.template +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/dependency_container.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/config.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/data_structures.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/decimal_parsing.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/exceptions.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/metrics/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/metrics/price_efficiency.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/app_mode.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/backtesting/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/backtesting/backtest_date_range.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/backtesting/backtest_position.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/backtesting/backtest_report.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/backtesting/backtest_reports_evaluation.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/base_model.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/date_range.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/market/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/market/market_credential.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/market_data_type.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/order/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/order/order.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/order/order_side.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/order/order_status.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/order/order_type.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/portfolio/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/portfolio/portfolio.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/portfolio/portfolio_configuration.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/portfolio/portfolio_snapshot.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/position/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/position/position.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/position/position_snapshot.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/strategy_profile.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/time_frame.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/time_interval.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/time_unit.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/tracing/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/tracing/trace.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/trade/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/trade/trade.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/trade/trade_risk_type.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/trade/trade_status.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/trade/trade_stop_loss.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/trade/trade_take_profit.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/trading_data_types.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/models/trading_time_frame.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/services/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/services/market_credential_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/services/market_data_sources.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/services/market_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/services/portfolios/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/services/portfolios/portfolio_sync_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/services/rounding_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/services/state_handler.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/singleton.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/stateless_actions.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/strategy.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/utils/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/utils/backtesting.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/utils/csv.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/utils/polars.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/utils/random.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/utils/signatures.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/utils/stoppable_thread.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/domain/utils/synchronized.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/database/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/database/sql_alchemy.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/decimal_parser.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/csv.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/pandas.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/market_data_sources/us_treasury_yield.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/model_extension.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/order/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/order/order.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/order/order_metadata.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/order_trade_association.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/portfolio/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/portfolio/portfolio_snapshot.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/portfolio/sql_portfolio.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/position/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/position/position.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/position/position_snapshot.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/trades/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/trades/trade.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/trades/trade_stop_loss.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/models/trades/trade_take_profit.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/repositories/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/repositories/order_metadata_repository.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/repositories/order_repository.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/repositories/portfolio_repository.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/repositories/portfolio_snapshot_repository.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/repositories/position_repository.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/repositories/position_snapshot_repository.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/repositories/repository.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/repositories/trade_repository.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/repositories/trade_stop_loss_repository.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/repositories/trade_take_profit_repository.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/services/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/services/azure/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/services/azure/state_handler.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/services/market_service/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/services/performance_service/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/services/performance_service/backtest_performance_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/infrastructure/services/performance_service/performance_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/backtesting/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/configuration_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/market_credential_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/market_data_source_service/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/market_data_source_service/backtest_market_data_source_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/market_data_source_service/market_data_source_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/order_service/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/order_service/order_backtest_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/order_service/order_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/portfolios/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/portfolios/backtest_portfolio_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/portfolios/portfolio_configuration_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/portfolios/portfolio_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/portfolios/portfolio_snapshot_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/portfolios/portfolio_sync_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/position_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/position_snapshot_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/repository_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/strategy_orchestrator_service.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/trade_service/__init__.py +0 -0
- {investing_algorithm_framework-6.2.0 → investing_algorithm_framework-6.3.0}/investing_algorithm_framework/services/trade_service/trade_service.py +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: investing-algorithm-framework
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.3.0
|
|
4
4
|
Summary: A framework for creating trading bots
|
|
5
5
|
Author: MDUYN
|
|
6
|
-
Requires-Python: >=3.
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
7
|
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
9
8
|
Classifier: Programming Language :: Python :: 3.10
|
|
10
9
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
10
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -31,6 +30,24 @@ Requires-Dist: tqdm (>=4.66.1)
|
|
|
31
30
|
Requires-Dist: wrapt (>=1.16.0)
|
|
32
31
|
Description-Content-Type: text/markdown
|
|
33
32
|
|
|
33
|
+
<br/>
|
|
34
|
+
<div align="center">
|
|
35
|
+
<h1><a href="https://investing-algorithm-framework.com" target="_blank">Investing Algorithm Framework</a></h4>
|
|
36
|
+
</div>
|
|
37
|
+
<br/>
|
|
38
|
+
|
|
39
|
+
<div align="center">
|
|
40
|
+
<b>Rapidly build and deploy quantitative strategies and trading bots</b>
|
|
41
|
+
</div>
|
|
42
|
+
<br/>
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<a target="_blank" href="https://investing-algorithm-framework.com">View Docs</a>
|
|
46
|
+
<a href="https://investing-algorithm-framework.com/Getting%20Started/installation)">Getting Started</a>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
34
51
|
<a href=https://investing-algorithm-framework.com><img src="https://img.shields.io/badge/docs-website-brightgreen"></a>
|
|
35
52
|
[](https://github.com/coding-kitties/investing-algorithm-framework/actions/workflows/publish.yml)
|
|
36
53
|
[](https://github.com/coding-kitties/investing-algorithm-framework/actions/workflows/test.yml)
|
|
@@ -39,10 +56,6 @@ Description-Content-Type: text/markdown
|
|
|
39
56
|
<a href="https://www.reddit.com/r/InvestingBots/"><img src="https://img.shields.io/reddit/subreddit-subscribers/investingbots?style=social"></a> <br/>
|
|
40
57
|
[](https://github.com/SeaQL/sea-orm/stargazers/) If you like what we do, consider starring, sharing and contributing!
|
|
41
58
|
|
|
42
|
-
# [Investing Algorithm Framework](https://github.com/coding-kitties/investing-algorithm-framework)
|
|
43
|
-
|
|
44
|
-
The Investing Algorithm Framework is a Python framework that enables swift and elegant development of trading bots.
|
|
45
|
-
|
|
46
59
|
## Sponsors
|
|
47
60
|
|
|
48
61
|
<a href="https://www.finterion.com/" target="_blank">
|
|
@@ -55,7 +68,7 @@ The Investing Algorithm Framework is a Python framework that enables swift and e
|
|
|
55
68
|
|
|
56
69
|
## Features and planned features:
|
|
57
70
|
|
|
58
|
-
- [x] **Based on Python 3.
|
|
71
|
+
- [x] **Based on Python 3.10+**: Windows, macOS and Linux.
|
|
59
72
|
- [x] **Documentation**: [Documentation](https://investing-algorithm-framework.com)
|
|
60
73
|
- [x] **Persistence of portfolios, orders, positions and trades**: Persistence is achieved through sqlite.
|
|
61
74
|
- [x] **Limit orders**: Create limit orders for buying and selling.
|
|
@@ -66,7 +79,7 @@ The Investing Algorithm Framework is a Python framework that enables swift and e
|
|
|
66
79
|
- [x] **Live trading**: Live trading.
|
|
67
80
|
- [x] **Backtesting and performance analysis reports** [example](./examples/backtest_example)
|
|
68
81
|
- [x] **Backtesting multiple algorithms with different backtest date ranges** [example](./examples/backtests_example)
|
|
69
|
-
- [x] **
|
|
82
|
+
- [x] **Backtesting and results evaluation**: Compare multiple backtests and run experiments. Save and load backtests. Save strategies as part of the backtest. [docs](https://investing-algorithm-framework.com/Getting%20Started/backtesting)
|
|
70
83
|
- [x] **Order execution**: Currently support for a wide range of crypto exchanges through [ccxt](https://github.com/ccxt/ccxt) (Support for traditional asset brokers is planned).
|
|
71
84
|
- [x] **Web API**: Rest API for interacting with your deployed trading bot
|
|
72
85
|
- [x] **PyIndicators**: Works natively with [PyIndicators](https://github.com/coding-kitties/PyIndicators) for technical analysis on your Pandas and Polars dataframes.
|
|
@@ -78,6 +91,38 @@ The Investing Algorithm Framework is a Python framework that enables swift and e
|
|
|
78
91
|
- [ ] **AWS Lambda support (Planned)**: Stateless running for cloud function deployments in AWS.
|
|
79
92
|
- [ ] **Azure App services support (Planned)**: deployments in Azure app services with Web UI.
|
|
80
93
|
|
|
94
|
+
## Quickstart
|
|
95
|
+
|
|
96
|
+
1. First install the framework using `pip`. The Investing Algorithm Framework is hosted on [PyPi](https://pypi.org/project/Blankly/).
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
$ pip install investing-algorithm-framework
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
2. Next, just run:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
$ investing-algorithm-framewor init
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
or if you want the web version:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
$ investing-algorithm-framework init --web
|
|
112
|
+
```
|
|
113
|
+
> You can always change the app to the web version by changing the `app.py` file.
|
|
114
|
+
|
|
115
|
+
The command will create the file `app.py` and an example script called `strategy.py`.
|
|
116
|
+
|
|
117
|
+
From there, you start building your trading bot in the `strategy.py`.
|
|
118
|
+
|
|
119
|
+
More information can be found on our [docs](https://docs.blankly.finance)
|
|
120
|
+
|
|
121
|
+
> Make sure you leave the `app.py` file as is, as it is the entry point for the framework.
|
|
122
|
+
> You can change the `bot.py` file to your liking and add other files to the working directory.
|
|
123
|
+
> The framework will automatically pick up the files in the working directory.
|
|
124
|
+
```
|
|
125
|
+
|
|
81
126
|
## Example implementation
|
|
82
127
|
|
|
83
128
|
The following algorithm connects to binance and buys BTC every 2 hours.
|
|
@@ -295,14 +340,6 @@ app.add_portfolio_configuration(
|
|
|
295
340
|
We are continuously working on improving the performance of the framework. If
|
|
296
341
|
you have any suggestions, please let us know.
|
|
297
342
|
|
|
298
|
-
## How to install
|
|
299
|
-
|
|
300
|
-
You can download the framework with pypi.
|
|
301
|
-
|
|
302
|
-
```bash
|
|
303
|
-
pip install investing-algorithm-framework
|
|
304
|
-
```
|
|
305
|
-
|
|
306
343
|
## Installation for local development
|
|
307
344
|
|
|
308
345
|
The framework is built with poetry. To install the framework for local development, you can run the following commands:
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
<br/>
|
|
2
|
+
<div align="center">
|
|
3
|
+
<h1><a href="https://investing-algorithm-framework.com" target="_blank">Investing Algorithm Framework</a></h4>
|
|
4
|
+
</div>
|
|
5
|
+
<br/>
|
|
6
|
+
|
|
7
|
+
<div align="center">
|
|
8
|
+
<b>Rapidly build and deploy quantitative strategies and trading bots</b>
|
|
9
|
+
</div>
|
|
10
|
+
<br/>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a target="_blank" href="https://investing-algorithm-framework.com">View Docs</a>
|
|
14
|
+
<a href="https://investing-algorithm-framework.com/Getting%20Started/installation)">Getting Started</a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
1
19
|
<a href=https://investing-algorithm-framework.com><img src="https://img.shields.io/badge/docs-website-brightgreen"></a>
|
|
2
20
|
[](https://github.com/coding-kitties/investing-algorithm-framework/actions/workflows/publish.yml)
|
|
3
21
|
[](https://github.com/coding-kitties/investing-algorithm-framework/actions/workflows/test.yml)
|
|
@@ -6,10 +24,6 @@
|
|
|
6
24
|
<a href="https://www.reddit.com/r/InvestingBots/"><img src="https://img.shields.io/reddit/subreddit-subscribers/investingbots?style=social"></a> <br/>
|
|
7
25
|
[](https://github.com/SeaQL/sea-orm/stargazers/) If you like what we do, consider starring, sharing and contributing!
|
|
8
26
|
|
|
9
|
-
# [Investing Algorithm Framework](https://github.com/coding-kitties/investing-algorithm-framework)
|
|
10
|
-
|
|
11
|
-
The Investing Algorithm Framework is a Python framework that enables swift and elegant development of trading bots.
|
|
12
|
-
|
|
13
27
|
## Sponsors
|
|
14
28
|
|
|
15
29
|
<a href="https://www.finterion.com/" target="_blank">
|
|
@@ -22,7 +36,7 @@ The Investing Algorithm Framework is a Python framework that enables swift and e
|
|
|
22
36
|
|
|
23
37
|
## Features and planned features:
|
|
24
38
|
|
|
25
|
-
- [x] **Based on Python 3.
|
|
39
|
+
- [x] **Based on Python 3.10+**: Windows, macOS and Linux.
|
|
26
40
|
- [x] **Documentation**: [Documentation](https://investing-algorithm-framework.com)
|
|
27
41
|
- [x] **Persistence of portfolios, orders, positions and trades**: Persistence is achieved through sqlite.
|
|
28
42
|
- [x] **Limit orders**: Create limit orders for buying and selling.
|
|
@@ -33,7 +47,7 @@ The Investing Algorithm Framework is a Python framework that enables swift and e
|
|
|
33
47
|
- [x] **Live trading**: Live trading.
|
|
34
48
|
- [x] **Backtesting and performance analysis reports** [example](./examples/backtest_example)
|
|
35
49
|
- [x] **Backtesting multiple algorithms with different backtest date ranges** [example](./examples/backtests_example)
|
|
36
|
-
- [x] **
|
|
50
|
+
- [x] **Backtesting and results evaluation**: Compare multiple backtests and run experiments. Save and load backtests. Save strategies as part of the backtest. [docs](https://investing-algorithm-framework.com/Getting%20Started/backtesting)
|
|
37
51
|
- [x] **Order execution**: Currently support for a wide range of crypto exchanges through [ccxt](https://github.com/ccxt/ccxt) (Support for traditional asset brokers is planned).
|
|
38
52
|
- [x] **Web API**: Rest API for interacting with your deployed trading bot
|
|
39
53
|
- [x] **PyIndicators**: Works natively with [PyIndicators](https://github.com/coding-kitties/PyIndicators) for technical analysis on your Pandas and Polars dataframes.
|
|
@@ -45,6 +59,38 @@ The Investing Algorithm Framework is a Python framework that enables swift and e
|
|
|
45
59
|
- [ ] **AWS Lambda support (Planned)**: Stateless running for cloud function deployments in AWS.
|
|
46
60
|
- [ ] **Azure App services support (Planned)**: deployments in Azure app services with Web UI.
|
|
47
61
|
|
|
62
|
+
## Quickstart
|
|
63
|
+
|
|
64
|
+
1. First install the framework using `pip`. The Investing Algorithm Framework is hosted on [PyPi](https://pypi.org/project/Blankly/).
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
$ pip install investing-algorithm-framework
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
2. Next, just run:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
$ investing-algorithm-framewor init
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
or if you want the web version:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
$ investing-algorithm-framework init --web
|
|
80
|
+
```
|
|
81
|
+
> You can always change the app to the web version by changing the `app.py` file.
|
|
82
|
+
|
|
83
|
+
The command will create the file `app.py` and an example script called `strategy.py`.
|
|
84
|
+
|
|
85
|
+
From there, you start building your trading bot in the `strategy.py`.
|
|
86
|
+
|
|
87
|
+
More information can be found on our [docs](https://docs.blankly.finance)
|
|
88
|
+
|
|
89
|
+
> Make sure you leave the `app.py` file as is, as it is the entry point for the framework.
|
|
90
|
+
> You can change the `bot.py` file to your liking and add other files to the working directory.
|
|
91
|
+
> The framework will automatically pick up the files in the working directory.
|
|
92
|
+
```
|
|
93
|
+
|
|
48
94
|
## Example implementation
|
|
49
95
|
|
|
50
96
|
The following algorithm connects to binance and buys BTC every 2 hours.
|
|
@@ -262,14 +308,6 @@ app.add_portfolio_configuration(
|
|
|
262
308
|
We are continuously working on improving the performance of the framework. If
|
|
263
309
|
you have any suggestions, please let us know.
|
|
264
310
|
|
|
265
|
-
## How to install
|
|
266
|
-
|
|
267
|
-
You can download the framework with pypi.
|
|
268
|
-
|
|
269
|
-
```bash
|
|
270
|
-
pip install investing-algorithm-framework
|
|
271
|
-
```
|
|
272
|
-
|
|
273
311
|
## Installation for local development
|
|
274
312
|
|
|
275
313
|
The framework is built with poetry. To install the framework for local development, you can run the following commands:
|
|
@@ -11,7 +11,8 @@ from investing_algorithm_framework.domain import ApiException, \
|
|
|
11
11
|
RESERVED_BALANCES, APP_MODE, AppMode, DATETIME_FORMAT, \
|
|
12
12
|
load_backtest_report, BacktestDateRange, convert_polars_to_pandas, \
|
|
13
13
|
DateRange, get_backtest_report, DEFAULT_LOGGING_CONFIG, \
|
|
14
|
-
BacktestReport, TradeStatus, MarketDataType, TradeRiskType
|
|
14
|
+
BacktestReport, TradeStatus, MarketDataType, TradeRiskType, \
|
|
15
|
+
APPLICATION_DIRECTORY
|
|
15
16
|
from investing_algorithm_framework.infrastructure import \
|
|
16
17
|
CCXTOrderBookMarketDataSource, CCXTOHLCVMarketDataSource, \
|
|
17
18
|
CCXTTickerMarketDataSource, CSVOHLCVMarketDataSource, \
|
|
@@ -73,5 +74,6 @@ __all__ = [
|
|
|
73
74
|
"TradeStatus",
|
|
74
75
|
"MarketDataType",
|
|
75
76
|
"TradeRiskType",
|
|
76
|
-
"Context"
|
|
77
|
+
"Context",
|
|
78
|
+
"APPLICATION_DIRECTORY"
|
|
77
79
|
]
|
|
@@ -22,7 +22,7 @@ class Algorithm:
|
|
|
22
22
|
them in the correct order.
|
|
23
23
|
|
|
24
24
|
Args:
|
|
25
|
-
name (str): The name of the algorithm
|
|
25
|
+
name (str): (Optional) The name of the algorithm
|
|
26
26
|
description (str): The description of the algorithm
|
|
27
27
|
context (dict): The context of the algorithm, for backtest
|
|
28
28
|
references
|
|
@@ -17,9 +17,9 @@ from investing_algorithm_framework.domain import DATABASE_NAME, TimeUnit, \
|
|
|
17
17
|
DATABASE_DIRECTORY_PATH, RESOURCE_DIRECTORY, ENVIRONMENT, Environment, \
|
|
18
18
|
SQLALCHEMY_DATABASE_URI, OperationalException, StateHandler, \
|
|
19
19
|
BACKTESTING_START_DATE, BACKTESTING_END_DATE, BacktestReport, \
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
APP_MODE, MarketCredential, AppMode, BacktestDateRange, \
|
|
21
|
+
DATABASE_DIRECTORY_NAME, BACKTESTING_INITIAL_AMOUNT, \
|
|
22
|
+
MarketDataSource, APPLICATION_DIRECTORY
|
|
23
23
|
from investing_algorithm_framework.infrastructure import setup_sqlalchemy, \
|
|
24
24
|
create_all_tables
|
|
25
25
|
from investing_algorithm_framework.services import OrderBacktestService, \
|
|
@@ -56,7 +56,7 @@ class App:
|
|
|
56
56
|
self._on_after_initialize_hooks = []
|
|
57
57
|
self._state_handler = state_handler
|
|
58
58
|
self._name = name
|
|
59
|
-
self._algorithm = Algorithm()
|
|
59
|
+
self._algorithm = Algorithm(name=self.name)
|
|
60
60
|
|
|
61
61
|
@property
|
|
62
62
|
def algorithm(self) -> Algorithm:
|
|
@@ -634,9 +634,11 @@ class App:
|
|
|
634
634
|
self,
|
|
635
635
|
backtest_date_range: BacktestDateRange,
|
|
636
636
|
initial_amount=None,
|
|
637
|
-
pending_order_check_interval=None,
|
|
638
637
|
output_directory=None,
|
|
639
|
-
algorithm: Algorithm = None
|
|
638
|
+
algorithm: Algorithm = None,
|
|
639
|
+
save_strategy=False,
|
|
640
|
+
save_in_memory_strategies: bool = False,
|
|
641
|
+
strategy_directory: str = None
|
|
640
642
|
) -> BacktestReport:
|
|
641
643
|
"""
|
|
642
644
|
Run a backtest for an algorithm. This method should be called when
|
|
@@ -650,10 +652,13 @@ class App:
|
|
|
650
652
|
portfolio will start with.
|
|
651
653
|
algorithm: The algorithm to run a backtest for (instance of
|
|
652
654
|
Algorithm)
|
|
653
|
-
pending_order_check_interval: str - pending_order_check_interval:
|
|
654
|
-
The interval at which to check pending orders (e.g. 1h, 1d, 1w)
|
|
655
655
|
output_directory: str - The directory to
|
|
656
656
|
write the backtest report to
|
|
657
|
+
save_strategy: bool - Whether to save the strategy
|
|
658
|
+
save_strategies_directory: bool - Whether to save the
|
|
659
|
+
strategies directory
|
|
660
|
+
strategies_directory_name: str - The name of the directory
|
|
661
|
+
that contains the strategies
|
|
657
662
|
|
|
658
663
|
Returns:
|
|
659
664
|
Instance of BacktestReport
|
|
@@ -664,6 +669,32 @@ class App:
|
|
|
664
669
|
if self.algorithm is None:
|
|
665
670
|
raise OperationalException("No algorithm registered")
|
|
666
671
|
|
|
672
|
+
if save_strategy:
|
|
673
|
+
# Check if the strategies directory exists
|
|
674
|
+
if not save_in_memory_strategies:
|
|
675
|
+
|
|
676
|
+
if strategy_directory is None:
|
|
677
|
+
strategy_directory = os.path.join(
|
|
678
|
+
self.config[APPLICATION_DIRECTORY], "strategies"
|
|
679
|
+
)
|
|
680
|
+
else:
|
|
681
|
+
strategy_directory = os.path.join(
|
|
682
|
+
self.config[APPLICATION_DIRECTORY], strategy_directory
|
|
683
|
+
)
|
|
684
|
+
|
|
685
|
+
if not os.path.isdir(strategy_directory):
|
|
686
|
+
raise OperationalException(
|
|
687
|
+
"The backtest run is enabled with the "
|
|
688
|
+
"`include_strategy` flag but the strategies"
|
|
689
|
+
" directory: "
|
|
690
|
+
f"{strategy_directory} does not exist. "
|
|
691
|
+
"Please create the strategies directory or set "
|
|
692
|
+
"include_strategy to False. If you want to save the "
|
|
693
|
+
"strategies in memory, set save_in_memory_strategies "
|
|
694
|
+
"to True. This can be helpfull when running your "
|
|
695
|
+
"strategies in a notebook environment."
|
|
696
|
+
)
|
|
697
|
+
|
|
667
698
|
# Add backtest configuration to the config
|
|
668
699
|
self.set_config_with_dict({
|
|
669
700
|
ENVIRONMENT: Environment.BACKTEST.value,
|
|
@@ -671,9 +702,6 @@ class App:
|
|
|
671
702
|
BACKTESTING_END_DATE: backtest_date_range.end_date,
|
|
672
703
|
DATABASE_NAME: "backtest-database.sqlite3",
|
|
673
704
|
DATABASE_DIRECTORY_NAME: "backtest_databases",
|
|
674
|
-
BACKTESTING_PENDING_ORDER_CHECK_INTERVAL: (
|
|
675
|
-
pending_order_check_interval
|
|
676
|
-
),
|
|
677
705
|
BACKTESTING_INITIAL_AMOUNT: initial_amount
|
|
678
706
|
})
|
|
679
707
|
|
|
@@ -697,15 +725,14 @@ class App:
|
|
|
697
725
|
initial_amount=initial_amount,
|
|
698
726
|
backtest_date_range=backtest_date_range
|
|
699
727
|
)
|
|
700
|
-
config = self.container.configuration_service().get_config()
|
|
701
728
|
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
729
|
+
backtest_service.save_report(
|
|
730
|
+
report=report,
|
|
731
|
+
algorithm=self.algorithm,
|
|
732
|
+
output_directory=output_directory,
|
|
733
|
+
save_strategy=save_strategy,
|
|
734
|
+
save_in_memory_strategies=save_in_memory_strategies,
|
|
735
|
+
strategy_directory=strategy_directory
|
|
709
736
|
)
|
|
710
737
|
return report
|
|
711
738
|
|
|
@@ -713,10 +740,10 @@ class App:
|
|
|
713
740
|
self,
|
|
714
741
|
algorithms,
|
|
715
742
|
initial_amount=None,
|
|
716
|
-
|
|
717
|
-
pending_order_check_interval=None,
|
|
743
|
+
backtest_date_ranges: List[BacktestDateRange] = None,
|
|
718
744
|
output_directory=None,
|
|
719
|
-
checkpoint=False
|
|
745
|
+
checkpoint=False,
|
|
746
|
+
save_strategy=False,
|
|
720
747
|
) -> List[BacktestReport]:
|
|
721
748
|
"""
|
|
722
749
|
Run a backtest for a set algorithm. This method should be called when
|
|
@@ -724,11 +751,9 @@ class App:
|
|
|
724
751
|
|
|
725
752
|
Args:
|
|
726
753
|
Algorithms: List[Algorithm] - The algorithms to run backtests for
|
|
727
|
-
|
|
728
|
-
backtests for
|
|
754
|
+
backtest_date_ranges: List[BacktestDateRange] - The date ranges
|
|
755
|
+
to run the backtests for
|
|
729
756
|
initial_amount: The initial amount to start the backtest with.
|
|
730
|
-
pending_order_check_interval: str - The interval at which to check
|
|
731
|
-
pending orders
|
|
732
757
|
output_directory: str - The directory to write the backtest
|
|
733
758
|
report to.
|
|
734
759
|
checkpoint: bool - Whether to checkpoint the backtest,
|
|
@@ -738,6 +763,11 @@ class App:
|
|
|
738
763
|
when running backtests for a large number of algorithms
|
|
739
764
|
and date ranges where some of the backtests may fail
|
|
740
765
|
and you want to re-run only the failed backtests.
|
|
766
|
+
save_strategy: bool - Whether to save the strategy as part
|
|
767
|
+
of the backtest report. You can only save in-memory strategies
|
|
768
|
+
when running multiple backtests. This is because we can't
|
|
769
|
+
differentiate between which folders belong to a specific
|
|
770
|
+
strategy.
|
|
741
771
|
|
|
742
772
|
Returns
|
|
743
773
|
List of BacktestReport intances
|
|
@@ -745,8 +775,7 @@ class App:
|
|
|
745
775
|
logger.info("Initializing backtests")
|
|
746
776
|
reports = []
|
|
747
777
|
|
|
748
|
-
for date_range in
|
|
749
|
-
date_range: BacktestDateRange = date_range
|
|
778
|
+
for date_range in backtest_date_ranges:
|
|
750
779
|
print(
|
|
751
780
|
f"{COLOR_YELLOW}Running backtests for date "
|
|
752
781
|
f"range:{COLOR_RESET} {COLOR_GREEN}{date_range.name} "
|
|
@@ -783,10 +812,7 @@ class App:
|
|
|
783
812
|
BACKTESTING_START_DATE: date_range.start_date,
|
|
784
813
|
BACKTESTING_END_DATE: date_range.end_date,
|
|
785
814
|
DATABASE_NAME: "backtest-database.sqlite3",
|
|
786
|
-
DATABASE_DIRECTORY_NAME: "backtest_databases"
|
|
787
|
-
BACKTESTING_PENDING_ORDER_CHECK_INTERVAL: (
|
|
788
|
-
pending_order_check_interval
|
|
789
|
-
)
|
|
815
|
+
DATABASE_DIRECTORY_NAME: "backtest_databases"
|
|
790
816
|
})
|
|
791
817
|
self.initialize_config()
|
|
792
818
|
|
|
@@ -818,13 +844,12 @@ class App:
|
|
|
818
844
|
if date_range.name is not None:
|
|
819
845
|
report.date_range_name = date_range.name
|
|
820
846
|
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
report=report, output_directory=output_directory
|
|
847
|
+
backtest_service.save_report(
|
|
848
|
+
report=report,
|
|
849
|
+
algorithm=algorithm,
|
|
850
|
+
output_directory=output_directory,
|
|
851
|
+
save_strategy=save_strategy,
|
|
852
|
+
save_in_memory_strategies=True,
|
|
828
853
|
)
|
|
829
854
|
reports.append(report)
|
|
830
855
|
|
investing_algorithm_framework-6.3.0/investing_algorithm_framework/cli/templates/app-web.py.template
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import logging.config
|
|
2
|
+
from dotenv import load_dotenv
|
|
3
|
+
|
|
4
|
+
from investing_algorithm_framework import create_app, \
|
|
5
|
+
DEFAULT_LOGGING_CONFIG, Algorithm
|
|
6
|
+
from strategies.strategy import MyTradingStrategy
|
|
7
|
+
|
|
8
|
+
load_dotenv()
|
|
9
|
+
logging.config.dictConfig(DEFAULT_LOGGING_CONFIG)
|
|
10
|
+
|
|
11
|
+
app = create_app(web=True)
|
|
12
|
+
algorithm = Algorithm(name="MyTradingBot")
|
|
13
|
+
algorithm.add_strategy(MyTradingStrategy)
|
|
14
|
+
app.add_algorithm(algorithm)
|
|
15
|
+
|
|
16
|
+
if __name__ == "__main__":
|
|
17
|
+
app.run()
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import os
|
|
1
2
|
import logging
|
|
3
|
+
import inspect
|
|
2
4
|
from dotenv import load_dotenv
|
|
3
5
|
|
|
4
6
|
from .app import App
|
|
5
7
|
from .dependency_container import setup_dependency_container
|
|
6
|
-
from .domain import AppMode
|
|
8
|
+
from .domain import AppMode, APPLICATION_DIRECTORY
|
|
7
9
|
|
|
8
10
|
logger = logging.getLogger("investing_algorithm_framework")
|
|
9
11
|
|
|
@@ -44,6 +46,10 @@ def create_app(
|
|
|
44
46
|
if web:
|
|
45
47
|
app.set_config("APP_MODE", AppMode.WEB.value)
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
# Add the application directory to the config
|
|
50
|
+
caller_frame = inspect.stack()[1]
|
|
51
|
+
caller_path = os.path.abspath(caller_frame.filename)
|
|
52
|
+
app.set_config(APPLICATION_DIRECTORY, caller_path)
|
|
48
53
|
|
|
54
|
+
logger.info("Investing algoritm framework app created")
|
|
49
55
|
return app
|
|
@@ -7,8 +7,8 @@ from .constants import ITEMIZE, ITEMIZED, PER_PAGE, PAGE, ENVIRONMENT, \
|
|
|
7
7
|
BACKTEST_DATA_DIRECTORY_NAME, TICKER_DATA_TYPE, OHLCV_DATA_TYPE, \
|
|
8
8
|
CURRENT_UTC_DATETIME, BACKTESTING_END_DATE, SYMBOLS, \
|
|
9
9
|
CCXT_DATETIME_FORMAT_WITH_TIMEZONE, RESERVED_BALANCES, \
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
APP_MODE, DATABASE_DIRECTORY_NAME, BACKTESTING_INITIAL_AMOUNT, \
|
|
11
|
+
APPLICATION_DIRECTORY
|
|
12
12
|
from .data_structures import PeekableQueue
|
|
13
13
|
from .decimal_parsing import parse_decimal_to_string, parse_string_to_decimal
|
|
14
14
|
from .exceptions import OperationalException, ApiException, \
|
|
@@ -100,7 +100,6 @@ __all__ = [
|
|
|
100
100
|
"MarketService",
|
|
101
101
|
"PeekableQueue",
|
|
102
102
|
"BACKTESTING_END_DATE",
|
|
103
|
-
"BACKTESTING_PENDING_ORDER_CHECK_INTERVAL",
|
|
104
103
|
"PositionSnapshot",
|
|
105
104
|
"MarketCredentialService",
|
|
106
105
|
"TradeStatus",
|
|
@@ -128,5 +127,6 @@ __all__ = [
|
|
|
128
127
|
"TradeRiskType",
|
|
129
128
|
"TradeTakeProfit",
|
|
130
129
|
"TradeStopLoss",
|
|
131
|
-
"StateHandler"
|
|
130
|
+
"StateHandler",
|
|
131
|
+
"APPLICATION_DIRECTORY"
|
|
132
132
|
]
|
|
@@ -13,6 +13,7 @@ DATABASE_URL = 'DATABASE_URL'
|
|
|
13
13
|
DEFAULT_DATABASE_NAME = "database"
|
|
14
14
|
|
|
15
15
|
SYMBOLS = "SYMBOLS"
|
|
16
|
+
APPLICATION_DIRECTORY = "APP_DIR"
|
|
16
17
|
RESOURCE_DIRECTORY = "RESOURCE_DIRECTORY"
|
|
17
18
|
BACKTEST_DATA_DIRECTORY_NAME = "BACKTEST_DATA_DIRECTORY_NAME"
|
|
18
19
|
LOG_LEVEL = 'LOG_LEVEL'
|
|
@@ -69,8 +70,6 @@ BACKTESTING_FLAG = "BACKTESTING"
|
|
|
69
70
|
BACKTESTING_INDEX_DATETIME = "BACKTESTING_INDEX_DATETIME"
|
|
70
71
|
BACKTESTING_START_DATE = "BACKTESTING_START_DATE"
|
|
71
72
|
BACKTESTING_END_DATE = "BACKTESTING_END_DATE"
|
|
72
|
-
BACKTESTING_PENDING_ORDER_CHECK_INTERVAL \
|
|
73
|
-
= "BACKTESTING_PENDING_ORDER_CHECK_INTERVAL"
|
|
74
73
|
BACKTESTING_INITIAL_AMOUNT = "BACKTESTING_INITIAL_AMOUNT"
|
|
75
74
|
TICKER_DATA_TYPE = "TICKER"
|
|
76
75
|
OHLCV_DATA_TYPE = "OHLCV"
|
|
@@ -472,6 +472,15 @@ class CCXTOHLCVMarketDataSource(OHLCVMarketDataSource):
|
|
|
472
472
|
if end_date is None:
|
|
473
473
|
end_date = datetime.now(tz=timezone.utc)
|
|
474
474
|
|
|
475
|
+
if self.window_size is None:
|
|
476
|
+
raise OperationalException(
|
|
477
|
+
"Window_size should be defined before the " +
|
|
478
|
+
"get_data method can be called. Make sure to set " +
|
|
479
|
+
"the window_size attribute on your " +
|
|
480
|
+
"CCXTOHLCVMarketDataSource or provide a start_date " +
|
|
481
|
+
"and end_date to the get_data method."
|
|
482
|
+
)
|
|
483
|
+
|
|
475
484
|
start_date = self.create_start_date(
|
|
476
485
|
end_date=end_date,
|
|
477
486
|
time_frame=self.time_frame,
|
|
@@ -432,8 +432,7 @@ class CCXTMarketService(MarketService):
|
|
|
432
432
|
col_names = ["Datetime", "Open", "High", "Low", "Close", "Volume"]
|
|
433
433
|
|
|
434
434
|
# Combine the Series into a DataFrame with given column names
|
|
435
|
-
df = pl.DataFrame(data, schema=col_names)
|
|
436
|
-
|
|
435
|
+
df = pl.DataFrame(data, schema=col_names, orient="row")
|
|
437
436
|
return df
|
|
438
437
|
|
|
439
438
|
def get_ohlcvs(
|