Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Not Planned Cron Job to Open/Close Stock Market

Discussion in 'Stock Trader Closed Suggestions' started by teflondon, Jan 23, 2014.

  1. teflondon

    teflondon New Member Sportsbook

    Would be great if you could set markets to open and close by themselves. Not sure how difficult it would be to work around holidays or DST but in general this would be appreciated!
  2. Bob

    Bob Developer Staff Member

    In Theory (me thinking outloud) .....

    It would require a table that would have a row for each market with a field for, Market Name, Open Time, Close Time, Status ('open', 'closed'), Manual Override (at the minimum). Then an admin interface so that you can set open and close times for each market as well as manually override cron changing status (simple on/off for that). Then a CRON that would run every hour (or change the check interval to 15 minutes if you want) and would Close any markets that need to be closed, Open any that need to be opened while ignoring any that have been marked as manual override.
    teflondon likes this.
  3. Bob

    Bob Developer Staff Member

    Another way to do it would be to not even bother with CRON and just set Open and Close Times for each Market with a Time Zone field (like I do for Sportsbook and Pickem) so that it properly takes everyone's timezones into consideration. ie.. Set New York Exchange to Open at 10AM Eastern and Close at 4:25 PM Eastern. Then no matter where you are in the world, the only time you could purchase stocks from that exchange would be between 10am-4:25pm EASTERN time (converting your viewing timezone).

    I think THIS would be better than cron (way more efficient). For Holidays, you'd just manually close the particular exchange.
    teflondon likes this.
  4. teflondon

    teflondon New Member Sportsbook

    Yeah that sounds much better than a cron. I'm not really a fan of crons anyways!
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.