diff --git a/src/classes/Changelog.py b/src/classes/Changelog.py index f2f9e4bf..4fc00db1 100644 --- a/src/classes/Changelog.py +++ b/src/classes/Changelog.py @@ -7,7 +7,7 @@ from classes.ColorText import colorText -VERSION = "2.17" +VERSION = "2.18" changelog = colorText.BOLD + '[ChangeLog]\n' + colorText.END + colorText.BLUE + ''' [1.00 - Beta] @@ -277,4 +277,8 @@ [2.17] 1. Backtest Report column added for backtest screening runs + +[2.18] +1. Critical backtest bug fixed (dropna axis-1 removed from results) +2. Clear stock cached data button added ''' + colorText.END diff --git a/src/classes/Utility.py b/src/classes/Utility.py index bc3e87cf..0243f82d 100644 --- a/src/classes/Utility.py +++ b/src/classes/Utility.py @@ -388,13 +388,16 @@ def isBacktesting(backtestDate): def calculateBacktestReport(data, backtestDict:dict): try: recent = data.head(1)['Close'].iloc[0] - for key, val in backtestDict.items(): + for key, val in backtestDict.copy().items(): if val is not None: try: backtestDict[key] = str(round((backtestDict[key]-recent)/recent*100,1)) + "%" except TypeError: - backtestDict[key] = None + del backtestDict[key] + # backtestDict[key] = None continue + else: + del backtestDict[key] except: pass return backtestDict diff --git a/src/screenipy.py b/src/screenipy.py index ecbc28c2..61a161b2 100644 --- a/src/screenipy.py +++ b/src/screenipy.py @@ -292,6 +292,7 @@ def main(testing=False, testBuild=False, downloadOnly=False, execute_inputs:list "[+] Press any key to Exit!" + colorText.END) sys.exit(0) + print(tickerOption) if tickerOption == 'W' or tickerOption == 'N' or tickerOption == 'E' or tickerOption == 'S' or (tickerOption >= 0 and tickerOption < 16): configManager.getConfig(ConfigManager.parser) try: @@ -478,8 +479,6 @@ def main(testing=False, testBuild=False, downloadOnly=False, execute_inputs:list matchedSaveResults = pd.concat([matchedSaveResults, saveResults[saveResults['Stock'].str.contains(stk)]], ignore_index=True) screenResults, saveResults = matchedScreenResults, matchedSaveResults - screenResults.dropna(axis=1, how='all', inplace=True) - saveResults.dropna(axis=1, how='all', inplace=True) screenResults.sort_values(by=['Stock'], ascending=True, inplace=True) saveResults.sort_values(by=['Stock'], ascending=True, inplace=True) screenResults.set_index('Stock', inplace=True) diff --git a/src/streamlit_app.py b/src/streamlit_app.py index fc52e52c..d2446889 100644 --- a/src/streamlit_app.py +++ b/src/streamlit_app.py @@ -45,8 +45,15 @@ def check_updates(): def show_df_as_result_table(): try: df:pd.DataFrame = pd.read_pickle('last_screened_unformatted_results.pkl') - ac, bc = st.columns([6,1]) + ac, cc, bc = st.columns([6,1,1]) ac.markdown(f'#### 🔍 Found {len(df)} Results') + clear_cache_btn = cc.button( + label='Clear Cached Data', + use_container_width=True, + ) + if clear_cache_btn: + os.system('rm stock_data_*.pkl') + st.toast('Stock Cache Deleted!', icon='🗑️') bc.download_button( label="Download Results", data=df.to_csv().encode('utf-8'), @@ -101,6 +108,7 @@ def dummy_call(): if Utility.tools.isBacktesting(backtestDate=backtestDate): st.write(f'Running in :red[**Backtesting Mode**] for *T = {str(backtestDate)}* (Y-M-D) : [Backtesting data is subjected to availability as per the API limits]') + st.write('Backtesting is :red[Not Supported] for Intraday timeframes') t = Thread(target=dummy_call) t.start() @@ -177,6 +185,7 @@ def get_extra_inputs(tickerOption, executeOption, c_index=None, c_criteria=None, elif int(tickerOption) == 0 or tickerOption is None: stock_codes:str = c_index.text_input('Enter Stock Code(s)', placeholder='SBIN, INFY, ITC') execute_inputs = [tickerOption, executeOption, stock_codes.upper(), 'N'] + return elif int(executeOption) >= 0 and int(executeOption) < 4: execute_inputs = [tickerOption, executeOption, 'N'] elif int(executeOption) == 4: @@ -272,6 +281,9 @@ def get_extra_inputs(tickerOption, executeOption, c_index=None, c_criteria=None, .stButton>button { height: 70px; } + .stDownloadButton>button { + height: 70px; + } th { text-align: left; } @@ -325,7 +337,7 @@ def get_extra_inputs(tickerOption, executeOption, c_index=None, c_criteria=None, executeOption = str(c_criteria.selectbox('Select Screening Criteria', options=list_criteria).split(' ')[0]) - start_button = c_button_start.button('Start Screening', type='primary', key='start_button') + start_button = c_button_start.button('Start Screening', type='primary', key='start_button', use_container_width=True) get_extra_inputs(tickerOption=tickerOption, executeOption=executeOption, c_index=c_index, c_criteria=c_criteria, start_button=start_button) @@ -495,7 +507,7 @@ def get_extra_inputs(tickerOption, executeOption, c_index=None, c_criteria=None, - Released in Development mode. This tool should be used only for analysis/study purposes. We do NOT provide any Buy/Sell advice for any Securities. Authors of this tool will not be held liable for any losses. Understand the Risks subjected with Markets before Investing. + This tool should be used only for Analysis/Study purposes. We do NOT provide any Buy/Sell advice for any Securities. Authors of this tool will not be held liable for any losses. Understand the Risks subjected with Markets before Investing. '''