A python package for financial alerts
Project description
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.py
based 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_DOWS
and/orstrela.config.NO_MAIL
toTrue
.) - 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
Project details
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
File details
Details for the file strela-0.3.4.tar.gz
.
File metadata
- Download URL: strela-0.3.4.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.10.2 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d79c265e22ba8ba95abbb516df4ad3ada3be2be36bec2d8bc55c5c195eaf39e0 |
|
MD5 | 6a6133fb5bac987f3b0ca2b5a918c69b |
|
BLAKE2b-256 | dbad80e40db8229ef5c1cc3ebc3ccabb685ccfce1fd398d07a446fcaf85ea962 |
File details
Details for the file strela-0.3.4-py3-none-any.whl
.
File metadata
- Download URL: strela-0.3.4-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.10.2 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfe89659d4c6c4e6788942209cd571371c674190b502f0994bec34db7c8ae49a |
|
MD5 | 71aad177635b3733303ec4d785a59f08 |
|
BLAKE2b-256 | c79f908ace95c43af215623a28f0db0679e7e0bde865296e32c691d582a5634d |