strela

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

How to install and use

  1. Install the package. Two options:
    • pip install strela
    • Clone the repository and install the requirements using poetry.
  2. Set up your config file my_config.py based on the documentation in strela.config. (Review your config via strela.config.print_current_configuation.)
  3. Write your own runner script based on the blueprint in strela.my_runner. (Test your script by running it and -- if necessary -- setting strela.config.ENABLE_ALL_DOWS and/or strela.config.NO_MAIL to True.)
  4. Install your runner script as a daily cronjob or similar.

Example alerts

What a single Fluctulert looks like in the alert e-mail:

Fluctulert example

What a single DoubleDownAlert looks like in the alert e-mail:

DoubleDownAlert example

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".

https://github.com/ymyke/strela

Other noteworthy libraries

  • tessa: Find financial assets and get their price history without worrying about different APIs or rate limiting.
  • pypme: A Python package for PME (Public Market Equivalent) calculation.
 1"""
 2.. include:: ../README.md
 3"""
 4
 5__version__ = "0.3.1"
 6
 7from . import config
 8from . import alertstates
 9from . import templates
10from .alert_generator import generate_alerts
11from .mailer import mail
12from . import my_runner