Skip to content

Commit 46249c8

Browse files
committed
- Fixed issue where program stops if you start it before market opens when you have auto stop enabled
1 parent 8be9d5c commit 46249c8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

NSE_Option_Chain_Analyzer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import datetime
44
import os
55
import sys
6+
import time
67
import webbrowser
78
from tkinter import Tk, Toplevel, Event, TclError, StringVar, Frame, Menu, \
89
Label, Entry, SOLID, RIDGE, N, S, E, W, LEFT, messagebox
@@ -1243,7 +1244,9 @@ def main(self) -> None:
12431244
if self.update:
12441245
self.check_for_updates()
12451246
self.first_run = False
1246-
if self.str_current_time == '15:30:00' and not self.stop and self.auto_stop:
1247+
if self.str_current_time == '15:30:00' and not self.stop and self.auto_stop \
1248+
and self.previous_date == datetime.datetime.strptime(time.strftime("%d-%b-%Y", time.localtime()),
1249+
"%d-%b-%Y").date():
12471250
self.stop = True
12481251
self.options.entryconfig(self.options.index(0), label="Start")
12491252
messagebox.showinfo(title="Market Closed", message="Retrieving new data has been stopped.")

0 commit comments

Comments
 (0)