diff --git a/src/classes/Changelog.py b/src/classes/Changelog.py index e9e71849..662ee156 100644 --- a/src/classes/Changelog.py +++ b/src/classes/Changelog.py @@ -7,7 +7,7 @@ from classes.ColorText import colorText -VERSION = "1.24" +VERSION = "1.25" changelog = colorText.BOLD + '[ChangeLog]\n' + colorText.END + colorText.BLUE + ''' [1.00 - Beta] @@ -119,5 +119,10 @@ 3. Permission bug-fixes for some windows users. 4. Result table optimized. +[1.25] +1. Default configuration parameters optimized. +2. Configuration generation on first time usage don't need restart anymore! +3. Minor bug-fixes. + --- END --- ''' + colorText.END diff --git a/src/classes/ConfigManager.py b/src/classes/ConfigManager.py index fbca8348..55ec8c07 100644 --- a/src/classes/ConfigManager.py +++ b/src/classes/ConfigManager.py @@ -24,13 +24,13 @@ def __init__(self): self.volumeRatio = 2 self.minLTP = 20.0 self.maxLTP = 50000 - self.period = '365d' + self.period = '300d' self.duration = '1d' self.daysToLookback = 30 - self.shuffleEnabled = False - self.cacheEnabled = False + self.shuffleEnabled = True + self.cacheEnabled = True self.stageTwo = False - self.useEMA = True + self.useEMA = False def deleteStockData(self,excludeFile=None): for f in glob.glob('stock_data*.pkl'): @@ -42,7 +42,7 @@ def deleteStockData(self,excludeFile=None): # Handle user input and save config - def setConfig(self, parser, default=False): + def setConfig(self, parser, default=False, showFileCreatedText=True): if default: parser.add_section('config') parser.set('config', 'period', self.period) @@ -56,19 +56,20 @@ def setConfig(self, parser, default=False): parser.set('config', 'shuffle', 'y') parser.set('config', 'cacheStockData', 'y') parser.set('config', 'onlyStageTwoStocks', 'y') - parser.set('config', 'useEMA', 'y') + parser.set('config', 'useEMA', 'n') try: fp = open('screenipy.ini', 'w') parser.write(fp) fp.close() - print(colorText.BOLD + colorText.GREEN + - '[+] Default configuration generated as user configuration is not found!' + colorText.END) - print(colorText.BOLD + colorText.GREEN + - '[+] Use Option > 5 to edit in future.' + colorText.END) - print(colorText.BOLD + colorText.GREEN + - '[+] Close and Restart the program now.' + colorText.END) - input('') - sys.exit(0) + if showFileCreatedText: + print(colorText.BOLD + colorText.GREEN + + '[+] Default configuration generated as user configuration is not found!' + colorText.END) + print(colorText.BOLD + colorText.GREEN + + '[+] Use Option > 5 to edit in future.' + colorText.END) + print(colorText.BOLD + colorText.GREEN + + '[+] Close and Restart the program now.' + colorText.END) + input('') + sys.exit(0) except IOError: print(colorText.BOLD + colorText.FAIL + '[+] Failed to save user config. Exiting..' + colorText.END) @@ -179,3 +180,12 @@ def showConfigFile(self): print(colorText.BOLD + colorText.WARN + "[+] Configure the limits to continue." + colorText.END) self.setConfig(parser) + + # Check if config file exists + def checkConfigFile(self): + try: + f = open('screenipy.ini','r') + f.close() + return True + except FileNotFoundError: + return False diff --git a/src/release.md b/src/release.md index 977357a0..fbafcbe7 100644 --- a/src/release.md +++ b/src/release.md @@ -7,9 +7,9 @@ 5. Bug-fixes & Performance upgrades for MultiCore CPUs. :gear: ## Downloads -* For :desktop_computer: **Windows** users, download **[screenipy.exe](https://github.com/pranjal-joshi/Screeni-py/releases/download/1.24/screenipy.exe)** -* For :penguin: **Linux** users, download **[screenipy.bin](https://github.com/pranjal-joshi/Screeni-py/releases/download/1.24/screenipy.bin)** -* For :apple: **MacOS** users, download **[screenipy.run](https://github.com/pranjal-joshi/Screeni-py/releases/download/1.24/screenipy.run)** ([Read Installation Guide](https://github.com/pranjal-joshi/Screeni-py/blob/main/INSTALLATION.md#for-macos)) +* For :desktop_computer: **Windows** users, download **[screenipy.exe](https://github.com/pranjal-joshi/Screeni-py/releases/download/1.25/screenipy.exe)** +* For :penguin: **Linux** users, download **[screenipy.bin](https://github.com/pranjal-joshi/Screeni-py/releases/download/1.25/screenipy.bin)** +* For :apple: **MacOS** users, download **[screenipy.run](https://github.com/pranjal-joshi/Screeni-py/releases/download/1.25/screenipy.run)** ([Read Installation Guide](https://github.com/pranjal-joshi/Screeni-py/blob/main/INSTALLATION.md#for-macos)) ## How to use? diff --git a/src/screenipy.py b/src/screenipy.py index e25fdd58..0156b7e8 100644 --- a/src/screenipy.py +++ b/src/screenipy.py @@ -345,6 +345,8 @@ def main(testing=False): if __name__ == "__main__": Utility.tools.clearScreen() isDevVersion = OTAUpdater.checkForUpdate(proxyServer, VERSION) + if not configManager.checkConfigFile(): + configManager.setConfig(ConfigManager.parser, default=True, showFileCreatedText=False) try: while True: main()