Skip to content

Commit 33eb799

Browse files
[Screenipy Test] New Features Added - Test Passed (#210)
* 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>
1 parent ef0e6c2 commit 33eb799

File tree

10 files changed

+1233
-1254
lines changed

10 files changed

+1233
-1254
lines changed

src/classes/Changelog.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from classes.ColorText import colorText
99

10-
VERSION = "2.07"
10+
VERSION = "2.08"
1111

1212
changelog = colorText.BOLD + '[ChangeLog]\n' + colorText.END + colorText.BLUE + '''
1313
[1.00 - Beta]
@@ -242,4 +242,7 @@
242242
1. US S&P 500 Index added - Try Index `15 > US S&P 500`
243243
2. Minor improvemnets
244244
245+
[2.08]
246+
1. Nifty Prediction enhanced - New AI model uses Crude and Gold data for Gap Prediction
247+
245248
''' + colorText.END

src/classes/Fetcher.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,21 @@ def fetchLatestNiftyDaily(self, proxyServer=None):
159159
progress=False,
160160
timeout=10
161161
)
162+
gold = yf.download(
163+
tickers="GC=F",
164+
period='5d',
165+
interval='1d',
166+
progress=False,
167+
timeout=10
168+
).add_prefix(prefix='gold_')
169+
crude = yf.download(
170+
tickers="CL=F",
171+
period='5d',
172+
interval='1d',
173+
progress=False,
174+
timeout=10
175+
).add_prefix(prefix='crude_')
176+
data = pd.concat([data, gold, crude], axis=1)
162177
return data
163178

164179
# Get Data for Five EMA strategy

src/classes/Screener.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,8 @@ def getNiftyPrediction(self, data, proxyServer):
583583
with SuppressOutput(suppress_stderr=True, suppress_stdout=True):
584584
data = data[pkl['columns']]
585585
### v2 Preprocessing
586-
data['High'] = data['High'].pct_change() * 100
587-
data['Low'] = data['Low'].pct_change() * 100
588-
data['Open'] = data['Open'].pct_change() * 100
589-
data['Close'] = data['Close'].pct_change() * 100
586+
for col in pkl['columns']:
587+
data[col] = data[col].pct_change() * 100
590588
data = data.iloc[-1]
591589
###
592590
data = pkl['scaler'].transform([data])

src/classes/Utility.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,10 @@ def getProgressbarStyle():
309309
return bar, spinner
310310

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

0 commit comments

Comments
 (0)