Z
zydjohn
Guest
Hello:
I need a function to tell me at now (DateTime.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 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.
Market C runs in 4 time slots: first time slot, from 9:00AM to 10:15AM; the second time slot, from 10:30AM to 13:00PM; the third time slot from 12:00PM to 13:00PM; the last time slot from 14:00PM to 15:00PM.
I can do this in imperative way, but not easy to figure out how to do this in functional way.
By the way, I also want to have some kind of improvement: in stead of checking every second or every minute if the current time (DateTime.Now), one market is open or not, I want to set up some kind of timer, so my program will check only when the timer events happen.
For example: if the current time now is: 9:30AM, then all the 3 markets are open, so the next time, my program to check will be at least 10:15AM, when market C will close. So my program will not check for 45 minutes starting from 9:30AM, or my program will not check fro 75 minutes starting from 9:00AM.
However, I can’t figure out a good way to do so.
Please advice.
Thanks,
Continue reading...
I need a function to tell me at now (DateTime.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 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.
Market C runs in 4 time slots: first time slot, from 9:00AM to 10:15AM; the second time slot, from 10:30AM to 13:00PM; the third time slot from 12:00PM to 13:00PM; the last time slot from 14:00PM to 15:00PM.
I can do this in imperative way, but not easy to figure out how to do this in functional way.
By the way, I also want to have some kind of improvement: in stead of checking every second or every minute if the current time (DateTime.Now), one market is open or not, I want to set up some kind of timer, so my program will check only when the timer events happen.
For example: if the current time now is: 9:30AM, then all the 3 markets are open, so the next time, my program to check will be at least 10:15AM, when market C will close. So my program will not check for 45 minutes starting from 9:30AM, or my program will not check fro 75 minutes starting from 9:00AM.
However, I can’t figure out a good way to do so.
Please advice.
Thanks,
Continue reading...