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
Metadata
Release files for areport 1.0.42
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| areport-1.0.42.tar.gz | 16.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| areport-1.0.42-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.9 kB
Release files / areport-1.0.42.tar.gz
| Download URL | areport-1.0.42.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd65d138161372398a81b28aff28e43fa5869dd9e8bdc8c959dbae682f448ca5
|
|
BLAKE2b-256 checksum How to use checksums |
d441bfc756127d542c136160bded2ce23dcc093436575ed10cf3d69ece9ef684
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Release files / areport-1.0.42-py3-none-any.whl
| Download URL | areport-1.0.42-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e88b9da9d09ae0c1fcdf86f0f9d784e570632fc796cc8a2474b904e943b830a9
|
|
BLAKE2b-256 checksum How to use checksums |
134de8fca0fbbe80f3fd3778c2943826a935564c90a9e1c47f5402296c95ab0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Security for areport 1.0.42
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.