Skip to main content

Realtime alerts when your stocks cross thresholds

Project description

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.

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

stock-price-alerts-0.0.2.tar.gz (2.7 kB view details)

Uploaded Source

File details

Details for the file stock-price-alerts-0.0.2.tar.gz.

File metadata

  • Download URL: stock-price-alerts-0.0.2.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for stock-price-alerts-0.0.2.tar.gz
Algorithm Hash digest
SHA256 38f833f4281253e13b597ceae9322248e8f4733e407be33fc719140a6609ab1d
MD5 dfee29414a45f821fa239242f23b7bfb
BLAKE2b-256 ab05802dbbcff7a1edd7cdea09746b74e63bf69e2137e404990b0337ac97f3b0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page