No project description provided
Project description
aplotly
Installation
pip install areport
Usage
For examples please refer to the code in the examples folder.
Report
The Report class contains the methods for computing common metrics and storing them to files. The class is initialized with a list of portfolio values. These values should always start with the initial value of 1, otherwise the class will raise an error.
from areport import Report
report = Report([1.0, 1.1, 1.2])
ReportComparison
The ReportComparison class contains the methods for comparing multiple reports. The class is initialized with one Report that is treated as the portfolio, and a dictionary of other Report instances that are treated as benchmarks.
from areport import ReportComparison
report_comparison = ReportComparison(report, {'benchmark1': report1, 'benchmark2': report2})
Metrics
The common metrics can be retrieved using the following methods:
from areport import Report
report = Report([1.0, 1.1, 1.2])
report.get_metrics()
The same is also possible for the ReportComparison class:
from areport import ReportComparison
report_comparison = ReportComparison(report, {'benchmark1': report1, 'benchmark2': report2})
report_comparison.get_metrics()
If you want to save the metrics to a file, you can use the metrics_to_{format} method:
from areport import Report
report = Report([1.0, 1.1, 1.2])
report.metrics_to_csv('report.csv')
report.metrics_to_json('report.json')
The same is also possible for the ReportComparison class:
from areport import ReportComparison
report_comparison = ReportComparison(report, {'benchmark1': report1, 'benchmark2': report2})
report_comparison.metrics_to_csv('report_comparison.csv')
report_comparison.metrics_to_json('report_comparison.json')
Using with aplotly
This package can be combined with the aplotly package to create interactive plots. The aplotly package is a wrapper around the plotly package that simplifies the creation of plots. The useful attrbutes of the Report class are pf_values and dt_pf_values.
Here is an example of how to use the aplotly package with the Report class to create the performance chart.
from aplotly.plots import plot_performance
from areport import Report
report = Report([1.0, 1.1, 1.2])
fig = plot_performance(
report.performance_to_pct(report.dt_pf_values - 1) # performance in percentage
report.drawdown_to_pct(report.drawdown, report.dt_pf_values.index) # drawdown in percentage
performance_label="Test",
drawdown_label="Test",
xlabel="X",
)
fig.show()
Metrics
Detailed documentation for the metrics can be found on Notion
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file areport-1.0.40.tar.gz.
File metadata
- Download URL: areport-1.0.40.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25981168f8ecaa16096edcec6c1f1797bae454c2ac7e2e5a926efbc30951f28d
|
|
| MD5 |
a1fa79e982dd29090573da9e32a27ff3
|
|
| BLAKE2b-256 |
df84ff792ea58e719c9d4468b88670148437d5f9f1e3d3db8e8d5820e894f599
|
File details
Details for the file areport-1.0.40-py3-none-any.whl.
File metadata
- Download URL: areport-1.0.40-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd14a2cb2bd747da06b0f412527c3f86255367be1c625ca22ac01b7400d6d7a7
|
|
| MD5 |
99e306051278b343562383a29efb538a
|
|
| BLAKE2b-256 |
bd5eb617cd3a210ba09ddc137e02cf2eb712a2aee91a0dee183c5ed1e558c5a7
|