Skip to content

It tracks a screener.in screen and tracks all the stock changes happening, based on that it sends message to your telegram id everyday.

License

Notifications You must be signed in to change notification settings

VishwaGauravIn/automatic-stock-tracker

Automatic Stock Tracker and Notifier

This project fetches stock data from the my SPECIAL screen (list of stocks) on Screener.in (you can replace it with anything), and sends you a telegram notification daily based on which stock was added to the list or removed.

How to use?

You will receive notification everyday @9:16AM (only if there is any change in the list)

Features

  • Fetches stock data: Retrieves stock names and prices from the provided URL.
  • Calculates differences: Compares current data with previously fetched data and calculates additions and deletions.
  • Archiving: Saves the differences to an archive folder with a timestamp if there are any changes.
  • Telegram Notifications: Sends a Telegram message about added and removed stocks.
  • GitHub Actions: Automatically runs the script daily at 9:16 AM IST via GitHub Actions.

 

 

For Developers

Setup

1. Clone the Repository

git clone https://github.com/VishwaGauravIn/automatic-stock-tracker.git
cd automatic-stock-tracker

2. Set Up Environment Variables

For the Telegram bot integration and any other sensitive data, you will need to set up the following environment variables:

  • BOT_TOKEN: Your Telegram bot token.
  • SCREEN_URL: The URL to your screener.in screen

You can set these up in GitHub Actions as Secrets:

  1. Go to your repository settings on GitHub.
  2. Under Secrets and Variables > Actions, click New repository secret.
  3. Add the following secrets:
  • BOT_TOKEN
  • SCREEN_URL

3. Ensure that you have sent a /start message to the bot

4. Configure GitHub Actions Workflow

This project uses GitHub Actions to automate daily execution of the script. The workflow will run the script every day at 9:16 AM IST (3:46 AM UTC).

Workflow Configuration

The workflow file .github/workflows/daily_stock_update.yml

5. File Handling in the Script

The following files are handled in the script:

  • latest.json: Contains the most recent stock data.
  • diff.json: Contains the differences (added and removed stocks) from the last fetched data.
  • archive/: Folder containing the archived diff.json files with timestamps.

The script will:

  • Fetch stock data from the provided URL.
  • Compare it with latest.json to find the differences (added/removed stocks).
  • Save the latest.json and diff.json files.
  • Archive the diff.json file if there are any additions or deletions in the data.
  • Send a Telegram notification with the details of added and removed stocks.

Directory Structure

stock-fetcher/
├── .github/
│   └── workflows/
│       └── daily_stock_update.yml       # GitHub Actions workflow
├── archive/                             # Contains archived diff files
├── daily_stock_update.js               # Node.js script to fetch and process stock data
├── latest.json                          # Most recent fetched stock data
├── diff.json                            # Difference data (added/removed stocks)
├── users.js                            # List of the users subscribed to the notification
└── README.md                            # Project documentation

About

It tracks a screener.in screen and tracks all the stock changes happening, based on that it sends message to your telegram id everyday.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published