strela - a python package for financial alerts 📈🚨📉
strela provides a toolbox to generate and send different kinds of alerts based on financial information.
The package is intended to be used to write a Python script that can be scheduled via
cronjob or similar facilities and runs everything necessary according to your needs. See
strela.my_runner as an example.
→ Check out the full documentation. 📖
Features & overview
strela.alert_generator: The central logic that brings all the building blocks together to retrieve and analyze the financial metrics and to generate and send alerts if applicable.strela.alertstates.alertstate.AlertState: The abstract base class for all alert states. Alert states encapsulate the logic to determine whether an alert has triggered or not. There are two concrete types of alerts:strela.alertstates.fluctulertstate.FluctulertState: Alerts for fluctuations (up or down) over certain thresholds.strela.alertstates.doubledownalertstate.DoubleDownAlertState: Alerts for significant downward movement which could trigger an over-proportional buy.
strela.templates: Classes to turn alerts into text or html strings that can be printed or mailed.strela.mailer: To send alerts via email.strela.config: Configuration management. Use the override mechanism described there to put your own user config file in place that overrides the settings in the default config file according to your environment.strela.my_runner: The script that brings it all together and runs the alert generator according to your requirements. Use this script as a blueprint to build your own runner script.strela.alertstates.alertstaterepository: Repositories (in memory or on disk) to store and retrieve alert states.
How to install and use
- Install the package. Two options:
pip install strela- Clone the repository and install the requirements using poetry.
- Set up your config file
my_config.pybased on the documentation instrela.config. (Review your config viastrela.config.print_current_configuation.) - Write your own runner script based on the blueprint in
strela.my_runner. (Test your script by running it and -- if necessary -- settingstrela.config.ENABLE_ALL_DOWSand/orstrela.config.NO_MAILtoTrue.) - Install your runner script as a daily cronjob or similar.
Example alerts
What a single Fluctulert looks like in the alert e-mail:
What a single DoubleDownAlert looks like in the alert e-mail:
Limitations
The overall software architecture features decent modularization and separation of concerns, but also has a lot of room left for improvement. E.g., better separation of concerns in AlertStates (mixing logic and output currently), better parametrization of alert states and templates, better extensibility, etc.
strela vs tessa
The strela package works seamlessly with tessa and its Symbol class and financial information access functionality.
At the same time, care was taken to make strela open and flexible enough to be used with other packages and/or your own code.
Still, many or most people will end up using strela together with tessa so it's worth discussing whether strela should be incorporated into tessa.
I decided to keep strela separate from tessa because strela has a distinctly different character: a) it is not purely a library but needs some script to be built on top and then called as a CLI tool / cronjob, b) it tends to rely on external files such as a list of symbols to be loaded, c) it needs a place to store the alert state (and will fail if that place doesn't exist, which seems to be unacceptable behavior for a pure library such as tessa).
But I would like to have your thoughts on this. Should strela and tessa be separate packages or better both in one? Add your thoughts to the respective issue.
A note on tests
Some of the tests hit the net and are marked as such with pytest.mark.net. That way,
you can easily run exclude those tests if you like: pytest -m "not net".
Link to Repository
https://github.com/ymyke/strela
Other noteworthy libraries
Metadata
Release files for strela 0.4
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 | Actions |
|---|---|---|---|---|
| strela-0.4.tar.gz | 14.7 kB | Without provenance | Details for strela-0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| strela-0.4-py3-none-any.whl | Python 3 | none | any | Details for strela-0.4-py3-none-any.whl |
Total release size: 32.2 kB
Release files / strela-0.4.tar.gz
| Download URL | strela-0.4.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
465bc33d3dc8feb8ba6fe3e99a20a5f33f24c93b4f07563ef0214e2904cd9f96
|
|
BLAKE2b-256 checksum How to use checksums |
35fcd9ab679896cd796df192a3e50319cfb0f1ec1a3f401a13ed7b8b0dd363fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.9.13 Windows/10
|
Release files / strela-0.4-py3-none-any.whl
| Download URL | strela-0.4-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83e68a8fe527003bfa3285efafb199ac5b058d4c66de67284b0387d1a56f359c
|
|
BLAKE2b-256 checksum How to use checksums |
d82d3d2e763f67089597912244197404038de0b51f6af5614eb6e8d4f9a6b9c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.9.13 Windows/10
|
Security for strela 0.4
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.