Skip to main content

stock-price-alerts

Build Status

A script that can send alerts when a stock prices crosses a given threshold.

Installation

  1. pip install stock-price-alerts
  2. Copy src/config_example.yml to your machine
  3. Modify config_example.yml to your liking, rename it to what you wish. See [Configuration]
  4. stock-price-alerts --config /path/to/your/config.yml

Configuration

In config_example.yml, you can see a skeleton configuration.

Configuration consists of 2 main parts:

  • ApplicationConfig

    • LogLevel: The desired verbosity of your logs
    • SlackAlert: For each object in the SlackAlert List, the script will end an alert to the Endpoint using the BotToken
    • SNSAlert: For each item in the SNSAlert List, an SMS will be sent using AWS SNS.
  • Symbols This is the bread and butter. You configure symbols you want to watch, set the alarm tresholds, and set the Type of bitstamp or yahoo for the datasource.

Alerts

SNS Configuration

This client can call Amazon Web Services Simple Notification Service (AWS SNS) to deliver a text message. This requires you to configure your aws-cli by executing aws configure and configuring the default profile with a set of keys generated by AWS IAM.

Slack Configuration

To set up the slack integration, create a slack app: https://api.slack.com/apps

You want to implment "Permissions" on your app, specifically you want to add the Bot Token Scope, chat:write. This is done under the https://api.slack.com/apps/{your_app_id}/oauth? page

After you have enabled the chat:write permission, you'll install your app from the left hand menu.

Once installed, grab your Bot User OAuth Access Token, and insert it to the config.yml as the BotToken parameter

Then, configure your Endpoint. If your Endpoint is a USER, you must feed the Slack Member ID, see here: https://help.workast.com/hc/en-us/articles/360027461274-How-to-find-a-Slack-user-ID

If your Endpoint is a channel, get the channel ID from your browser as discussed here: https://www.wikihow.com/Find-a-Channel-ID-on-Slack-on-PC-or-Mac

Requirements

  • Python >=3.6

Optional Parameters

--config [FILENAME] defines an alertnate configuration file. Default is config.yml

--sleep amount of seconds to sleep between loops, if --loop is enabled.

--loop causes the program to stay in an infinite loop. requires a --sleep parameter

Example Usage

stock-price-alerts --help stock-price-alerts --config /home/alex/stock-price-alerts.yml stock-price-alerts --loop --sleep 3600 to sleep 30 minutes between checks.

Release files for stock-price-alerts 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stock-price-alerts 0.0.2
File Size Uploaded
stock-price-alerts-0.0.2.tar.gz 2.7 kB Details

Release files / stock-price-alerts-0.0.2.tar.gz

Download URL stock-price-alerts-0.0.2.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
38f833f4281253e13b597ceae9322248e8f4733e407be33fc719140a6609ab1d
BLAKE2b-256 checksum
How to use checksums
ab05802dbbcff7a1edd7cdea09746b74e63bf69e2137e404990b0337ac97f3b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page