Skip to content

Commit

Permalink
v2.03 - AI-based Nifty Prediction & AI-based Similar Stock Search add…
Browse files Browse the repository at this point in the history
…ed to GUI

v2.03 - AI-based Nifty Prediction & AI-based Similar Stock Search added to GUI
- Nifty-50 Gap up/down prediction added
- cosmetic updates for GUI
- version bumped
- tab added for similar stock search
- chromadb similar search in progress
- pyinstaller build and requirements updated
- fixed similar search in CLI mode
- similar search added to GUI
- Update requirements.txt - chromadb added to top
- try catch added for importing chromadb to resolve pytest errors
- Deprecated Executables: OTA, Tests and Docs modified
  • Loading branch information
github-actions[bot] authored and pranjal-joshi committed Oct 3, 2023
1 parent 71a5c2c commit c7a9542
Show file tree
Hide file tree
Showing 13 changed files with 286 additions and 99 deletions.
Binary file added .github/dependencies/sqlite3.dll
Binary file not shown.
79 changes: 38 additions & 41 deletions .github/workflows/workflow-build-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

# Job for builing packages
Build-Executables:
name: Build Packages
name: Build Packages (Disabled onwards v2.03)
#needs: Create-Release
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -24,7 +24,7 @@ jobs:
- os: windows-latest
TARGET: Windows
CMD_BUILD: |
pyinstaller --onefile --icon=src\icon.ico src\screenipy.py --hidden-import cmath --hidden-import talib.stream --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress
pyinstaller --onefile --icon=src\icon.ico src\screenipy.py --hidden-import cmath --hidden-import talib.stream --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress --hidden-import chromadb
DEP_BUILD: |
python -m pip install --upgrade pip
echo Installing TA-lib...
Expand All @@ -44,7 +44,7 @@ jobs:
- os: ubuntu-20.04
TARGET: Linux
CMD_BUILD: |
pyinstaller --onefile --icon=src/icon.ico src/screenipy.py --hidden-import cmath --hidden-import talib.stream --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress
pyinstaller --onefile --icon=src/icon.ico src/screenipy.py --hidden-import cmath --hidden-import talib.stream --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress --hidden-import chromadb
mv /home/runner/work/Screeni-py/Screeni-py/dist/screenipy /home/runner/work/Screeni-py/Screeni-py/dist/screenipy.bin
chmod +x /home/runner/work/Screeni-py/Screeni-py/dist/screenipy.bin
DEP_BUILD: |
Expand All @@ -68,7 +68,7 @@ jobs:
- os: macos-latest
TARGET: MacOS
CMD_BUILD: |
pyinstaller --onefile --windowed --icon=src/icon.ico src/screenipy.py --hidden-import cmath --hidden-import talib.stream --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress
pyinstaller --onefile --windowed --icon=src/icon.ico src/screenipy.py --hidden-import cmath --hidden-import talib.stream --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress --hidden-import chromadb
mv /Users/runner/work/Screeni-py/Screeni-py/dist/screenipy /Users/runner/work/Screeni-py/Screeni-py/dist/screenipy.run
DEP_BUILD: |
brew install ta-lib
Expand All @@ -89,38 +89,38 @@ jobs:
shell: bash
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: Set up Python 3.9.4
uses: actions/setup-python@v2
with:
python-version: 3.9.4

- name: Load Cache for Linux Dependencies
uses: actions/cache@v2
if: startsWith(runner.os, 'Linux')
with:
path: |
/usr/include/ta-lib
/usr/bin/ta-lib-config
key: ${{ runner.os }}-talib
restore-keys: |
${{ runner.os }}-talib
- name: Install dependencies for ${{ matrix.TARGET }}
run: ${{ matrix.DEP_BUILD }}

- name: Build for ${{ matrix.TARGET }}
run: ${{ matrix.CMD_BUILD }}

- name: Test Built Binary for ${{ matrix.TARGET }}
shell: bash
run: ${{ matrix.TEST_BUILD }}
continue-on-error: false

