IBD Style Relative Strength Percentile Ranking of Stocks (i.e. 0-100 Score).

Overview

relative-strength

IBD Style Relative Strength Percentile Ranking of Stocks (i.e. 0-100 Score).
I also made a TradingView indicator, but it cannot give you the percentile ranking, it just shows you the Relative Strength: https://www.tradingview.com/script/SHE1xOMC-Relative-Strength-IBD-Style/

Daily Generated Outputs

Stocks: https://github.com/skyte/rs-log/blob/main/output/rs_stocks.csv
Industries: https://github.com/skyte/rs-log/blob/main/output/rs_industries.csv

Known Issues

Unfortunately the close prices loaded from the price history API are not always split adjusted. So if a stock had a split recently there is a chance the relative strength value will be wrong...

Calculation

Yearly performance of stock (most recent quarter is weighted double) divided by yearly performance of reference index (SPY by default).

Considered Stocks

Tickers from ftp://ftp.nasdaqtrader.com/symboldirectory/nasdaqtraded.txt disregarding ETFs and all stocks where the industry and sector information couldn't be retrieved from yahoo finance.

How To Run

Run EXE

  1. Open the latest successful run here: https://github.com/skyte/relative-strength/actions/workflows/exe.yml
  2. Download exe-package at the bottom (need to be logged in into github)
  3. Exctract the relative-strength folder and enter it
    • If needed open config.yaml and put in your preferences
  4. Run relative-strength.exe

Run Python Script

  1. Open config.yaml and put in your preferences
  2. Install requirements: python -m pip install -r requirements.txt
  3. Run relative-strength.py

Separate Steps

Instead of running relative-strength.py you can also:

  1. Run rs_data.py to aggregate the price data
  2. Run rs_ranking.py to calculate the relative strength rankings

*** Output ***

  • in the output folder you will find:
    • the list of ranked stocks: rs_stocks.csv
    • the list of ranked industries: rs_industries.csv

Config

Private File

You can create a config_private.yaml next to config.yaml and overwrite some parameters like API_KEY. That way you don't get conflicts when pulling a new version.

Data Sources

Can be switched with the field DATA_SOURCE

Yahoo Finance

(Benchmark: Loads 1500 Stocks in 20m)

  • Is default, no config necessary.
TD Ameritrade

(Benchmark: Loads 1500 Stocks in 18m)

  1. Create TDAmeritrade Developer Account and App
  2. Put in your API_KEY in config.yaml and change DATA_SOURCE.
You might also like...
ANKIT-OS/STYLISH-TEXT is a special repository. Its Is A Telegram Bot Which Can Translate Your Text Into 100+ Language
ANKIT-OS/STYLISH-TEXT is a special repository. Its Is A Telegram Bot Which Can Translate Your Text Into 100+ Language

🔥 ᴳᴼᴼᴳᴸᴱ⁻ᵀᴿᴬᴺᔆᴸᴬᵀᴱᴿ 🔥 The owner would not be responsible for any kind of bans due to the bot. • ⚡ INSTALLING ⚡ • • 🛠️ Lᴀɴɢᴜᴀɢᴇs Aɴᴅ Tᴏᴏʟs 🔰 • If

Instagram auto reporting tool 100% working

INSTA REPORTER Instagram auto reporting tool 100% working Description this tool is made by Guccifer Shubham (shubhushubhu99) and by using this tool yo

Bot developed in python, 100% open-source, compatible with Windows and Linux.
Bot developed in python, 100% open-source, compatible with Windows and Linux.

Bombcrypto Bot [Family JOW] Bot desenvolvido em python, 100% do código é aberto, para aqueles que tenham conhecimento validarem que não existe nenhum

A fun hangman style game to guess random movie names with a short summary about the movie.

hang-movie-man Hangman but for movies 😉 This is a fun hangman style game to guess random movie names from the local database and show some summary ab

A Django-style ORM idea for manipulating Google Datastore entities

No SeiQueLa ORM EM DESENVOLVIMENTO Uma ideia de ORM no estilo do Django para manipular entidades do Google Datastore. Montando seu modelo: from noseiq

A simple python oriented telegram bot to give out creative font style's

Font-Bot A simple python oriented telegram bot to give out creative font style's REQUIREMENTS tgcrypto pyrogram==1.2.9 Installation Fork this reposito

Track live sentiment for stocks from Reddit and Twitter and identify growing stocks
Track live sentiment for stocks from Reddit and Twitter and identify growing stocks

