Skip to content

Commit a937f69

Browse files
committed
Fix report formatting
1 parent eb0ce7e commit a937f69

File tree

60 files changed

+65566
-6134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+65566
-6134
lines changed

docusaurus/docs/Contributing Guide/contributing.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,54 @@ to the maintainers in the [Discussions](https://github.com/coding-kitties/invest
4040
4141
8. Create a Pull Request inline with the [Pull Request Template](https://github.com/coding-kitties/investing-algorithm-framework/blob/main/docs/PULL_REQUEST_TEMPLATE.md).
4242
9. Wait for the maintainers to review your PR. Make changes if requested.
43-
10. Once your PR is approved, it will be merged into the main branch.
43+
10. Once your PR is approved, it will be merged into the main branch.
44+
45+
## Architecture Overview
46+
47+
### Onion layered architecture
48+
49+
The Investing Algorithm Framework follows an Onion Architecture pattern, which promotes separation of concerns and testability. The core of the architecture consists of:
50+
- **Domain Layer**: Contains the core business logic and domain entities. This layer is independent of any external frameworks or libraries.
51+
- **Application Layer**: Contains application services that orchestrate the domain logic. It interacts with the domain layer and provides a clean API for the outer layers.
52+
- **Infrastructure Layer**: Contains implementations of external services, such as data sources, APIs, and other integrations. This layer depends on the application layer but not the other way around.
53+
- **Service layer**: Contains the service classes that provide a higher-level API for the application layer. It is responsible for coordinating the interactions between the application layer and the infrastructure layer.
54+
55+
The architecture looks as follows:
56+
57+
```bash
58+
- investing_algorithm_framework
59+
├── domain
60+
│ ├── models
61+
│ ├── metrics
62+
│ ├── exceptions
63+
│ ├── constants
64+
│ └── interfaces
65+
├── services
66+
│ ├── services
67+
│ └── use_cases
68+
├── infrastructure
69+
│ ├── data_sources
70+
│ └── external_services
71+
├── APP
72+
│ ├── app.py
73+
│ ├── config.py
74+
| └── logger.py
75+
└── service_layer
76+
```
77+
78+
### Dataframes
79+
The framework relies heavily on dataframe operations and supports both Pandas and Polars. However, internally we always use Polars dataframes for performance reasons.
80+
Therefore, if a dataframe is passed as a parameter to a function, you can safely assume that it's a polars dataframe.
81+
82+
Polars is generally faster than Pandas for handling datetime operations — especially on large datasets — due to:
83+
* Its Rust-based backend (highly optimized)
84+
* Better multi-threaded execution
85+
* More efficient memory handling
86+
87+
#### Datetime handling
88+
Each timeseries dataframe will have its Datetime column timezone set to UTC. This is done to ensure consistency across different data sources
89+
and to avoid issues with timezone conversions. When working with datetime columns, always ensure that you are aware of the timezone and convert it to UTC if necessary.
90+
91+
Also, it's often the case the exchanges and brokers use UTC as the timezone for their data. For example, The CCXT documentation clearly states:
92+
93+
> Timestamps returned by fetchOHLCV() and other market data methods are in milliseconds since Epoch in UTC.

examples/backtest_example/resources/backtest_data/OHLCV_BTC-EUR_BINANCE_2h_2023-08-07-06-00_2023-12-02-00-00.csv

Lines changed: 0 additions & 1403 deletions
Large diffs are not rendered by default.

examples/backtest_example/resources/backtest_data/TICKER_BTC-EUR_BINANCE_2023-08-23-22-00_2023-12-02-00-00.csv

Lines changed: 0 additions & 1203 deletions
Large diffs are not rendered by default.
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
from .strategy_v3 import CrossOverStrategyV3
2-
3-
__all__ = [
4-
"CrossOverStrategyV3",
5-
]

examples/backtest_report.html

Lines changed: 0 additions & 1379 deletions
This file was deleted.
Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +0,0 @@
1-
# Trading bot strategies series
2-
This directory forms a list of example quantitative algorithms for
3-
implemented in Python with the Investing Algorithm Framework.
4-
The goal is to create a set of jupyter notebooks that can used as a reference
5-
for developing your own strategies.
6-
7-
8-
## Strategies
9-
1. [SMA_CROSSOVER: A strategy that uses Simple Moving Average Crossover](simple_moving_average_crossover.ipynb)
10-
2. ADX_RSI.ipynb: A strategy that uses Average Directional Index and RSI (adx_rsi.ipynb)

examples/test.ipynb

Lines changed: 0 additions & 1574 deletions
This file was deleted.

examples/test.py

Lines changed: 0 additions & 90 deletions
This file was deleted.

investing_algorithm_framework/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
TradingStrategy, StatelessAction, Task, AppHook, Context, \
33
add_html_report, add_metrics, BacktestReport, \
44
BacktestReportsEvaluation, pretty_print_trades, pretty_print_positions, \
5-
pretty_print_orders, pretty_print_backtest
5+
pretty_print_orders, pretty_print_backtest, select_backtest_date_ranges
66
from investing_algorithm_framework.domain import ApiException, \
77
TradingDataType, TradingTimeFrame, OrderType, OperationalException, \
88
OrderStatus, OrderSide, TimeUnit, TimeInterval, Order, Portfolio, \
@@ -93,5 +93,6 @@
9393
"add_html_report",
9494
"AWSS3StorageStateHandler",
9595
"AWS_S3_STATE_BUCKET_NAME",
96-
"AWS_LAMBDA_LOGGING_CONFIG"
96+
"AWS_LAMBDA_LOGGING_CONFIG",
97+
'select_backtest_date_ranges'
9798
]

investing_algorithm_framework/app/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from .reporting import add_html_report, add_metrics, \
99
BacktestReport, pretty_print_backtest, BacktestReportsEvaluation, \
1010
pretty_print_trades, pretty_print_positions, pretty_print_orders
11+
from .analysis import select_backtest_date_ranges
1112

1213

1314
__all__ = [
@@ -26,5 +27,6 @@
2627
"BacktestReportsEvaluation",
2728
"pretty_print_trades",
2829
"pretty_print_positions",
29-
"pretty_print_orders"
30+
"pretty_print_orders",
31+
"select_backtest_date_ranges"
3032
]

0 commit comments

Comments
 (0)