- name: Save Binaries as Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.FILE_NAME }}
path: ${{ matrix.OUT_PATH }}
# - name: Set up Python 3.9.4
# uses: actions/setup-python@v2
# with:
# python-version: 3.9.4

# - name: Load Cache for Linux Dependencies
# uses: actions/cache@v2
# if: startsWith(runner.os, 'Linux')
# with:
# path: |
# /usr/include/ta-lib
# /usr/bin/ta-lib-config
# key: ${{ runner.os }}-talib
# restore-keys: |
# ${{ runner.os }}-talib

# - name: Install dependencies for ${{ matrix.TARGET }}
# run: ${{ matrix.DEP_BUILD }}

# - name: Build for ${{ matrix.TARGET }}
# run: ${{ matrix.CMD_BUILD }}

# - name: Test Built Binary for ${{ matrix.TARGET }}
# shell: bash
# run: ${{ matrix.TEST_BUILD }}
# continue-on-error: false

# - name: Save Binaries as Artifacts
# uses: actions/upload-artifact@v2
# with:
# name: ${{ matrix.FILE_NAME }}
# path: ${{ matrix.OUT_PATH }}

- name: Read release.md
id: read_release
Expand All @@ -136,8 +136,8 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.OUT_PATH }}
asset_name: ${{ matrix.FILE_NAME }}
file: README.md
asset_name: README.md
tag: ${{ github.ref }}
release_name: Screenipy - v${{ steps.get_version.outputs.VERSION }}
body: |
Expand Down Expand Up @@ -170,8 +170,6 @@ jobs:
run: |
VER=$(grep 'VERSION = ' src/classes/Changelog.py | awk -F'"' '{print $2}')
echo "VERSION=$VER" >> $GITHUB_ENV
# echo "ver=$(grep 'VERSION = ' src/classes/Changelog.py | awk -F'"' '{print $2}')" >> $GITHUB_OUTPUT
echo $VER
- name: Streamlit Build and Push
uses: docker/build-push-action@v4
Expand All @@ -180,5 +178,4 @@ jobs:
platforms: linux/amd64, linux/arm64
push: true
tags: joshipranjal/screeni-py:latest, joshipranjal/screeni-py:${{ env.VERSION }}
# tags: joshipranjal/screeni-py:latest, joshipranjal/screeni-py:${{ steps.version.outputs.ver }}

