Announcement

Collapse
No announcement yet.

Import: Y-Groups - Time Zone Offset for NY

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Import: Y-Groups - Time Zone Offset for NY

    -----Original Message-----
    From: Katrina
    Sent: Wednesday, March 05, 2003 10:58 PM
    To: [email protected]
    Cc: [email protected]
    Subject: [eSignal] Re: Time Zone Offset for NY


    For those interested,

    I wrote a little routine which tells us how far offset NY is from UTC, and it allows for DST. Using this routine, you can check to see if the NY markets are open no matter where in the world you live or what time zone you are in. I enclose it in case it might be of use to others. I know I would like to see it as a standard function in eSignal.

    Example use for an auto-trade system:
    PHP Code:
    var vToday = new Date();
    var 
    vOffset getNYOffset();
    var 
    vHours vToday.getUTCHours();
    var 
    vMinutes vToday.getUTCMinutes();
    var 
    vNYTime = ((vHours*60)+vMinutes)-vOffset;

    // Check to see if it's between 9:30am and 4:00pm in NY
    if(vNYTime >= 570 && vNYTime <= 960)
    {
        
    // Insert trade code here

    The above is just a demonstration of how it might be used. Obviously, it's mostly useful for checking if the market is open. Anyone who lives in an area where the Daylight Savings Time is not co-ordinated with NY is going to need a routine like this if they are writing auto-trade systems.

    I'm pretty sure the getNYOffset() function is bug free, and I tested it against a number of key dates to make sure it works properly. But use it at your own risk. I know it will get confused for a few hours when the DST switches over at 2am in the morning, but that does not concern me as I have no intention of trading during those few hours and it will have corrected itself by 5am.

    Cheers,
    Katrina.
    Regards,
    Jay F.
    Product Manager
    _____________________________________
    Have a suggestion to improve our products?
    Click Support --> Request a Feature in eSignal 11

  • #2
    Here's the attachment.
    Attached Files
    Regards,
    Jay F.
    Product Manager
    _____________________________________
    Have a suggestion to improve our products?
    Click Support --> Request a Feature in eSignal 11

    Comment

    Working...
    X