Skip to content

Commit

Permalink
[Screenipy Test] New Features Added - Test Passed (#210)
Browse files Browse the repository at this point in the history
* v2.08 - New ML Model (Nifty + Gold + Crude) for Gap Prediction

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: pranjal-joshi <joshi.pranjal5@gmail.com>
  • Loading branch information
github-actions[bot] and pranjal-joshi authored Oct 23, 2023
1 parent ef0e6c2 commit 33eb799
Show file tree
Hide file tree
Showing 10 changed files with 1,233 additions and 1,254 deletions.
5 changes: 4 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.07"
VERSION = "2.08"

changelog = colorText.BOLD + '[ChangeLog]\n' + colorText.END + colorText.BLUE + '''
[1.00 - Beta]
Expand Down Expand Up @@ -242,4 +242,7 @@
1. US S&P 500 Index added - Try Index `15 > US S&P 500`
2. Minor improvemnets
[2.08]
1. Nifty Prediction enhanced - New AI model uses Crude and Gold data for Gap Prediction
''' + colorText.END
15 changes: 15 additions & 0 deletions src/classes/Fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ def fetchLatestNiftyDaily(self, proxyServer=None):
progress=False,
timeout=10
)
gold = yf.download(
tickers="GC=F",
period='5d',
interval='1d',
progress=False,
timeout=10
).add_prefix(prefix='gold_')
crude = yf.download(
tickers="CL=F",
period='5d',
interval='1d',
progress=False,
timeout=10
).add_prefix(prefix='crude_')
data = pd.concat([data, gold, crude], axis=1)
return data

# Get Data for Five EMA strategy
Expand Down
6 changes: 2 additions & 4 deletions src/classes/Screener.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,10 +583,8 @@ def getNiftyPrediction(self, data, proxyServer):
with SuppressOutput(suppress_stderr=True, suppress_stdout=True):
data = data[pkl['columns']]
### v2 Preprocessing
data['High'] = data['High'].pct_change() * 100
data['Low'] = data['Low'].pct_change() * 100
data['Open'] = data['Open'].pct_change() * 100
data['Close'] = data['Close'].pct_change() * 100
for col in pkl['columns']:
data[col] = data[col].pct_change() * 100
data = data.iloc[-1]
###
data = pkl['scaler'].transform([data])
Expand Down
8 changes: 4 additions & 4 deletions src/classes/Utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,10 @@ def getProgressbarStyle():
return bar, spinner

def getNiftyModel(proxyServer=None):
files = ['nifty_model_v2.h5', 'nifty_model_v2.pkl']
files = ['nifty_model_v3.h5', 'nifty_model_v3.pkl']
urls = [
"https://raw.github.com/pranjal-joshi/Screeni-py/new-features/src/ml/nifty_model_v2.h5",
"https://raw.github.com/pranjal-joshi/Screeni-py/new-features/src/ml/nifty_model_v2.pkl"
f"https://raw.github.com/pranjal-joshi/Screeni-py/new-features/src/ml/{files[0]}",
f"https://raw.github.com/pranjal-joshi/Screeni-py/new-features/src/ml/{files[1]}"
]
if os.path.isfile(files[0]) and os.path.isfile(files[1]):
file_age = (time.time() - os.path.getmtime(files[0]))/604800
Expand All @@ -332,7 +332,7 @@ def getNiftyModel(proxyServer=None):
resp = requests.get(file_url, stream=True)
if resp.status_code == 200:
print(colorText.BOLD + colorText.GREEN +
"[+] Downloading AI model (v2) for Nifty predictions, Please Wait.." + colorText.END)
"[+] Downloading AI model (v3) for Nifty predictions, Please Wait.." + colorText.END)
try:
chunksize = 1024*1024*1
filesize = int(int(resp.headers.get('content-length'))/chunksize)
Expand Down
Loading

0 comments on commit 33eb799

Please sign in to comment.