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.

Files changed (192) hide show
  1. investing_algorithm_framework/__init__.py +147 -44
  2. investing_algorithm_framework/app/__init__.py +23 -6
  3. investing_algorithm_framework/app/algorithm/algorithm.py +5 -41
  4. investing_algorithm_framework/app/algorithm/algorithm_factory.py +17 -10
  5. investing_algorithm_framework/app/analysis/__init__.py +15 -0
  6. investing_algorithm_framework/app/analysis/backtest_data_ranges.py +121 -0
  7. investing_algorithm_framework/app/analysis/backtest_utils.py +107 -0
  8. investing_algorithm_framework/app/analysis/permutation.py +116 -0
  9. investing_algorithm_framework/app/analysis/ranking.py +297 -0
  10. investing_algorithm_framework/app/app.py +1322 -707
  11. investing_algorithm_framework/app/context.py +196 -88
  12. investing_algorithm_framework/app/eventloop.py +590 -0
  13. investing_algorithm_framework/app/reporting/__init__.py +16 -5
  14. investing_algorithm_framework/app/reporting/ascii.py +57 -202
  15. investing_algorithm_framework/app/reporting/backtest_report.py +284 -170
  16. investing_algorithm_framework/app/reporting/charts/__init__.py +10 -2
  17. investing_algorithm_framework/app/reporting/charts/entry_exist_signals.py +66 -0
  18. investing_algorithm_framework/app/reporting/charts/equity_curve.py +37 -0
  19. investing_algorithm_framework/app/reporting/charts/equity_curve_drawdown.py +11 -26
  20. investing_algorithm_framework/app/reporting/charts/line_chart.py +11 -0
  21. investing_algorithm_framework/app/reporting/charts/ohlcv_data_completeness.py +51 -0
  22. investing_algorithm_framework/app/reporting/charts/rolling_sharp_ratio.py +1 -1
  23. investing_algorithm_framework/app/reporting/generate.py +100 -114
  24. investing_algorithm_framework/app/reporting/tables/key_metrics_table.py +40 -32
  25. investing_algorithm_framework/app/reporting/tables/time_metrics_table.py +34 -27
  26. investing_algorithm_framework/app/reporting/tables/trade_metrics_table.py +23 -19
  27. investing_algorithm_framework/app/reporting/tables/trades_table.py +1 -1
  28. investing_algorithm_framework/app/reporting/tables/utils.py +1 -0
  29. investing_algorithm_framework/app/reporting/templates/report_template.html.j2 +10 -16
  30. investing_algorithm_framework/app/strategy.py +315 -175
  31. investing_algorithm_framework/app/task.py +5 -3
  32. investing_algorithm_framework/cli/cli.py +30 -12
  33. investing_algorithm_framework/cli/deploy_to_aws_lambda.py +131 -34
  34. investing_algorithm_framework/cli/initialize_app.py +20 -1
  35. investing_algorithm_framework/cli/templates/app_aws_lambda_function.py.template +18 -6
  36. investing_algorithm_framework/cli/templates/aws_lambda_dockerfile.template +22 -0
  37. investing_algorithm_framework/cli/templates/aws_lambda_dockerignore.template +92 -0
  38. investing_algorithm_framework/cli/templates/aws_lambda_requirements.txt.template +2 -2
  39. investing_algorithm_framework/cli/templates/azure_function_requirements.txt.template +1 -1
  40. investing_algorithm_framework/create_app.py +3 -5
  41. investing_algorithm_framework/dependency_container.py +25 -39
  42. investing_algorithm_framework/domain/__init__.py +45 -38
  43. investing_algorithm_framework/domain/backtesting/__init__.py +21 -0
  44. investing_algorithm_framework/domain/backtesting/backtest.py +503 -0
  45. investing_algorithm_framework/domain/backtesting/backtest_date_range.py +96 -0
  46. investing_algorithm_framework/domain/backtesting/backtest_evaluation_focuss.py +242 -0
  47. investing_algorithm_framework/domain/backtesting/backtest_metrics.py +459 -0
  48. investing_algorithm_framework/domain/backtesting/backtest_permutation_test.py +275 -0
  49. investing_algorithm_framework/domain/backtesting/backtest_run.py +605 -0
  50. investing_algorithm_framework/domain/backtesting/backtest_summary_metrics.py +162 -0
  51. investing_algorithm_framework/domain/backtesting/combine_backtests.py +280 -0
  52. investing_algorithm_framework/domain/config.py +27 -0
  53. investing_algorithm_framework/domain/constants.py +6 -34
  54. investing_algorithm_framework/domain/data_provider.py +200 -56
  55. investing_algorithm_framework/domain/exceptions.py +34 -1
  56. investing_algorithm_framework/domain/models/__init__.py +10 -19
  57. investing_algorithm_framework/domain/models/base_model.py +0 -6
  58. investing_algorithm_framework/domain/models/data/__init__.py +7 -0
  59. investing_algorithm_framework/domain/models/data/data_source.py +214 -0
  60. investing_algorithm_framework/domain/models/{market_data_type.py → data/data_type.py} +7 -7
  61. investing_algorithm_framework/domain/models/market/market_credential.py +6 -0
  62. investing_algorithm_framework/domain/models/order/order.py +34 -13
  63. investing_algorithm_framework/domain/models/order/order_status.py +1 -1
  64. investing_algorithm_framework/domain/models/order/order_type.py +1 -1
  65. investing_algorithm_framework/domain/models/portfolio/portfolio.py +14 -1
  66. investing_algorithm_framework/domain/models/portfolio/portfolio_configuration.py +5 -1
  67. investing_algorithm_framework/domain/models/portfolio/portfolio_snapshot.py +51 -11
  68. investing_algorithm_framework/domain/models/position/__init__.py +2 -1
  69. investing_algorithm_framework/domain/models/position/position.py +9 -0
  70. investing_algorithm_framework/domain/models/position/position_size.py +41 -0
  71. investing_algorithm_framework/domain/models/risk_rules/__init__.py +7 -0
  72. investing_algorithm_framework/domain/models/risk_rules/stop_loss_rule.py +51 -0
  73. investing_algorithm_framework/domain/models/risk_rules/take_profit_rule.py +55 -0
  74. investing_algorithm_framework/domain/models/snapshot_interval.py +0 -1
  75. investing_algorithm_framework/domain/models/strategy_profile.py +19 -151
  76. investing_algorithm_framework/domain/models/time_frame.py +7 -0
  77. investing_algorithm_framework/domain/models/time_interval.py +33 -0
  78. investing_algorithm_framework/domain/models/time_unit.py +63 -1
  79. investing_algorithm_framework/domain/models/trade/__init__.py +0 -2
  80. investing_algorithm_framework/domain/models/trade/trade.py +56 -32
  81. investing_algorithm_framework/domain/models/trade/trade_status.py +8 -2
  82. investing_algorithm_framework/domain/models/trade/trade_stop_loss.py +106 -41
  83. investing_algorithm_framework/domain/models/trade/trade_take_profit.py +161 -99
  84. investing_algorithm_framework/domain/order_executor.py +19 -0
  85. investing_algorithm_framework/domain/portfolio_provider.py +20 -1
  86. investing_algorithm_framework/domain/services/__init__.py +0 -13
  87. investing_algorithm_framework/domain/strategy.py +1 -29
  88. investing_algorithm_framework/domain/utils/__init__.py +5 -1
  89. investing_algorithm_framework/domain/utils/custom_tqdm.py +22 -0
  90. investing_algorithm_framework/domain/utils/jupyter_notebook_detection.py +19 -0
  91. investing_algorithm_framework/domain/utils/polars.py +17 -14
  92. investing_algorithm_framework/download_data.py +40 -10
  93. investing_algorithm_framework/infrastructure/__init__.py +13 -25
  94. investing_algorithm_framework/infrastructure/data_providers/__init__.py +7 -4
  95. investing_algorithm_framework/infrastructure/data_providers/ccxt.py +811 -546
  96. investing_algorithm_framework/infrastructure/data_providers/csv.py +433 -122
  97. investing_algorithm_framework/infrastructure/data_providers/pandas.py +599 -0
  98. investing_algorithm_framework/infrastructure/database/__init__.py +6 -2
  99. investing_algorithm_framework/infrastructure/database/sql_alchemy.py +81 -0
  100. investing_algorithm_framework/infrastructure/models/__init__.py +0 -13
  101. investing_algorithm_framework/infrastructure/models/order/order.py +9 -3
  102. investing_algorithm_framework/infrastructure/models/trades/trade_stop_loss.py +27 -8
  103. investing_algorithm_framework/infrastructure/models/trades/trade_take_profit.py +21 -7
  104. investing_algorithm_framework/infrastructure/order_executors/__init__.py +2 -0
  105. investing_algorithm_framework/infrastructure/order_executors/backtest_oder_executor.py +28 -0
  106. investing_algorithm_framework/infrastructure/repositories/repository.py +16 -2
  107. investing_algorithm_framework/infrastructure/repositories/trade_repository.py +2 -2
  108. investing_algorithm_framework/infrastructure/repositories/trade_stop_loss_repository.py +6 -0
  109. investing_algorithm_framework/infrastructure/repositories/trade_take_profit_repository.py +6 -0
  110. investing_algorithm_framework/infrastructure/services/__init__.py +0 -4
  111. investing_algorithm_framework/services/__init__.py +105 -8
  112. investing_algorithm_framework/services/backtesting/backtest_service.py +536 -476
  113. investing_algorithm_framework/services/configuration_service.py +14 -4
  114. investing_algorithm_framework/services/data_providers/__init__.py +5 -0
  115. investing_algorithm_framework/services/data_providers/data_provider_service.py +850 -0
  116. investing_algorithm_framework/{app/reporting → services}/metrics/__init__.py +48 -17
  117. investing_algorithm_framework/{app/reporting → services}/metrics/drawdown.py +10 -10
  118. investing_algorithm_framework/{app/reporting → services}/metrics/equity_curve.py +2 -2
  119. investing_algorithm_framework/{app/reporting → services}/metrics/exposure.py +60 -2
  120. investing_algorithm_framework/services/metrics/generate.py +358 -0
  121. investing_algorithm_framework/{app/reporting → services}/metrics/profit_factor.py +36 -0
  122. investing_algorithm_framework/{app/reporting → services}/metrics/recovery.py +2 -2
  123. investing_algorithm_framework/{app/reporting → services}/metrics/returns.py +146 -147
  124. investing_algorithm_framework/services/metrics/risk_free_rate.py +28 -0
  125. investing_algorithm_framework/{app/reporting/metrics/sharp_ratio.py → services/metrics/sharpe_ratio.py} +6 -10
  126. investing_algorithm_framework/{app/reporting → services}/metrics/sortino_ratio.py +3 -7
  127. investing_algorithm_framework/services/metrics/trades.py +500 -0
  128. investing_algorithm_framework/services/metrics/volatility.py +97 -0
  129. investing_algorithm_framework/{app/reporting → services}/metrics/win_rate.py +70 -3
  130. investing_algorithm_framework/services/order_service/order_backtest_service.py +21 -31
  131. investing_algorithm_framework/services/order_service/order_service.py +9 -71
  132. investing_algorithm_framework/services/portfolios/portfolio_provider_lookup.py +0 -2
  133. investing_algorithm_framework/services/portfolios/portfolio_service.py +3 -13
  134. investing_algorithm_framework/services/portfolios/portfolio_snapshot_service.py +62 -96
  135. investing_algorithm_framework/services/portfolios/portfolio_sync_service.py +0 -3
  136. investing_algorithm_framework/services/repository_service.py +5 -2
  137. investing_algorithm_framework/services/trade_order_evaluator/__init__.py +9 -0
  138. investing_algorithm_framework/services/trade_order_evaluator/backtest_trade_oder_evaluator.py +113 -0
  139. investing_algorithm_framework/services/trade_order_evaluator/default_trade_order_evaluator.py +51 -0
  140. investing_algorithm_framework/services/trade_order_evaluator/trade_order_evaluator.py +80 -0
  141. investing_algorithm_framework/services/trade_service/__init__.py +7 -1
  142. investing_algorithm_framework/services/trade_service/trade_service.py +51 -29
  143. investing_algorithm_framework/services/trade_service/trade_stop_loss_service.py +39 -0
  144. investing_algorithm_framework/services/trade_service/trade_take_profit_service.py +41 -0
  145. investing_algorithm_framework-7.19.15.dist-info/METADATA +537 -0
  146. {investing_algorithm_framework-6.9.1.dist-info → investing_algorithm_framework-7.19.15.dist-info}/RECORD +159 -148
  147. investing_algorithm_framework/app/reporting/evaluation.py +0 -243
  148. investing_algorithm_framework/app/reporting/metrics/risk_free_rate.py +0 -8
  149. investing_algorithm_framework/app/reporting/metrics/volatility.py +0 -69
  150. investing_algorithm_framework/cli/templates/requirements_azure_function.txt.template +0 -3
  151. investing_algorithm_framework/domain/models/backtesting/__init__.py +0 -9
  152. investing_algorithm_framework/domain/models/backtesting/backtest_date_range.py +0 -47
  153. investing_algorithm_framework/domain/models/backtesting/backtest_position.py +0 -120
  154. investing_algorithm_framework/domain/models/backtesting/backtest_reports_evaluation.py +0 -0
  155. investing_algorithm_framework/domain/models/backtesting/backtest_results.py +0 -440
  156. investing_algorithm_framework/domain/models/data_source.py +0 -21
  157. investing_algorithm_framework/domain/models/date_range.py +0 -64
  158. investing_algorithm_framework/domain/models/trade/trade_risk_type.py +0 -34
  159. investing_algorithm_framework/domain/models/trading_data_types.py +0 -48
  160. investing_algorithm_framework/domain/models/trading_time_frame.py +0 -223
  161. investing_algorithm_framework/domain/services/market_data_sources.py +0 -543
  162. investing_algorithm_framework/domain/services/market_service.py +0 -153
  163. investing_algorithm_framework/domain/services/observable.py +0 -51
  164. investing_algorithm_framework/domain/services/observer.py +0 -19
  165. investing_algorithm_framework/infrastructure/models/market_data_sources/__init__.py +0 -16
  166. investing_algorithm_framework/infrastructure/models/market_data_sources/ccxt.py +0 -746
  167. investing_algorithm_framework/infrastructure/models/market_data_sources/csv.py +0 -270
  168. investing_algorithm_framework/infrastructure/models/market_data_sources/pandas.py +0 -312
  169. investing_algorithm_framework/infrastructure/services/market_service/__init__.py +0 -5
  170. investing_algorithm_framework/infrastructure/services/market_service/ccxt_market_service.py +0 -471
  171. investing_algorithm_framework/infrastructure/services/performance_service/__init__.py +0 -7
  172. investing_algorithm_framework/infrastructure/services/performance_service/backtest_performance_service.py +0 -2
  173. investing_algorithm_framework/infrastructure/services/performance_service/performance_service.py +0 -322
  174. investing_algorithm_framework/services/market_data_source_service/__init__.py +0 -10
  175. investing_algorithm_framework/services/market_data_source_service/backtest_market_data_source_service.py +0 -269
  176. investing_algorithm_framework/services/market_data_source_service/data_provider_service.py +0 -350
  177. investing_algorithm_framework/services/market_data_source_service/market_data_source_service.py +0 -377
  178. investing_algorithm_framework/services/strategy_orchestrator_service.py +0 -296
  179. investing_algorithm_framework-6.9.1.dist-info/METADATA +0 -440
  180. /investing_algorithm_framework/{app/reporting → services}/metrics/alpha.py +0 -0
  181. /investing_algorithm_framework/{app/reporting → services}/metrics/beta.py +0 -0
  182. /investing_algorithm_framework/{app/reporting → services}/metrics/cagr.py +0 -0
  183. /investing_algorithm_framework/{app/reporting → services}/metrics/calmar_ratio.py +0 -0
  184. /investing_algorithm_framework/{app/reporting → services}/metrics/mean_daily_return.py +0 -0
  185. /investing_algorithm_framework/{app/reporting → services}/metrics/price_efficiency.py +0 -0
  186. /investing_algorithm_framework/{app/reporting → services}/metrics/standard_deviation.py +0 -0
  187. /investing_algorithm_framework/{app/reporting → services}/metrics/treynor_ratio.py +0 -0
  188. /investing_algorithm_framework/{app/reporting → services}/metrics/ulcer.py +0 -0
  189. /investing_algorithm_framework/{app/reporting → services}/metrics/value_at_risk.py +0 -0
  190. {investing_algorithm_framework-6.9.1.dist-info → investing_algorithm_framework-7.19.15.dist-info}/LICENSE +0 -0
  191. {investing_algorithm_framework-6.9.1.dist-info → investing_algorithm_framework-7.19.15.dist-info}/WHEEL +0 -0
  192. {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, PerformanceService, CCXTMarketService, \
9
- SQLTradeStopLossRepository, SQLTradeTakeProfitRepository, \
10
- SQLOrderMetadataRepository
8
+ SQLPositionSnapshotRepository, SQLTradeStopLossRepository, \
9
+ SQLTradeTakeProfitRepository, SQLOrderMetadataRepository
11
10
  from investing_algorithm_framework.services import OrderService, \
12
- PositionService, PortfolioService, StrategyOrchestratorService, \
13
- PortfolioConfigurationService, MarketDataSourceService, BacktestService, \
14
- ConfigurationService, PortfolioSnapshotService, PositionSnapshotService, \
15
- MarketCredentialService, TradeService, PortfolioSyncService, \
16
- OrderExecutorLookup, PortfolioProviderLookup
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
- market_service = providers.Factory(
59
- CCXTMarketService,
60
- market_credential_service=market_credential_service,
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
- datasource_service=market_data_source_service,
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
- BACKTESTING_INDEX_DATETIME, BACKTESTING_START_DATE, CCXT_DATETIME_FORMAT, \
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, SYMBOLS, \
9
- CCXT_DATETIME_FORMAT_WITH_TIMEZONE, RESERVED_BALANCES, \
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, TradingTimeFrame, TradingDataType, \
19
- PortfolioConfiguration, Portfolio, Position, Order, TradeStatus, \
20
- BacktestResult, PortfolioSnapshot, StrategyProfile, \
21
- BacktestPosition, Trade, MarketCredential, PositionSnapshot, \
22
- AppMode, BacktestDateRange, DateRange, \
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 TickerMarketDataSource, OrderBookMarketDataSource, \
28
- OHLCVMarketDataSource, BacktestMarketDataSource, MarketDataSource, \
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
- "BacktestResult",
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
+ ]