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

Various issues regarding timezones #16

Open
Froren opened this issue Sep 8, 2020 · 0 comments
Open

Various issues regarding timezones #16

Froren opened this issue Sep 8, 2020 · 0 comments

Comments

@Froren
Copy link

Froren commented Sep 8, 2020

Hey there, thanks for your work in setting up this project. I've been eager to use it in some of my projects.

I had a few questions surrounding the usage of the tradingSession functions. I've been using the new_york calendar exclusively for these examples.

The tradingSession and tradingSessions calls seem to return incorrect results when called with a specific moment.

console.log(calendar.tradingSessions(moment("2020-09-01T16:30:00.000Z")));
console.log(calendar.tradingSessions(moment("Tue, 01 Sep 2020 9:30:00 PDT")));

both yield moments where the start is 2020-09-01T16:30:00.000Z and the end is 2020-09-01T23:00:00.000Z, even though the expected UTC times for NYC are 13:30 to 20:00.

Debugging a bit into this, it seems like this is because the sessions are created assuming 9:30am and 4:00pm in the local timezone, which in my case is America/Los_Angeles. Is there a way to retrieve the correct NYC-based moments for the trading sessions? Or to derive the correct start/end times for GMT-7?

I noticed the setTimezoneHere method in the documentation, which didn't work correctly out of the package as it isn't attached to the fincal or calendar objects. I pulled the method into the calendar export and tried calling calendar.setTimezoneHere("America/Los_Angeles"); before the same lines above with no change.

For the nextTradingSession function, I noticed that it only supports days and not specific times. Is there any plans to support this or any alternatives? Assuming I can get the first problem figured out I'm also happy to tinker with it.

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

1 participant