Market Sentiment About This repository can mainly be used for two things. a. Tracking the live sentiment of stocks from Reddit and Twitter b. Tracking

Median and percentile for Django and MongoEngine

Tailslide Median and percentile for Django and MongoEngine Supports: PostgreSQL SQLite MariaDB MySQL (with an extension) SQL Server MongoDB 🔥 Uses na

An efficient and effective learning to rank algorithm by mining information across ranking candidates. This repository contains the tensorflow implementation of SERank model. The code is developed based on TF-Ranking.
An efficient and effective learning to rank algorithm by mining information across ranking candidates. This repository contains the tensorflow implementation of SERank model. The code is developed based on TF-Ranking.

SERank An efficient and effective learning to rank algorithm by mining information across ranking candidates. This repository contains the tensorflow

LibRerank is a toolkit for re-ranking algorithms. There are a number of re-ranking algorithms, such as PRM, DLCM, GSF, miDNN, SetRank, EGRerank, Seq2Slate.

LibRerank LibRerank is a toolkit for re-ranking algorithms. There are a number of re-ranking algorithms, such as PRM, DLCM, GSF, miDNN, SetRank, EGRer

Transfer style api - An API to use with Tranfer Style App, where you can use two image and transfer the style

Transfer Style API It's an API to use with Tranfer Style App, where you can use

💫 Industrial-strength Natural Language Processing (NLP) in Python

spaCy: Industrial-strength NLP spaCy is a library for advanced Natural Language Processing in Python and Cython. It's built on the very latest researc

💫 Industrial-strength Natural Language Processing (NLP) in Python

spaCy: Industrial-strength NLP spaCy is a library for advanced Natural Language Processing in Python and Cython. It's built on the very latest researc

💫 Industrial-strength Natural Language Processing (NLP) in Python

spaCy: Industrial-strength NLP spaCy is a library for advanced Natural Language Processing in Python and Cython. It's built on the very latest researc

Implementation of "StrengthNet: Deep Learning-based Emotion Strength Assessment for Emotional Speech Synthesis"

StrengthNet Implementation of "StrengthNet: Deep Learning-based Emotion Strength Assessment for Emotional Speech Synthesis" https://arxiv.org/abs/2110

Convert relative imports to absolute
Convert relative imports to absolute

absolufy-imports A tool and pre-commit hook to automatically convert relative imports to absolute. Installation $ pip install absolufy-imports Usage a

QLUSTER is a relative orbit design tool for formation flying satellite missions and space rendezvous scenarios
QLUSTER is a relative orbit design tool for formation flying satellite missions and space rendezvous scenarios

QLUSTER is a relative orbit design tool for formation flying satellite missions and space rendezvous scenarios, that I wrote in Python 3 for my own research and visualisation. It is currently unfinished (95%) but the core algorithm and app works. Here's an example snippet of the GUI where four deputy satellites are orbiting a single chief in LEO.

Relative Positional Encoding for Transformers with Linear Complexity
Relative Positional Encoding for Transformers with Linear Complexity

Stochastic Positional Encoding (SPE) This is the source code repository for the ICML 2021 paper Relative Positional Encoding for Transformers with Lin

Fast and robust certifiable relative pose estimation

Fast and Robust Relative Pose Estimation for Calibrated Cameras This repository contains the code for the relative pose estimation between two central

Comments
  • Output folder Not being Created

    Output folder Not being Created

    Hi, I was hoping you could help me, I've tried running your application but I just get a black command window then a few lines get created and then it closes. Unfortunately I can't see the lines because it closes to quickly. There is no output folder created so I suspect it's and access issue but is there any way of seeing the text that gets created in the command window before it closes.

    Thanks

    opened by Chilly100 2
  • exe-package expired

    exe-package expired

    Hi, in the "How To Run", "Run EXE" says: "Download exe-package at the bottom (need to be logged in into github)", looks like this exe-package is expired, can you check? thank you

    opened by jn11 1
  • Incorrect RS formula with negative index returns

    Incorrect RS formula with negative index returns

    Hi,

    today the output rank for NFLX on rs_stocks.csv is 92, on IBD it is 6.

    The reason for such a high value is the formula being used for the relative strength doesn't take into account the index could have a negative return. This gives stocks with huge negative returns a fantastic relative strength and therefore fantastic rating.

    By changing the formula to a relative value centered around 1, we get the correct rank ordering as per IDB.

    rs = (1 + stock_return) / (1 + index_return)
    

    for full example:

    rs_list = []
    for i in [1, 2, 3, 4]:
        l = min(len(stock_closes), 63 * i)
        stock_return = (stock_closes[-1] - stock_closes[-l]) / stock_closes[-l]
        index_return = (index_closes[-1] - index_closes[-l]) / index_closes[-l]
        rs_period = (1 + stock_return) / (1 + index_return)
        rs_list.append(rs_period )
    
    relative_strength = (rs_list[0] * 0.4) + (rs_list[1] * 0.2) + (rs_list[2] * 0.2) + (rs_list[3] * 0.2)
    

    and then after adding the data to a dataframe, rank is

    df['rank'] = df['rs'].rank(pct=True) * 100
    

    Comparing the results to IBD gives a very high level of similarity (using 12000 tickers) and gradually gets looser using less tickers. However the order of the rank remains consistent.

    Additionally, the formula currently sums the quarterly strengths of the stock, and divides by the sum of the quarterly strengths of the index.

    (stock_rs1 + stock_rs2 + stock_rs3 + stock_rs4) / (index_rs1 + index_rs2 + index_rs3 + index_rs4)
    

    The normal formula quoted has the relative strength of the stock and index per quarter multiplied by that periods factor, and then summed.

    (stock_rs1/index_rs1) + (stock_rs2/index_rs2) + (stock_rs3/index_rs3) + (stock_rs4/index_rs4)
    

    Hope this helps.

    opened by carrickpaul 1
  • Would you like to be added to OPENBB ?(Open Source finance platform)

    Would you like to be added to OPENBB ?(Open Source finance platform)

    @skyte

    Hi, I recently made a suggestion that your ratings would be a valuable addition to the Open Source finance platform, OPENBB (formely Gamestonk terminal).

    Are you interested?

    If yes, I'm sure they would like to connect with you to discuss further. You can reach OPEN BB via https://twitter.com/openbb_finance or https://discord.com/invite/xPHTuHCmuV .

    opened by hairygodfather 1
Owner
null
A Python Module That Uses ANN To Predict A Stocks Price And Also Provides Accurate Technical Analysis With Many High Potential Implementations!

Stox ⚡ A Python Module For The Stock Market ⚡ A Module to predict the "close price" for the next day and give "technical analysis". It uses a Neural N

Dopevog 31 Dec 16, 2022
Repository to access information of stocks in Bombay Stock Exchange.

BSE Repository to access information of stocks in Bombay Stock Exchange. The code in this repository uses BSE API and conclusions made using the code

null 1 Nov 13, 2021
A web app via which users can buy and sell stocks using virtual money

finance Virtual Stock Trader. A web app via which users can buy and sell stocks using virtual money. All stock prices are real and provided by IEX. Fe

Kiron Deb 0 Jan 15, 2022
A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.

Light Gradient Boosting Machine LightGBM is a gradient boosting framework that uses tree based learning algorithms. It is designed to be distributed a

Microsoft 14.5k Jan 8, 2023
Python client and module for BGP Ranking

Python client and module for BGP Ranking THis project will make querying BGP Ranking easier. Installation pip install pybgpranking Usage Command line

D4 project 3 Dec 16, 2021
Discord bot built using Python. through this you can get information about the upcoming matches, scoreboard, live score

IPL-bot This is a Discord bot built using Python. through this you can get information about the upcoming matches, scoreboard, live score, and many mo

null 0 Dec 23, 2021
Python-based Snapchat score booster using pyautogui module

Snapchat Snapscore Botter Python-based Snapchat score booster using pyautogui module. Click here to report bugs. Usage Download ZIP here and extract t

null 477 Dec 31, 2022
Free and Open Source Machine Translation API. 100% self-hosted, no limits, no ties to proprietary services. Built on top of Argos Translate.

LibreTranslate Try it online! | API Docs Free and Open Source Machine Translation API, entirely self-hosted. Unlike other APIs, it doesn't rely on pro

UAV4GEO 3.5k Jan 3, 2023
Mikasa is a 100% Spanish bot, a multifunctional bot, Mikasa is in beta.

Mikasa Miaksa, It is a multi-functional discord bot that is currently in development, this is not complete, there are still many things to fix and imp

Made in 2 Oct 5, 2021
Program that automates the bump of the Disboard Bot. Done 100% in Python with PyAutoGUI library

Auto-Discord-Bump Program that automates the bump of the Disboard Bot done 100% in python with PyAutoGUI How to configue You will need 3 things before

Mateus 1 Dec 19, 2021