investing-algorithm-framework 6.9.1__py3-none-any.whl → 7.19.15__py3-none-any.whl
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.
Potentially problematic release.
This version of investing-algorithm-framework might be problematic. Click here for more details.
- investing_algorithm_framework/__init__.py +147 -44
- investing_algorithm_framework/app/__init__.py +23 -6
- investing_algorithm_framework/app/algorithm/algorithm.py +5 -41
- investing_algorithm_framework/app/algorithm/algorithm_factory.py +17 -10
- investing_algorithm_framework/app/analysis/__init__.py +15 -0
- investing_algorithm_framework/app/analysis/backtest_data_ranges.py +121 -0
- investing_algorithm_framework/app/analysis/backtest_utils.py +107 -0
- investing_algorithm_framework/app/analysis/permutation.py +116 -0
- investing_algorithm_framework/app/analysis/ranking.py +297 -0
- investing_algorithm_framework/app/app.py +1322 -707
- investing_algorithm_framework/app/context.py +196 -88
- investing_algorithm_framework/app/eventloop.py +590 -0
- investing_algorithm_framework/app/reporting/__init__.py +16 -5
- investing_algorithm_framework/app/reporting/ascii.py +57 -202
- investing_algorithm_framework/app/reporting/backtest_report.py +284 -170
- investing_algorithm_framework/app/reporting/charts/__init__.py +10 -2
- investing_algorithm_framework/app/reporting/charts/entry_exist_signals.py +66 -0
- investing_algorithm_framework/app/reporting/charts/equity_curve.py +37 -0
- investing_algorithm_framework/app/reporting/charts/equity_curve_drawdown.py +11 -26
- investing_algorithm_framework/app/reporting/charts/line_chart.py +11 -0
- investing_algorithm_framework/app/reporting/charts/ohlcv_data_completeness.py +51 -0
- investing_algorithm_framework/app/reporting/charts/rolling_sharp_ratio.py +1 -1
- investing_algorithm_framework/app/reporting/generate.py +100 -114
- investing_algorithm_framework/app/reporting/tables/key_metrics_table.py +40 -32
- investing_algorithm_framework/app/reporting/tables/time_metrics_table.py +34 -27
- investing_algorithm_framework/app/reporting/tables/trade_metrics_table.py +23 -19
- investing_algorithm_framework/app/reporting/tables/trades_table.py +1 -1
- investing_algorithm_framework/app/reporting/tables/utils.py +1 -0
- investing_algorithm_framework/app/reporting/templates/report_template.html.j2 +10 -16
- investing_algorithm_framework/app/strategy.py +315 -175
- investing_algorithm_framework/app/task.py +5 -3
- investing_algorithm_framework/cli/cli.py +30 -12
- investing_algorithm_framework/cli/deploy_to_aws_lambda.py +131 -34
- investing_algorithm_framework/cli/initialize_app.py +20 -1
- investing_algorithm_framework/cli/templates/app_aws_lambda_function.py.template +18 -6
- investing_algorithm_framework/cli/templates/aws_lambda_dockerfile.template +22 -0
- investing_algorithm_framework/cli/templates/aws_lambda_dockerignore.template +92 -0
- investing_algorithm_framework/cli/templates/aws_lambda_requirements.txt.template +2 -2
- investing_algorithm_framework/cli/templates/azure_function_requirements.txt.template +1 -1
- investing_algorithm_framework/create_app.py +3 -5
- investing_algorithm_framework/dependency_container.py +25 -39
- investing_algorithm_framework/domain/__init__.py +45 -38
- investing_algorithm_framework/domain/backtesting/__init__.py +21 -0
- investing_algorithm_framework/domain/backtesting/backtest.py +503 -0
- investing_algorithm_framework/domain/backtesting/backtest_date_range.py +96 -0
- investing_algorithm_framework/domain/backtesting/backtest_evaluation_focuss.py +242 -0
- investing_algorithm_framework/domain/backtesting/backtest_metrics.py +459 -0
- investing_algorithm_framework/domain/backtesting/backtest_permutation_test.py +275 -0
- investing_algorithm_framework/domain/backtesting/backtest_run.py +605 -0
- investing_algorithm_framework/domain/backtesting/backtest_summary_metrics.py +162 -0
- investing_algorithm_framework/domain/backtesting/combine_backtests.py +280 -0
- investing_algorithm_framework/domain/config.py +27 -0
- investing_algorithm_framework/domain/constants.py +6 -34
- investing_algorithm_framework/domain/data_provider.py +200 -56
- investing_algorithm_framework/domain/exceptions.py +34 -1
- investing_algorithm_framework/domain/models/__init__.py +10 -19
- investing_algorithm_framework/domain/models/base_model.py +0 -6
- investing_algorithm_framework/domain/models/data/__init__.py +7 -0
- investing_algorithm_framework/domain/models/data/data_source.py +214 -0
- investing_algorithm_framework/domain/models/{market_data_type.py → data/data_type.py} +7 -7
- investing_algorithm_framework/domain/models/market/market_credential.py +6 -0
- investing_algorithm_framework/domain/models/order/order.py +34 -13
- investing_algorithm_framework/domain/models/order/order_status.py +1 -1
- investing_algorithm_framework/domain/models/order/order_type.py +1 -1
- investing_algorithm_framework/domain/models/portfolio/portfolio.py +14 -1
- investing_algorithm_framework/domain/models/portfolio/portfolio_configuration.py +5 -1
- investing_algorithm_framework/domain/models/portfolio/portfolio_snapshot.py +51 -11
- investing_algorithm_framework/domain/models/position/__init__.py +2 -1
- investing_algorithm_framework/domain/models/position/position.py +9 -0
- investing_algorithm_framework/domain/models/position/position_size.py +41 -0
- investing_algorithm_framework/domain/models/risk_rules/__init__.py +7 -0
- investing_algorithm_framework/domain/models/risk_rules/stop_loss_rule.py +51 -0
- investing_algorithm_framework/domain/models/risk_rules/take_profit_rule.py +55 -0
- investing_algorithm_framework/domain/models/snapshot_interval.py +0 -1
- investing_algorithm_framework/domain/models/strategy_profile.py +19 -151
- investing_algorithm_framework/domain/models/time_frame.py +7 -0
- investing_algorithm_framework/domain/models/time_interval.py +33 -0
- investing_algorithm_framework/domain/models/time_unit.py +63 -1
- investing_algorithm_framework/domain/models/trade/__init__.py +0 -2
- investing_algorithm_framework/domain/models/trade/trade.py +56 -32
- investing_algorithm_framework/domain/models/trade/trade_status.py +8 -2
- investing_algorithm_framework/domain/models/trade/trade_stop_loss.py +106 -41
- investing_algorithm_framework/domain/models/trade/trade_take_profit.py +161 -99
- investing_algorithm_framework/domain/order_executor.py +19 -0
- investing_algorithm_framework/domain/portfolio_provider.py +20 -1
- investing_algorithm_framework/domain/services/__init__.py +0 -13
- investing_algorithm_framework/domain/strategy.py +1 -29
- investing_algorithm_framework/domain/utils/__init__.py +5 -1
- investing_algorithm_framework/domain/utils/custom_tqdm.py +22 -0
- investing_algorithm_framework/domain/utils/jupyter_notebook_detection.py +19 -0
- investing_algorithm_framework/domain/utils/polars.py +17 -14
- investing_algorithm_framework/download_data.py +40 -10
- investing_algorithm_framework/infrastructure/__init__.py +13 -25
- investing_algorithm_framework/infrastructure/data_providers/__init__.py +7 -4
- investing_algorithm_framework/infrastructure/data_providers/ccxt.py +811 -546
- investing_algorithm_framework/infrastructure/data_providers/csv.py +433 -122
- investing_algorithm_framework/infrastructure/data_providers/pandas.py +599 -0
- investing_algorithm_framework/infrastructure/database/__init__.py +6 -2
- investing_algorithm_framework/infrastructure/database/sql_alchemy.py +81 -0
- investing_algorithm_framework/infrastructure/models/__init__.py +0 -13
- investing_algorithm_framework/infrastructure/models/order/order.py +9 -3
- investing_algorithm_framework/infrastructure/models/trades/trade_stop_loss.py +27 -8
- investing_algorithm_framework/infrastructure/models/trades/trade_take_profit.py +21 -7
- investing_algorithm_framework/infrastructure/order_executors/__init__.py +2 -0
- investing_algorithm_framework/infrastructure/order_executors/backtest_oder_executor.py +28 -0
- investing_algorithm_framework/infrastructure/repositories/repository.py +16 -2
- investing_algorithm_framework/infrastructure/repositories/trade_repository.py +2 -2
- investing_algorithm_framework/infrastructure/repositories/trade_stop_loss_repository.py +6 -0
- investing_algorithm_framework/infrastructure/repositories/trade_take_profit_repository.py +6 -0
- investing_algorithm_framework/infrastructure/services/__init__.py +0 -4
- investing_algorithm_framework/services/__init__.py +105 -8
- investing_algorithm_framework/services/backtesting/backtest_service.py +536 -476
- investing_algorithm_framework/services/configuration_service.py +14 -4
- investing_algorithm_framework/services/data_providers/__init__.py +5 -0
- investing_algorithm_framework/services/data_providers/data_provider_service.py +850 -0
- investing_algorithm_framework/{app/reporting → services}/metrics/__init__.py +48 -17
- investing_algorithm_framework/{app/reporting → services}/metrics/drawdown.py +10 -10
- investing_algorithm_framework/{app/reporting → services}/metrics/equity_curve.py +2 -2
- investing_algorithm_framework/{app/reporting → services}/metrics/exposure.py +60 -2
- investing_algorithm_framework/services/metrics/generate.py +358 -0
- investing_algorithm_framework/{app/reporting → services}/metrics/profit_factor.py +36 -0
- investing_algorithm_framework/{app/reporting → services}/metrics/recovery.py +2 -2
- investing_algorithm_framework/{app/reporting → services}/metrics/returns.py +146 -147
- investing_algorithm_framework/services/metrics/risk_free_rate.py +28 -0
- investing_algorithm_framework/{app/reporting/metrics/sharp_ratio.py → services/metrics/sharpe_ratio.py} +6 -10
- investing_algorithm_framework/{app/reporting → services}/metrics/sortino_ratio.py +3 -7
- investing_algorithm_framework/services/metrics/trades.py +500 -0
- investing_algorithm_framework/services/metrics/volatility.py +97 -0
- investing_algorithm_framework/{app/reporting → services}/metrics/win_rate.py +70 -3
- investing_algorithm_framework/services/order_service/order_backtest_service.py +21 -31
- investing_algorithm_framework/services/order_service/order_service.py +9 -71
- investing_algorithm_framework/services/portfolios/portfolio_provider_lookup.py +0 -2
- investing_algorithm_framework/services/portfolios/portfolio_service.py +3 -13
- investing_algorithm_framework/services/portfolios/portfolio_snapshot_service.py +62 -96
- investing_algorithm_framework/services/portfolios/portfolio_sync_service.py +0 -3
- investing_algorithm_framework/services/repository_service.py +5 -2
- investing_algorithm_framework/services/trade_order_evaluator/__init__.py +9 -0
- investing_algorithm_framework/services/trade_order_evaluator/backtest_trade_oder_evaluator.py +113 -0
- investing_algorithm_framework/services/trade_order_evaluator/default_trade_order_evaluator.py +51 -0
- investing_algorithm_framework/services/trade_order_evaluator/trade_order_evaluator.py +80 -0
- investing_algorithm_framework/services/trade_service/__init__.py +7 -1
- investing_algorithm_framework/services/trade_service/trade_service.py +51 -29
- investing_algorithm_framework/services/trade_service/trade_stop_loss_service.py +39 -0
- investing_algorithm_framework/services/trade_service/trade_take_profit_service.py +41 -0
- investing_algorithm_framework-7.19.15.dist-info/METADATA +537 -0
- {investing_algorithm_framework-6.9.1.dist-info → investing_algorithm_framework-7.19.15.dist-info}/RECORD +159 -148
- investing_algorithm_framework/app/reporting/evaluation.py +0 -243
- investing_algorithm_framework/app/reporting/metrics/risk_free_rate.py +0 -8
- investing_algorithm_framework/app/reporting/metrics/volatility.py +0 -69
- investing_algorithm_framework/cli/templates/requirements_azure_function.txt.template +0 -3
- investing_algorithm_framework/domain/models/backtesting/__init__.py +0 -9
- investing_algorithm_framework/domain/models/backtesting/backtest_date_range.py +0 -47
- investing_algorithm_framework/domain/models/backtesting/backtest_position.py +0 -120
- investing_algorithm_framework/domain/models/backtesting/backtest_reports_evaluation.py +0 -0
- investing_algorithm_framework/domain/models/backtesting/backtest_results.py +0 -440
- investing_algorithm_framework/domain/models/data_source.py +0 -21
- investing_algorithm_framework/domain/models/date_range.py +0 -64
- investing_algorithm_framework/domain/models/trade/trade_risk_type.py +0 -34
- investing_algorithm_framework/domain/models/trading_data_types.py +0 -48
- investing_algorithm_framework/domain/models/trading_time_frame.py +0 -223
- investing_algorithm_framework/domain/services/market_data_sources.py +0 -543
- investing_algorithm_framework/domain/services/market_service.py +0 -153
- investing_algorithm_framework/domain/services/observable.py +0 -51
- investing_algorithm_framework/domain/services/observer.py +0 -19
- investing_algorithm_framework/infrastructure/models/market_data_sources/__init__.py +0 -16
- investing_algorithm_framework/infrastructure/models/market_data_sources/ccxt.py +0 -746
- investing_algorithm_framework/infrastructure/models/market_data_sources/csv.py +0 -270
- investing_algorithm_framework/infrastructure/models/market_data_sources/pandas.py +0 -312
- investing_algorithm_framework/infrastructure/services/market_service/__init__.py +0 -5
- investing_algorithm_framework/infrastructure/services/market_service/ccxt_market_service.py +0 -471
- investing_algorithm_framework/infrastructure/services/performance_service/__init__.py +0 -7
- investing_algorithm_framework/infrastructure/services/performance_service/backtest_performance_service.py +0 -2
- investing_algorithm_framework/infrastructure/services/performance_service/performance_service.py +0 -322
- investing_algorithm_framework/services/market_data_source_service/__init__.py +0 -10
- investing_algorithm_framework/services/market_data_source_service/backtest_market_data_source_service.py +0 -269
- investing_algorithm_framework/services/market_data_source_service/data_provider_service.py +0 -350
- investing_algorithm_framework/services/market_data_source_service/market_data_source_service.py +0 -377
- investing_algorithm_framework/services/strategy_orchestrator_service.py +0 -296
- investing_algorithm_framework-6.9.1.dist-info/METADATA +0 -440
- /investing_algorithm_framework/{app/reporting → services}/metrics/alpha.py +0 -0
- /investing_algorithm_framework/{app/reporting → services}/metrics/beta.py +0 -0
- /investing_algorithm_framework/{app/reporting → services}/metrics/cagr.py +0 -0
- /investing_algorithm_framework/{app/reporting → services}/metrics/calmar_ratio.py +0 -0
- /investing_algorithm_framework/{app/reporting → services}/metrics/mean_daily_return.py +0 -0
- /investing_algorithm_framework/{app/reporting → services}/metrics/price_efficiency.py +0 -0
- /investing_algorithm_framework/{app/reporting → services}/metrics/standard_deviation.py +0 -0
- /investing_algorithm_framework/{app/reporting → services}/metrics/treynor_ratio.py +0 -0
- /investing_algorithm_framework/{app/reporting → services}/metrics/ulcer.py +0 -0
- /investing_algorithm_framework/{app/reporting → services}/metrics/value_at_risk.py +0 -0
- {investing_algorithm_framework-6.9.1.dist-info → investing_algorithm_framework-7.19.15.dist-info}/LICENSE +0 -0
- {investing_algorithm_framework-6.9.1.dist-info → investing_algorithm_framework-7.19.15.dist-info}/WHEEL +0 -0
- {investing_algorithm_framework-6.9.1.dist-info → investing_algorithm_framework-7.19.15.dist-info}/entry_points.txt +0 -0
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
from dependency_injector import containers, providers
|
|
2
2
|
|
|
3
|
-
from investing_algorithm_framework.app.context import Context
|
|
4
3
|
from investing_algorithm_framework.app.algorithm import AlgorithmFactory
|
|
4
|
+
from investing_algorithm_framework.app.context import Context
|
|
5
5
|
from investing_algorithm_framework.infrastructure import SQLOrderRepository, \
|
|
6
6
|
SQLPositionRepository, SQLPortfolioRepository, \
|
|
7
7
|
SQLPortfolioSnapshotRepository, SQLTradeRepository, \
|
|
8
|
-
SQLPositionSnapshotRepository,
|
|
9
|
-
|
|
10
|
-
SQLOrderMetadataRepository
|
|
8
|
+
SQLPositionSnapshotRepository, SQLTradeStopLossRepository, \
|
|
9
|
+
SQLTradeTakeProfitRepository, SQLOrderMetadataRepository
|
|
11
10
|
from investing_algorithm_framework.services import OrderService, \
|
|
12
|
-
PositionService, PortfolioService,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
PositionService, PortfolioService, PortfolioConfigurationService, \
|
|
12
|
+
BacktestService, ConfigurationService, PortfolioSnapshotService, \
|
|
13
|
+
PositionSnapshotService, MarketCredentialService, TradeService, \
|
|
14
|
+
PortfolioSyncService, OrderExecutorLookup, PortfolioProviderLookup, \
|
|
15
|
+
DataProviderService, TradeTakeProfitService, TradeStopLossService
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
def setup_dependency_container(app, modules=None, packages=None):
|
|
@@ -55,15 +54,10 @@ class DependencyContainer(containers.DeclarativeContainer):
|
|
|
55
54
|
trade_take_profit_repository = providers\
|
|
56
55
|
.Factory(SQLTradeTakeProfitRepository)
|
|
57
56
|
trade_stop_loss_repository = providers.Factory(SQLTradeStopLossRepository)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
market_data_source_service = providers.ThreadSafeSingleton(
|
|
63
|
-
MarketDataSourceService,
|
|
64
|
-
market_service=market_service,
|
|
65
|
-
market_credential_service=market_credential_service,
|
|
66
|
-
configuration_service=configuration_service
|
|
57
|
+
data_provider_service = providers.ThreadSafeSingleton(
|
|
58
|
+
DataProviderService,
|
|
59
|
+
configuration_service=configuration_service,
|
|
60
|
+
market_credential_service=market_credential_service
|
|
67
61
|
)
|
|
68
62
|
position_snapshot_service = providers.Factory(
|
|
69
63
|
PositionSnapshotService,
|
|
@@ -76,8 +70,7 @@ class DependencyContainer(containers.DeclarativeContainer):
|
|
|
76
70
|
portfolio_repository=portfolio_repository,
|
|
77
71
|
position_snapshot_service=position_snapshot_service,
|
|
78
72
|
position_repository=position_repository,
|
|
79
|
-
|
|
80
|
-
configuration_service=configuration_service
|
|
73
|
+
data_provider_service=data_provider_service,
|
|
81
74
|
)
|
|
82
75
|
portfolio_configuration_service = providers.ThreadSafeSingleton(
|
|
83
76
|
PortfolioConfigurationService,
|
|
@@ -93,9 +86,16 @@ class DependencyContainer(containers.DeclarativeContainer):
|
|
|
93
86
|
trade_repository=trade_repository,
|
|
94
87
|
portfolio_repository=portfolio_repository,
|
|
95
88
|
position_repository=position_repository,
|
|
96
|
-
market_data_source_service=market_data_source_service,
|
|
97
89
|
order_metadata_repository=order_metadata_repository,
|
|
98
90
|
)
|
|
91
|
+
trade_take_profit_service = providers.Factory(
|
|
92
|
+
TradeTakeProfitService,
|
|
93
|
+
repository=trade_take_profit_repository,
|
|
94
|
+
)
|
|
95
|
+
trade_stop_loss_service = providers.Factory(
|
|
96
|
+
TradeStopLossService,
|
|
97
|
+
repository=trade_stop_loss_repository,
|
|
98
|
+
)
|
|
99
99
|
position_service = providers.Factory(
|
|
100
100
|
PositionService,
|
|
101
101
|
portfolio_repository=portfolio_repository,
|
|
@@ -134,33 +134,18 @@ class DependencyContainer(containers.DeclarativeContainer):
|
|
|
134
134
|
portfolio_repository=portfolio_repository,
|
|
135
135
|
portfolio_configuration_service=portfolio_configuration_service,
|
|
136
136
|
market_credential_service=market_credential_service,
|
|
137
|
-
market_service=market_service,
|
|
138
137
|
portfolio_provider_lookup=portfolio_provider_lookup,
|
|
139
138
|
)
|
|
140
|
-
strategy_orchestrator_service = providers.Factory(
|
|
141
|
-
StrategyOrchestratorService,
|
|
142
|
-
market_data_source_service=market_data_source_service,
|
|
143
|
-
configuration_service=configuration_service,
|
|
144
|
-
)
|
|
145
|
-
performance_service = providers.Factory(
|
|
146
|
-
PerformanceService,
|
|
147
|
-
trade_repository=trade_repository,
|
|
148
|
-
order_repository=order_repository,
|
|
149
|
-
position_repository=position_repository,
|
|
150
|
-
portfolio_repository=portfolio_repository
|
|
151
|
-
)
|
|
152
139
|
backtest_service = providers.Factory(
|
|
153
140
|
BacktestService,
|
|
154
141
|
configuration_service=configuration_service,
|
|
155
142
|
order_service=order_service,
|
|
156
143
|
trade_service=trade_service,
|
|
157
144
|
portfolio_service=portfolio_service,
|
|
158
|
-
performance_service=performance_service,
|
|
159
145
|
position_repository=position_repository,
|
|
160
|
-
market_data_source_service=market_data_source_service,
|
|
161
146
|
portfolio_configuration_service=portfolio_configuration_service,
|
|
162
|
-
strategy_orchestrator_service=strategy_orchestrator_service,
|
|
163
147
|
portfolio_snapshot_service=portfolio_snapshot_service,
|
|
148
|
+
data_provider_service=data_provider_service,
|
|
164
149
|
)
|
|
165
150
|
context = providers.Factory(
|
|
166
151
|
Context,
|
|
@@ -170,9 +155,10 @@ class DependencyContainer(containers.DeclarativeContainer):
|
|
|
170
155
|
position_service=position_service,
|
|
171
156
|
order_service=order_service,
|
|
172
157
|
market_credential_service=market_credential_service,
|
|
173
|
-
market_data_source_service=market_data_source_service,
|
|
174
|
-
market_service=market_service,
|
|
175
158
|
trade_service=trade_service,
|
|
159
|
+
data_provider_service=data_provider_service,
|
|
160
|
+
trade_stop_loss_service=trade_stop_loss_service,
|
|
161
|
+
trade_take_profit_service=trade_take_profit_service,
|
|
176
162
|
)
|
|
177
163
|
algorithm_factory = providers.Factory(
|
|
178
164
|
AlgorithmFactory,
|
|
@@ -1,40 +1,43 @@
|
|
|
1
|
-
from .config import Environment, DEFAULT_LOGGING_CONFIG
|
|
1
|
+
from .config import Environment, DEFAULT_LOGGING_CONFIG, \
|
|
2
|
+
AWS_LAMBDA_LOGGING_CONFIG
|
|
2
3
|
from .constants import ITEMIZE, ITEMIZED, PER_PAGE, PAGE, ENVIRONMENT, \
|
|
3
4
|
DATABASE_DIRECTORY_PATH, DATABASE_NAME, DEFAULT_PER_PAGE_VALUE, \
|
|
4
5
|
DEFAULT_PAGE_VALUE, SQLALCHEMY_DATABASE_URI, RESOURCE_DIRECTORY, \
|
|
5
6
|
DATETIME_FORMAT, DATETIME_FORMAT_BACKTESTING, BACKTESTING_FLAG, \
|
|
6
|
-
|
|
7
|
+
BACKTESTING_START_DATE, CCXT_DATETIME_FORMAT, \
|
|
7
8
|
BACKTEST_DATA_DIRECTORY_NAME, TICKER_DATA_TYPE, OHLCV_DATA_TYPE, \
|
|
8
|
-
CURRENT_UTC_DATETIME, BACKTESTING_END_DATE,
|
|
9
|
-
CCXT_DATETIME_FORMAT_WITH_TIMEZONE,
|
|
9
|
+
CURRENT_UTC_DATETIME, BACKTESTING_END_DATE, \
|
|
10
|
+
CCXT_DATETIME_FORMAT_WITH_TIMEZONE, \
|
|
10
11
|
APP_MODE, DATABASE_DIRECTORY_NAME, BACKTESTING_INITIAL_AMOUNT, \
|
|
11
|
-
APPLICATION_DIRECTORY, SNAPSHOT_INTERVAL, AWS_S3_STATE_BUCKET_NAME
|
|
12
|
+
APPLICATION_DIRECTORY, SNAPSHOT_INTERVAL, AWS_S3_STATE_BUCKET_NAME, \
|
|
13
|
+
LAST_SNAPSHOT_DATETIME, DATA_DIRECTORY, INDEX_DATETIME, \
|
|
14
|
+
DATETIME_FORMAT_FILE_NAME, DEFAULT_DATETIME_FORMAT
|
|
12
15
|
from .data_provider import DataProvider
|
|
13
16
|
from .data_structures import PeekableQueue
|
|
14
17
|
from .decimal_parsing import parse_decimal_to_string, parse_string_to_decimal
|
|
15
|
-
from .exceptions import OperationalException, ApiException, \
|
|
18
|
+
from .exceptions import OperationalException, ApiException, DataError, \
|
|
16
19
|
PermissionDeniedApiException, ImproperlyConfigured, NetworkError
|
|
17
20
|
from .models import OrderStatus, OrderSide, OrderType, TimeInterval, \
|
|
18
|
-
TimeUnit, TimeFrame,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
MarketDataType, TradeRiskType, TradeTakeProfit, TradeStopLoss, \
|
|
24
|
-
DataSource, Event, SnapshotInterval
|
|
21
|
+
TimeUnit, TimeFrame, PortfolioConfiguration, Portfolio, Position, \
|
|
22
|
+
Order, TradeStatus, StrategyProfile, Trade, MarketCredential, \
|
|
23
|
+
AppMode, DataType, DataSource, PortfolioSnapshot, PositionSnapshot, \
|
|
24
|
+
TradeTakeProfit, TradeStopLoss, Event, SnapshotInterval, \
|
|
25
|
+
TakeProfitRule, StopLossRule, PositionSize
|
|
25
26
|
from .order_executor import OrderExecutor
|
|
26
27
|
from .portfolio_provider import PortfolioProvider
|
|
27
|
-
from .services import
|
|
28
|
-
|
|
29
|
-
MarketService, MarketCredentialService, AbstractPortfolioSyncService, \
|
|
30
|
-
RoundingService, StateHandler, Observable, Observer
|
|
28
|
+
from .services import MarketCredentialService, AbstractPortfolioSyncService, \
|
|
29
|
+
RoundingService, StateHandler
|
|
31
30
|
from .stateless_actions import StatelessActions
|
|
32
31
|
from .strategy import Strategy
|
|
33
32
|
from .utils import random_string, append_dict_as_row_to_csv, \
|
|
34
33
|
add_column_headers_to_csv, get_total_amount_of_rows, \
|
|
35
|
-
convert_polars_to_pandas, random_number, \
|
|
36
|
-
csv_to_list, StoppableThread, load_csv_into_dict, \
|
|
34
|
+
convert_polars_to_pandas, random_number, is_jupyter_notebook, \
|
|
35
|
+
csv_to_list, StoppableThread, load_csv_into_dict, tqdm, \
|
|
37
36
|
is_timezone_aware, sync_timezones, get_timezone
|
|
37
|
+
from .backtesting import BacktestRun, BacktestSummaryMetrics, \
|
|
38
|
+
BacktestDateRange, Backtest, BacktestMetrics, combine_backtests, \
|
|
39
|
+
BacktestPermutationTest, BacktestEvaluationFocus, \
|
|
40
|
+
generate_backtest_summary_metrics
|
|
38
41
|
|
|
39
42
|
__all__ = [
|
|
40
43
|
"OrderStatus",
|
|
@@ -54,8 +57,6 @@ __all__ = [
|
|
|
54
57
|
"DEFAULT_PER_PAGE_VALUE",
|
|
55
58
|
"DEFAULT_PAGE_VALUE",
|
|
56
59
|
"SQLALCHEMY_DATABASE_URI",
|
|
57
|
-
"TradingDataType",
|
|
58
|
-
"TradingTimeFrame",
|
|
59
60
|
"random_string",
|
|
60
61
|
"append_dict_as_row_to_csv",
|
|
61
62
|
"add_column_headers_to_csv",
|
|
@@ -76,27 +77,19 @@ __all__ = [
|
|
|
76
77
|
"StatelessActions",
|
|
77
78
|
"parse_decimal_to_string",
|
|
78
79
|
"parse_string_to_decimal",
|
|
79
|
-
"
|
|
80
|
+
"BacktestRun",
|
|
80
81
|
"DATETIME_FORMAT_BACKTESTING",
|
|
81
82
|
"BACKTESTING_FLAG",
|
|
82
|
-
"BACKTESTING_INDEX_DATETIME",
|
|
83
83
|
"PortfolioSnapshot",
|
|
84
84
|
"BACKTESTING_START_DATE",
|
|
85
85
|
"StrategyProfile",
|
|
86
|
-
"BacktestPosition",
|
|
87
86
|
"CCXT_DATETIME_FORMAT",
|
|
88
87
|
"BACKTEST_DATA_DIRECTORY_NAME",
|
|
89
88
|
"Trade",
|
|
90
89
|
"TICKER_DATA_TYPE",
|
|
91
90
|
"OHLCV_DATA_TYPE",
|
|
92
|
-
"TickerMarketDataSource",
|
|
93
|
-
"OrderBookMarketDataSource",
|
|
94
|
-
"OHLCVMarketDataSource",
|
|
95
|
-
"BacktestMarketDataSource",
|
|
96
|
-
"MarketDataSource",
|
|
97
91
|
"CURRENT_UTC_DATETIME",
|
|
98
92
|
"MarketCredential",
|
|
99
|
-
"MarketService",
|
|
100
93
|
"PeekableQueue",
|
|
101
94
|
"BACKTESTING_END_DATE",
|
|
102
95
|
"PositionSnapshot",
|
|
@@ -104,20 +97,15 @@ __all__ = [
|
|
|
104
97
|
"TradeStatus",
|
|
105
98
|
"CCXT_DATETIME_FORMAT_WITH_TIMEZONE",
|
|
106
99
|
"load_csv_into_dict",
|
|
107
|
-
"SYMBOLS",
|
|
108
|
-
"RESERVED_BALANCES",
|
|
109
100
|
"AbstractPortfolioSyncService",
|
|
110
101
|
"APP_MODE",
|
|
111
102
|
"AppMode",
|
|
112
103
|
"RoundingService",
|
|
113
104
|
"BacktestDateRange",
|
|
114
105
|
"convert_polars_to_pandas",
|
|
115
|
-
"DateRange",
|
|
116
106
|
"DEFAULT_LOGGING_CONFIG",
|
|
117
107
|
"DATABASE_DIRECTORY_NAME",
|
|
118
108
|
"BACKTESTING_INITIAL_AMOUNT",
|
|
119
|
-
"MarketDataType",
|
|
120
|
-
"TradeRiskType",
|
|
121
109
|
"TradeTakeProfit",
|
|
122
110
|
"TradeStopLoss",
|
|
123
111
|
"StateHandler",
|
|
@@ -131,10 +119,29 @@ __all__ = [
|
|
|
131
119
|
"is_timezone_aware",
|
|
132
120
|
"sync_timezones",
|
|
133
121
|
"get_timezone",
|
|
134
|
-
"Observer",
|
|
135
|
-
"Observable",
|
|
136
122
|
"Event",
|
|
137
123
|
"SNAPSHOT_INTERVAL",
|
|
138
124
|
"SnapshotInterval",
|
|
139
|
-
"AWS_S3_STATE_BUCKET_NAME"
|
|
125
|
+
"AWS_S3_STATE_BUCKET_NAME",
|
|
126
|
+
"AWS_LAMBDA_LOGGING_CONFIG",
|
|
127
|
+
"DataType",
|
|
128
|
+
"DataSource",
|
|
129
|
+
"Backtest",
|
|
130
|
+
"BacktestMetrics",
|
|
131
|
+
"BacktestSummaryMetrics",
|
|
132
|
+
"BacktestPermutationTest",
|
|
133
|
+
"LAST_SNAPSHOT_DATETIME",
|
|
134
|
+
"DATA_DIRECTORY",
|
|
135
|
+
"INDEX_DATETIME",
|
|
136
|
+
"DATETIME_FORMAT_FILE_NAME",
|
|
137
|
+
"is_jupyter_notebook",
|
|
138
|
+
"tqdm",
|
|
139
|
+
"DEFAULT_DATETIME_FORMAT",
|
|
140
|
+
"BacktestEvaluationFocus",
|
|
141
|
+
'combine_backtests',
|
|
142
|
+
'PositionSize',
|
|
143
|
+
'generate_backtest_summary_metrics',
|
|
144
|
+
'DataError',
|
|
145
|
+
'TakeProfitRule',
|
|
146
|
+
'StopLossRule'
|
|
140
147
|
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from .backtest_summary_metrics import BacktestSummaryMetrics
|
|
2
|
+
from .backtest_date_range import BacktestDateRange
|
|
3
|
+
from .backtest_metrics import BacktestMetrics
|
|
4
|
+
from .backtest_run import BacktestRun
|
|
5
|
+
from .backtest import Backtest
|
|
6
|
+
from .backtest_permutation_test import BacktestPermutationTest
|
|
7
|
+
from .backtest_evaluation_focuss import BacktestEvaluationFocus
|
|
8
|
+
from .combine_backtests import combine_backtests, \
|
|
9
|
+
generate_backtest_summary_metrics
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"Backtest",
|
|
13
|
+
"BacktestSummaryMetrics",
|
|
14
|
+
"BacktestDateRange",
|
|
15
|
+
"BacktestMetrics",
|
|
16
|
+
"BacktestRun",
|
|
17
|
+
"BacktestPermutationTest",
|
|
18
|
+
"BacktestEvaluationFocus",
|
|
19
|
+
"combine_backtests",
|
|
20
|
+
"generate_backtest_summary_metrics"
|
|
21
|
+
]
|