diff --git a/.github/workflows/workflow-test.yml b/.github/workflows/workflow-test.yml index e09ecd6..62ca7f4 100644 --- a/.github/workflows/workflow-test.yml +++ b/.github/workflows/workflow-test.yml @@ -22,10 +22,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python 3.10.6 - uses: actions/setup-python@v2 + - name: Set up Python 3.11.6 + uses: actions/setup-python@v4 with: - python-version: 3.10.6 + python-version: 3.11.6 - name: Restore Dependencies from Cache uses: actions/cache@v2 diff --git a/Dockerfile b/Dockerfile index 1ea6c3a..eed1d3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,8 @@ # FROM ubuntu:latest as base # FROM tensorflow/tensorflow:2.9.2 as base -FROM python:3.10.6-slim as base +# FROM python:3.10.6-slim as base +FROM python:3.11.6-slim-bookworm as base ARG DEBIAN_FRONTEND=noninteractive diff --git a/requirements.txt b/requirements.txt index eacd3db..2def55c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ pep517 pip pip-chill progress -pyinstaller==5.6.2 +# pyinstaller==5.6.2 pytest-mock pytoml retrying diff --git a/src/classes/Changelog.py b/src/classes/Changelog.py index 0d30e0d..0ca54b8 100644 --- a/src/classes/Changelog.py +++ b/src/classes/Changelog.py @@ -7,7 +7,7 @@ from classes.ColorText import colorText -VERSION = "2.11" +VERSION = "2.12" changelog = colorText.BOLD + '[ChangeLog]\n' + colorText.END + colorText.BLUE + ''' [1.00 - Beta] @@ -256,5 +256,9 @@ [2.11] 1. Nifty Prediction issue fixed - Model is now trained on CPU instead of Apple-M1 GPU +[2.12] +1. Cosmetic Updates for Position Size Calculator +2. Python base bumped to 3.11.6-slim-bookworm + ''' + colorText.END diff --git a/src/screenipy.py b/src/screenipy.py index 5bf0f51..07ea0c0 100644 --- a/src/screenipy.py +++ b/src/screenipy.py @@ -300,6 +300,15 @@ def main(testing=False, testBuild=False, downloadOnly=False, execute_inputs:list sys.exit(0) elif tickerOption == 'N': os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' + import tensorflow as tf + physical_devices = tf.config.list_physical_devices('GPU') + try: + tf.config.set_visible_devices([], 'GPU') + visible_devices = tf.config.get_visible_devices() + for device in visible_devices: + assert device.device_type != 'GPU' + except: + pass prediction = screener.getNiftyPrediction( data=fetcher.fetchLatestNiftyDaily(proxyServer=proxyServer), proxyServer=proxyServer diff --git a/src/streamlit_app.py b/src/streamlit_app.py index 236f4db..824ef67 100644 --- a/src/streamlit_app.py +++ b/src/streamlit_app.py @@ -10,6 +10,7 @@ from pathlib import Path from threading import Thread from time import sleep +from math import floor import classes.ConfigManager as ConfigManager st.set_page_config(layout="wide", page_title="Screeni-py", page_icon="📈") @@ -517,11 +518,12 @@ def get_extra_inputs(tickerOption, executeOption, c_index=None, c_criteria=None, if calculate_qty_btn: if sl > 0: - qty = round(risk_rs / sl) - oc.info(body=f'**Order Qty should be {qty}**', icon='✅') + qty = floor(risk_rs / sl) + oc.metric(label='Quantity', value=qty, delta=f'Max Loss: {(-1 * qty * sl)}', delta_color='inverse', help='Trade this Quantity to prevent excessive unplanned losses') elif price > 0 and percentage_sl > 0: - qty = round(risk_rs / actual_sl) - oc.info(body=f'**Order Qty should be {qty}**', icon='✅') + qty = floor(risk_rs / actual_sl) + oc.metric(label='Quantity', value=qty, delta=f'Max Loss: {(-1 * qty * actual_sl)}', delta_color='inverse', help='Trade this Quantity to prevent excessive unplanned losses') + marquee_html = '''