Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rsistocktrigger

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rsistocktrigger

Google Cloud Project Setup:

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

RSIStockTrigger

This Node.js application is designed to monitor the Relative Strength Index (RSI) of stocks, alerting users via email when RSI values indicate significant trading opportunities. It automatically checks stocks listed in a tickers.txt file against RSI thresholds and sends notifications using Gmail with OAuth2 authentication.

Features

  • Automated RSI Monitoring: Automatically checks the RSI for stocks at scheduled intervals.
  • Email Alerts: Sends emails when RSI values are below 30 or above 70, which often indicate oversold and overbought conditions respectively.
  • Secure Email Transmission: Uses OAuth2 for secure email transmission through Gmail.

Prerequisites

Before running this application, you will need:

  • Node.js installed on your machine.
  • A Gmail account configured with OAuth2 credentials for sending emails.
  • An accessible HTTP endpoint for RSI calculation.

Installation

To get started with this application, follow these steps:

  1. Clone the repository:
    git clone https://github.com/rsabh/RSIStockTrigger.git
    cd RSIStockTrigger
    
    
  2. Install dependencies:
    npm install
    
    
  3. Set up environment variables: Create a .env file in the root directory with the following content:
     EMAIL_USER=your-email@gmail.com
     CLIENT_ID=your-client-id
     CLIENT_SECRET=your-client-secret
     REFRESH_TOKEN=your-refresh-token
     RECIPIENT_EMAIL_USER=recipient-email@gmail.com
    
    
  4. Prepare the ticker list: Populate the tickers.txt file with the stock symbols you wish to monitor, one per line.

Running the Application

  • Start the server:
    node app.js
    
  • The script will execute based on the cron schedule set to monitor the RSI values at the desired frequency.

Configuration

  • Modify the cron job setup in app.js to adjust the frequency of checks:

    cron.schedule('* * * * *', async () => {
    // This sets the job to run every minute. Adjust as necessary.
    });
    

Troubleshooting

  • Authorization Errors: Double-check your OAuth2 credentials if you encounter authorization errors. -Email Delivery Issues: Ensure that the Gmail API is enabled and the quota is not exceeded.

Configuring OAuth2 for Gmail API

Follow these steps to configure OAuth2 credentials to enable your application to send emails using the Gmail API.

Step 1: Google Cloud Console Setup

  1. Access the Google Cloud Console

    • Visit Google Cloud Console.
  2. Create or Select a Project

    • Create a new project or select an existing project from the project dropdown in the header.
  3. Enable the Gmail API

    • Navigate to APIs & Services > Library.
    • Search for "Gmail API" and select it from the results.
    • Click Enable to activate the Gmail API for your project.

Step 2: Create OAuth2 Credentials

  1. Configure Consent Screen

    • Go to APIs & Services > Credentials.
    • Click on Configure Consent Screen and provide the necessary information.
    • Save the settings.
  2. Create Credentials

    • In the Credentials tab, click Create Credentials and select OAuth 2.0 Client IDs.
    • Fill out the form. For application type, choose Web application.
    • Add https://developers.google.com/oauthplayground as a redirect URI if you plan to use the OAuth 2.0 Playground to obtain the refresh token.

Step 3: Obtain Refresh Token Using OAuth 2.0 Playground

  1. Visit OAuth 2.0 Playground

  2. Configure the Playground

    • Click on the gear icon (Settings) and check Use your own OAuth credentials.
    • Enter your Client ID and Client Secret.
  3. Select & Authorize APIs

    • In the Step 1 section of the Playground, scroll or search for the Gmail API scopes you need, such as https://mail.google.com/.
    • Authorize the APIs by authenticating with your Google account and consenting to the access.
  4. Exchange Authorization Code for Tokens

    • In Step 2, click Exchange authorization code for tokens.
    • The refresh token and access token will be displayed. Copy the refresh token for use in your application.

Remember to secure your credentials and never commit them directly into your version control system.

FAQs

Package last updated on 13 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc