question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: get market calendar in various timezones

See original GitHub issue

I think it would be nice to have the option in get_calendar() to specify a timezone you want the calendar in. Here is some code I’ve written recently to do this:

def get_eastern_market_open_close():
    ny = pytz.timezone('America/New_York')
    today_ny = datetime.datetime.now(ny)
    ndq = mcal.get_calendar('NASDAQ')
    open_days = ndq.schedule(start_date=today_ny - pd.Timedelta(str(3*365) + ' days'),
                             end_date=today_ny)
    # convert times to eastern
    for m in ['market_open', 'market_close']:
        open_days[m] = open_days[m].dt.tz_convert('America/New_York')

    return open_days

I’d be happy to implement this, I don’t see any guidelines on collaborating though. Am I good to just code it and issue a pull request?

Not sure if it’s better suited in get_calendar or .schedule

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rsheftelcommented, Aug 10, 2018

Thanks for this suggestion. In terms of collaborating I am open and welcoming to all, I just ask that you submit a PR and including tests so that we can make sure in the future any feature you add continues to work with others new PRs.

For this change, I think it makes the most sense to add the “time_zone” as a parameter in the schedule() function and do the conversation there. I think that all the internals should be kept in UTC and the conversation to any specific time zone done at the end point. This will make code maintenance easier.

0reactions
rsheftelcommented, Jul 11, 2020

This is now merged into master from #106 Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple Time Zones - Business Calendar Customer Support
Multiple Time Zones. I am surprised that none of the views features additional time zones, similar to MS Outlook or Google Calendar.
Read more >
Multiple Timezones in Teams Calendar
Has Microsoft given additional consideration to the request to add multiple timezones to the Teams Calendar, similar to the functionality to ...
Read more >
Traveling and Keeping Your Calendar Appointments In the ...
As you're preparing for an upcoming trip you go through your calendar to make sure that all of your appointments are still in...
Read more >
How to handle calendar TimeZones using Java?
Get TimeZone of user TimeZone currentTimeZone = sc_.getTimeZone(); Calendar currentDt = new GregorianCalendar(currentTimeZone, EN_US_LOCALE); // Get the ...
Read more >
How to Schedule Meetings in Different Time Zones (and see ...
If you are NOT using Office 365 or Exchange Server: You won't be able to access the full functionality described above but you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found