Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite while loop #12

Open
DanOKeefe opened this issue Feb 18, 2020 · 2 comments
Open

Infinite while loop #12

DanOKeefe opened this issue Feb 18, 2020 · 2 comments

Comments

@DanOKeefe
Copy link

If the condition in this while loop ever evaluates to True, it will always be True.

current_dt and market_open never change wthin the while loop, which means that since_market_open will never change within the while loop. This means

since_market_open.seconds // 60 <= 14

will never evaluate to False if it is intially True

while since_market_open.seconds // 60 <= 14:
time.sleep(1)
since_market_open = current_dt - market_open

I believe it should be:

while since_market_open.seconds // 60 <= 14:
        time.sleep(1)
        current_dt = datetime.today().astimezone(nyc)
        since_market_open = current_dt - market_open
@nickvertucci
Copy link

nickvertucci commented Jan 29, 2021

Hey Dan,

Found these changes although the code has been updated since.

Were you able to get it working? Mine seems to be just stuck on watching symbols...

@solaress1980
Copy link

I think so too @DanOKeefe. I also think it should wait until market opens to check this 15 minutes elapsed logic so that the program does not run before 9am.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants