Dec-11-2017, 10:15 PM
Hello:
I need a function to tell me at now, if a specific market is open, if open return True, if not, return False.
There are 3 different markets, market A runs in 2 time slots: first time slot, from 9:00AM to 11:00AM; the second time slot, from 13:00PM to 15:00PM.
market B runs in 2 time slots: first time slot, from 9:00AM to 11:00AM; the second time slot, from 13:00PM to 15:15PM.
market C runs in 3 time slots: first time slot, from 9:00AM to 10:30AM; the second time slot, from 11:00AM to 13:00PM; the third time slot from 14:00PM to 15:00PM.
I need to check this almost every second during the market hours, and after the last market closes, the program can exit.
Note: I am thinking about compare the now and midnight of today to get the difference in seconds, and compare the number of seconds, if the seconds are in specific range, then the market is open, otherwise, it is closed.
However, I can't figure out how to find the seconds between now and the midnight of today.
Any advices are appreciated.
Thanks,
I need a function to tell me at now, if a specific market is open, if open return True, if not, return False.
There are 3 different markets, market A runs in 2 time slots: first time slot, from 9:00AM to 11:00AM; the second time slot, from 13:00PM to 15:00PM.
market B runs in 2 time slots: first time slot, from 9:00AM to 11:00AM; the second time slot, from 13:00PM to 15:15PM.
market C runs in 3 time slots: first time slot, from 9:00AM to 10:30AM; the second time slot, from 11:00AM to 13:00PM; the third time slot from 14:00PM to 15:00PM.
I need to check this almost every second during the market hours, and after the last market closes, the program can exit.
Note: I am thinking about compare the now and midnight of today to get the difference in seconds, and compare the number of seconds, if the seconds are in specific range, then the market is open, otherwise, it is closed.
However, I can't figure out how to find the seconds between now and the midnight of today.
Any advices are appreciated.
Thanks,