46 changes: 30 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| **Download** | **Use** | **Discussion** | **Bugs/Issues** | **Documentation** |
| :---: | :---: | :---: | :---: | :---: |
| [![cloud-computing (1)](https://user-images.githubusercontent.com/6128978/149935359-ca0a7155-d1e3-4e47-98e8-67f879e707e7.png)](https://github.com/pranjal-joshi/Screeni-py/releases/latest) | [![docker](https://github.com/pranjal-joshi/Screeni-py/assets/6128978/f44054b8-9fcb-465c-a38b-63f6ecc4a0c9)](https://hub.docker.com/r/joshipranjal/screeni-py/tags) | [![meeting](https://user-images.githubusercontent.com/6128978/149935812-31266023-cc5b-4c98-a416-1d4cf8800c0c.png)](https://github.com/pranjal-joshi/Screeni-py/discussions) | [![warning](https://user-images.githubusercontent.com/6128978/149936142-04d7cf1c-5bc5-45c1-a8e4-015454a2de48.png)](https://github.com/pranjal-joshi/Screeni-py/issues?q=is%3Aissue) | [![help](https://user-images.githubusercontent.com/6128978/149937331-5ee5c00a-748d-4fbf-a9f9-e2273480d8a2.png)](https://github.com/pranjal-joshi/Screeni-py/blob/main/README.md#what-is-screeni-py) |
| Download the Latest Version | Get started quickly using Docker | Join/Read the Community Discussion | Raise an Issue about a Problem | Get Help about Usage |
| Download the Latest Version (DEPRECATED) | Get started quickly using Docker | Join/Read the Community Discussion | Raise an Issue about a Problem | Get Help about Usage |

<!-- ## [**Click to Download the Latest Version**](https://github.com/pranjal-joshi/Screeni-py/releases/latest) -->

Expand All @@ -19,13 +19,24 @@

### A Python-based stock screener for NSE, India.

**Screenipy** is an advanced stock screener to find potential breakout stocks from NSE and tell it's possible breakout values. It also helps to find the stocks which are consolidating and may breakout, or the particular chart patterns that you're looking specifically to make your decisions.
**Screenipy** is an advanced stock screener to find potential breakout stocks from NSE and tell its possible breakout values. It also helps to find the stocks that are consolidating and may breakout, or the particular chart patterns that you're looking for specifically to make your decisions.
Screenipy is totally customizable and it can screen stocks with the settings that you have provided.

## How to use?
## How to use? (New Version - GUI Based)
* Install Docker Desktop and pull the `latest` docker image from the [release](https://github.com/pranjal-joshi/Screeni-py/releases/latest) page.
* Checkout this [YouTube Video](https://youtu.be/2HMN0ac4H20) for detailed installation guide.

<img width="1438" alt="image" src="https://github.com/pranjal-joshi/Screeni-py/assets/6128978/2016be00-5892-4735-8ab3-5f5b70add103">
<img width="1438" alt="image" src="https://github.com/pranjal-joshi/Screeni-py/assets/6128978/28947290-7f42-4f6f-9fc0-0bae1ee6d6f4">
<img width="1438" alt="image" src="https://github.com/pranjal-joshi/Screeni-py/assets/6128978/857f8acc-a4e8-4b86-a748-c26057b0e8b1">
<img width="1438" alt="image" src="https://github.com/pranjal-joshi/Screeni-py/assets/6128978/360b5faa-f4f4-4df6-bec1-90985889bee6">
<img width="1438" alt="image" src="https://github.com/pranjal-joshi/Screeni-py/assets/6128978/99903d67-d450-4c04-93ae-1f5bb4b905a5">


## How to use? (Older Version - CLI Based - DEPRECATED)
* Download the suitable file according to your OS or install Docker Desktop and pull the `latest` docker image.
* Linux & Mac users should make sure that the `screenipy.bin or screenipy.run` is having `execute` permission.
* **Run** the file. Following window will appear after a brief delay.
* Linux & Mac users should make sure that the `screenipy.bin or screenipy.run` has `execute` permission.
* **Run** the file. The following window will appear after a brief delay.

![home](https://raw.githubusercontent.com/pranjal-joshi/Screeni-py/new-features/screenshots/screenipy_demo.gif)

Expand All @@ -39,7 +50,7 @@ Screenipy is totally customizable and it can screen stocks with the settings tha
![results](https://raw.githubusercontent.com/pranjal-joshi/Screeni-py/new-features/screenshots/results.png)
![done](https://raw.githubusercontent.com/pranjal-joshi/Screeni-py/new-features/screenshots/done.png)

* Once done, you can also save the results in an excel file.
* Once done, you can also save the results in an Excel file.

## Understanding the Result Table:

Expand All @@ -49,12 +60,12 @@ The Result table contains a lot of different parameters which can be pretty over
|:---:|:---:|:---|:---|
|1|**Stock**|This is a NSE scrip symbol. If your OS/Terminal supports unicode, You can directly open **[TradingView](https://in.tradingview.com/)** charts by pressing `Ctrl+Click` on the stock name.|[TATAMOTORS](https://in.tradingview.com/chart?symbol=NSE%3ATATAMOTORS)|
|2|**Consolidating**|It gives the price range in which stock is trading since last `N` days. `N` is configurable and can be modified by executing `Edit User Configuration` option.|If stock is trading between price 100-120 in last 30 days, Output will be `Range = 20.0 %`|
|3|**Breakout (N Days)**|This is pure magic! The `BO` is Breakout level in last N days while `R` is the next resistance level if available. Investor should consider both BO & R level to decide entry/exits in their trades.|`B:302, R:313`(Breakout level is 100 & Next resistance is 102)|
|3|**Breakout (N Days)**|This is pure magic! The `BO` is Breakout level in last N days while `R` is the next resistance level if available. An investor should consider both BO & R level to decide entry/exits in their trades.|`B:302, R:313`(Breakout level is 100 & Next resistance is 102)|
|4|**LTP**|LTP is the Last Traded Price of an asset traded on NSE.|`298.7` (Stock is trading at this price)|
|5|**Volume**|Volume shows the relative volume of the recent candle with respect to 20 period MA of Volume. It could be `Unknown` for newly listed stocks.|if 20MA(Volume) is 1M and todays Volume is 2.8M, then `Volume = 2.8x`|
|6|**MA-Signal**|It describes the price trend of an asset by analysing various 50-200 MA/EMA crossover strategies.|`200MA-Support`,`BullCross-50MA` etc|
|7|**RSI**|For the momentum traders, it describes 14-period RSI for quick decision making about their trading plans|`0 to 100`|
|8|**Trend**|By using advance algorithms, the average trendlines are computed for `N` days and their strenght is displayed depending on steepness of trendlines. (This does NOT show any trendline on chart, it is calculated internally)|`Strong Up`, `Weak Down` etc.|
|6|**MA-Signal**|It describes the price trend of an asset by analyzing various 50-200 MA/EMA crossover strategies.|`200MA-Support`,`BullCross-50MA` etc|
|7|**RSI**|For the momentum traders, it describes 14-period RSI for quick decision-making about their trading plans|`0 to 100`|
|8|**Trend**|By using advanced algorithms, the average trendlines are computed for `N` days and their strength is displayed depending on the steepness of the trendlines. (This does NOT show any trendline on a chart, it is calculated internally)|`Strong Up`, `Weak Down` etc.|
|9|**Pattern**|If the chart or the candle itself forming any important pattern in the recent timeframe or as per the selected screening option, various important patterns will be indicated here.|`Momentum Gainer`, `Inside Bar (N)`,`Bullish Engulfing` etc.|

## Hack it your way:
Expand All @@ -73,7 +84,7 @@ cachestockdata = y
onlystagetwostocks = y
useema = n
```
Try to tweak this parameters as per your trading styles. For example, If you're comfortable with weekly charts, make `duration=5d` and so on.
Try to tweak these parameters as per your trading styles. For example, If you're comfortable with weekly charts, make `duration=5d` and so on.

## Installation Guide:

Expand All @@ -86,7 +97,7 @@ Try to tweak this parameters as per your trading styles. For example, If you're

![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white) ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) ![Mac OS](https://img.shields.io/badge/mac%20os-D3D3D3?style=for-the-badge&logo=apple&logoColor=000000) ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white)

**Should I download the Exe/Bin file? Or Should I use Docker?**
**Why we shifted to Docker from the Good old EXEs?**

| Executable/Binary File | Docker |
| :-- | :-- |
Expand All @@ -101,12 +112,13 @@ Try to tweak this parameters as per your trading styles. For example, If you're
| Antivirus may block this as untrusted file ⚠️ | No issues with Antivirus |
| Need to download new file for every update | Updates quickly with minimal downloading |
| No need of commands/technical knowledge | Very basic command execution skills may be required |
| Custom configuration works and persisted accross the runs/restarts | Config file resets at every run but your custom config can be uploaded in GUI mode |
| Custom configuration works and persists accross the runs/restarts | Config file resets at every run but your custom config can be uploaded in GUI mode |
| Incompatible with Vector Database ⚠️ | Compatible with all Python libraries |

### How to setup and use Screeni-py with Docker?
### How to set up and use Screeni-py with Docker?

1. Download and Install [Docker Desktop](https://www.docker.com/products/docker-desktop/) with default settings
2. If you are using windows, update WSL (Windows subsystem for linux) by running `wsl --update` command in command prompt
2. If you are using Windows, update WSL (Windows subsystem for linux) by running `wsl --update` command in the command prompt
3. Restart your computer after installation
4. Open Docker Desktop and keep it as it is
5. Open Command Prompt (Windows) or Terminal (Mac/Linux) and run command `docker pull joshipranjal/screeni-py:latest`
Expand All @@ -119,8 +131,10 @@ Try to tweak this parameters as per your trading styles. For example, If you're
docker run -it --entrypoint /bin/bash joshipranjal/screeni-py:latest -c "run_screenipy.sh --cli"
```
Check out this [YouTube Video](https://youtu.be/2HMN0ac4H20) for a detailed installation guide.
## Contributing:
* Please feel free to Suggest improvements bugs by creating an issue.
* Please feel free to Suggest improvements/report bugs by creating an issue.
* Please follow the [Guidelines for Contributing](https://github.com/pranjal-joshi/Screeni-py/blob/new-features/CONTRIBUTING.md) while making a Pull Request.
## Disclaimer:
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pyinstaller==5.6.2
pytest-mock
pytoml
retrying
scipy==1.7.3
scipy==1.11.2
ta-lib
tabulate
yfinance==0.1.87
Expand Down Expand Up @@ -61,4 +61,5 @@ pandas_ta
# protobuf==3.19.6
protobuf
streamlit==1.26.0
tensorflow
tensorflow
chromadb==0.4.10
6 changes: 5 additions & 1 deletion src/classes/Changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from classes.ColorText import colorText

VERSION = "2.02"
VERSION = "2.03"

changelog = colorText.BOLD + '[ChangeLog]\n' + colorText.END + colorText.BLUE + '''
[1.00 - Beta]
Expand Down Expand Up @@ -216,4 +216,8 @@
3. Cosmetic improvements
4. YouTube Video added to docs
[2.03]
1. AI based Nifty-50 Gap up/down prediction added to GUI
2. Cosmetic updates and minor bug-fixes.
''' + colorText.END
8 changes: 7 additions & 1 deletion src/classes/OtaUpdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def showWhatsNew():
md = requests.get(url)
txt = md.text
txt = txt.split("New?")[1]
txt = txt.split("## Downloads")[0]
# txt = txt.split("## Downloads")[0]
txt = txt.split("## Installation Guide")[0]
txt = txt.replace('**','').replace('`','').strip()
return (txt+"\n")

Expand All @@ -100,6 +101,8 @@ def checkForUpdate(proxyServer, VERSION="1.0"):
resp = requests.get("https://api.github.com/repos/pranjal-joshi/Screeni-py/releases/latest",proxies={'https':proxyServer})
else:
resp = requests.get("https://api.github.com/repos/pranjal-joshi/Screeni-py/releases/latest")
# Disabling Exe check as Executables are deprecated v2.03 onwards
'''
if 'Windows' in platform.system():
OTAUpdater.checkForUpdate.url = resp.json()['assets'][1]['browser_download_url']
size = int(resp.json()['assets'][1]['size']/(1024*1024))
Expand All @@ -124,6 +127,9 @@ def checkForUpdate(proxyServer, VERSION="1.0"):
except Exception as e:
print(colorText.BOLD + colorText.WARN + '[+] Error occured while updating!' + colorText.END)
raise(e)
'''
if(float(resp.json()['tag_name']) > now and not isDocker()):
print(colorText.BOLD + colorText.FAIL + "[+] Executables are now DEPRECATED!\nFollow instructions given at https://github.com/pranjal-joshi/Screeni-py to switch to Docker.\n" + colorText.END)
elif(float(resp.json()['tag_name']) > now and isDocker()): # OTA not applicable if we're running in docker!
print(colorText.BOLD + colorText.FAIL + ('\n[+] New Software update (v%s) available.\n[+] Run `docker pull joshipranjal/screeni-py:latest` to update your docker to the latest version!\n' % (str(resp.json()['tag_name']))) + colorText.END)
print(colorText.BOLD + colorText.WARN + "[+] What's New in this Update?\n" + OTAUpdater.showWhatsNew() + colorText.END)
Expand Down
Loading

0 comments on commit c7a9542

Please sign in to comment.