{"id":45625665,"url":"https://github.com/scmhub/calendar","last_synced_at":"2026-02-23T20:03:28.827Z","repository":{"id":57639627,"uuid":"369195952","full_name":"scmhub/calendar","owner":"scmhub","description":"Golang Exchange Business Calendar","archived":false,"fork":false,"pushed_at":"2025-01-02T09:24:38.000Z","size":94,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-02T10:33:46.968Z","etag":null,"topics":["calendars","exchanges","go","golang","markets"],"latest_commit_sha":null,"homepage":"https://scm.cx","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scmhub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-20T12:11:49.000Z","updated_at":"2025-01-02T09:24:42.000Z","dependencies_parsed_at":"2024-05-01T15:54:37.156Z","dependency_job_id":"d0b54f1b-abf0-4713-959e-d183218e297e","html_url":"https://github.com/scmhub/calendar","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/scmhub/calendar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scmhub%2Fcalendar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scmhub%2Fcalendar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scmhub%2Fcalendar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scmhub%2Fcalendar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scmhub","download_url":"https://codeload.github.com/scmhub/calendar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scmhub%2Fcalendar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29754380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T19:23:13.917Z","status":"ssl_error","status_checked_at":"2026-02-23T19:23:11.618Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calendars","exchanges","go","golang","markets"],"created_at":"2026-02-23T20:03:17.323Z","updated_at":"2026-02-23T20:03:28.819Z","avatar_url":"https://github.com/scmhub.png","language":"Go","readme":"# ![SCM logo](logo.png) Exchange Calendars\n\n![Build Status](https://github.com/scmhub/calendar/workflows/Build%20and%20Test/badge.svg)\n![Coverage](https://img.shields.io/badge/Coverage-97.5%25-brightgreen)\n[![GoReportCard](https://goreportcard.com/badge/github.com/scmhub/calendar)](https://goreportcard.com/report/github.com/scmhub/calendar)\n[![Go Reference](https://pkg.go.dev/badge/github.com/scmhub/calendar.svg)](https://pkg.go.dev/github.com/scmhub/calendar)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n## Overview\n\n`calendar` is a Golang package that provides exchange-specific calendar functionality. It enables you to manage market holidays, business days, early closes, and sessions defined by Market Identifier Codes (MIC) for various financial exchanges globally.\n\n## Features\n\n- **Business Day Calculations**: Check if a date is a business day, holiday, or early close.\n- **Custom Holidays**: Define and manage custom holidays (recurring or one-time events).\n- **Exchange Sessions**: Handle exchange sessions with customizable open/close times.\n- **Multi-Year Support**: Supports predefined calendars for financial exchanges over several years.\n-  **Market Identifier Code**: Exchange calendars are defined by their [ISO-10383](https://www.iso20022.org/10383/iso-10383-market-identifier-codes) Market Identifier Code (MIC).\n\n## Installation\n\nInstall the package by running:\n\n```bash\ngo get github.com/scmhub/calendar\n```\n\n## Usage\n#### Basic example\n```go\nimport (\n    \"fmt\"\n    \"time\"\n    \"github.com/scmhub/calendar\"\n)\n\nfunc main() {\n    // Create a calendar with default years (current year ±5 years)\n\tnyse := calendar.XNYS()\n\n    // Or create a calendar with a custom start and end year\n\tcustomCal := calendar.XNYS(2010, 2035) // From 2010 to 2035\n\n    // Check if today is a business day\n     today := time.Now()\n    if nyse.IsBusinessDay(today) {\n        fmt.Println(\"Today is a business day.\")\n    } else {\n        fmt.Println(\"Today is not a business day.\")\n    }\n\n    // Get the next business day\n    nextBusinessDay := nyse.NextBusinessDay(today)\n    fmt.Printf(\"Next business day: %v\\n\", nextBusinessDay)\n\n\t// Check if Black Friday 2030 is an early close\n\tblackFriday := time.Date(2030, time.November, 29, 0, 0, 0, 0, calendar.NewYork)\n\tfmt.Println(customCal.IsEarlyClose(blackFriday)) // Outputs: true\n}\n```\n\n#### Print specific calendar\n```go\nimport (\n    \"fmt\"\n    \"github.com/scmhub/calendar\"\n)\n\nfunc main() {\n    // Load the New York Stock Exchange (XNYS) calendar\n    nyse := calendar.XNYS()\n\n    nyse.SetYears(2021,2022)\n\n    fmt.Print(nyse)\n}\n```\nOutput\n```\nCalendar New York Stock Exchange:\n        2021-Jan-01 Fri    New Year's Day\n        2021-Jan-18 Mon    Martin Luther King Jr. Day\n        2021-Feb-15 Mon    Presidents' Day\n        2021-Apr-02 Fri    Good Friday\n        2021-May-31 Mon    Memorial Day\n        2021-Jul-05 Mon    Independence Day\n        2021-Sep-06 Mon    Labor Day\n        2021-Nov-25 Thu    Thanksgiving Day\n        2021-Nov-26 Fri    Black Friday\n        2021-Dec-24 Fri    Christmas Day\n        2022-Jan-17 Mon    Martin Luther King Jr. Day\n        2022-Feb-21 Mon    Presidents' Day\n        2022-Apr-15 Fri    Good Friday\n        2022-May-30 Mon    Memorial Day\n        2022-Jun-20 Mon    Juneteenth National Independence Day\n        2022-Jul-04 Mon    Independence Day\n        2022-Sep-05 Mon    Labor Day\n        2022-Nov-24 Thu    Thanksgiving Day\n        2022-Nov-25 Fri    Black Friday\n        2022-Dec-26 Mon    Christmas Day\n\n```\n\n#### Creating Holidays \u0026 Calendars\n\n```go\n// Create Recurring Holidays\nMemorialDay = \u0026Holiday{\n    Name:       \"Memorial Day\",\n    Month:      time.May,\n    Weekday:    time.Monday,\n    NthWeekday: -1,\n    calc:       CalcNthWeekday,\n}\nIndependenceDay = \u0026Holiday{\n    Name:       \"Independence Day\",\n    Month:      time.July,\n    Day:        4,\n    observance: nearestWorkday,\n    calc:       CalcDayOfMonth,\n}\n\n// Create Non Recurring Holidays\n// September 11 - september 11, 2001\nSeptemberEleven = \u0026Holiday{\n    Name:   \"Sepember 11\",\n    Month:  time.September,\n    Day:    11,\n    OnYear: 2001,\n    calc:   CalcDayOfMonth,\n}\n\n// September 11 -14 range\nSeptemberElevenDays = []*Holiday{\n    SeptemberEleven,\n    SeptemberEleven.Copy(\"Sepember 11 day 2\").SetOffset(1),\n    SeptemberEleven.Copy(\"Sepember 11 day 3\").SetOffset(2),\n    SeptemberEleven.Copy(\"Sepember 11 day 4\").SetOffset(3),\n}\n\n// Copy an Holiday and set observance\nNewYear.Copy(\"New Year's Day\").SetObservance(sundayToMonday)\n\n// Create a Calendar\nc := NewCalendar(\"New York Stock Exchange\", NewYork, 2010, 2025)\n// Set Session\nc.SetSession(\u0026Session{\n    EarlyOpen:  7 * time.Hour,\n    Open:       9*time.Hour + 30*time.Minute,\n    Close:      16 * time.Hour,\n    EarlyClose: 13 * time.Hour,\n    LateClose:  20 * time.Hour,\n})\n// Add Recurring Holidays\nc.AddHolidays(\n    NewYear.Copy().SetObservance(sundayToMonday),\n    MLKDay,\n    PresidentsDay,\n    GoodFriday,\n    MemorialDay,\n    JuneteenthDay,\n    IndependenceDay,\n    LaborDay,\n    ThanksgivingDay,\n    ChristmasDay.Copy().SetObservance(nearestWorkday),\n)\n// Add Non Recurring Holidays\nc.AddHolidays(USNationalDaysOfMourning...)\nc.AddHolidays(SeptemberElevenDays...)\nc.AddHolidays(HurricaneSandyDays...)\n// Early Closing\nc.AddEarlyClosingDays(\n    BeforeIndependenceDay.Copy().SetObservance(onlyOnWeekdays(time.Monday, time.Tuesday, time.Thursday)),\n    AfterIndependenceDay.Copy().SetBeforeYear(2013).SetObservance(onlyOnWeekdays(time.Friday)),\n    BeforeIndependenceDay.Copy().SetAfterYear(2013).SetObservance(onlyOnWeekdays(time.Wednesday)),\n    BlackFriday,\n    ChristmasEve.Copy().SetObservance(exeptOnWeekdays(time.Friday)), // Overlap Christmas day observance if friday\n)\n\n```\n## Existing Calendar\n\n| Market place | Exchange                                                                     | MIC  |     |\n| ------------ | ---------------------------------------------------------------------------- | ---- | --- |\n| New York     | [New York Stock Exchange](https://www.nyse.com/index)                        | XNYS | ✅  |\n| New York     | [NASDAQ](https://www.nasdaq.com/)                                            | XNAS | ✅  |\n| Chicago      | [CBOE](http://markets.cboe.com)                                              | XCBO | ✅  |\n| Chicago      | [CBOE Futures Exchange](http://www.cfe.cboe.com)                             | XCBF | ✅  |\n| Toronto      | [Toronto Stock Exchange](https://www.tsx.com/)                               | XTSE |     |\n| Mexico       | [Mexican Stock Exchange](https://www.bmv.com.mx)                             | XMEX |     |\n| Sao Paulo    | [BMF Bovespa](http://www.b3.com.br/en_us/)                                   | BVMF |     |\n| London       | [London Stock Exchange](https://www.londonstockexchange.com)                 | XLON | ✅  |\n| Amsterdam    | [Euronext Amsterdam](http://www.euronext.com)                                | XAMS | ✅  |\n| Brussels     | [Euronext Brussels](http://www.euronext.com)                                 | XBRU | ✅  |\n| Lisbon       | [Euronext Lisbon](http://www.euronext.com)                                   | XLIS | ✅  |\n| Paris        | [Euronext Paris](http://www.euronext.com)                                    | XPAR | ✅  |\n| Milan        | [Euronext Milan - Borsa Italiana](http://www.borsaitaliana.it)               | XMIL | ✅  |\n| Madrid       | [Bolsa de Madrid](http://www.bolsamadrid.es)                                 | XMAD | ✅  |\n| Franckfurt   | [Deutsche Boerse](http://www.deutsche-boerse.com)                            | XFRA | ✅  |\n| Franckfurt   | [Xetra](http://www.deutsche-boerse.com)                                      | XETR | ✅  |\n| Zurich       | [SIX Swiss Exchange](http://www.six-group.com/en/site/exchanges.html)        | XSWX | ✅  |\n| Mumbai       | [Bombay Stock Exchange](https://www.bseindia.com)                            | XBOM |     |\n| Bangkok      | [Stock Exchange of Thailand](http://www.set.or.th/set/mainpage.do)           | XBKK |     |\n| Singapore    | [Singapore Exchange](https://www.sgx.com)                                    | XSES | ✅  |\n| Hong Kong    | [Hong Kong Stock Exchange](https://www.hkex.com.hk/index.html)               | XHKG | ✅  |\n| Shenzhen     | [Shenzhen Stock Exchange](http://www.szse.cn/English/index.html)             | XSHE | ✅  |\n| Shanghai     | [Shanghai Stock Exchange](http://www.sse.com.cn/sseportal/en/home/home.html) | XSHG | ✅  |\n| Seoul        | [Korea Exchange](http://eng.krx.co.kr)                                       | XKRX |     |\n| Tokyo        | [Japan Exchange Group](https://www.jpx.co.jp/english/)                       | XJPX | ✅  |\n| Sidney       | [Austrialian Securities Exchange](https://www.asx.com.au/)                   | XASX |     |\n\n\u003c!---\n| Chile          | [Santiago Stock Exchange](http://inter.bolsadesantiago.com/sitios/en/Paginas/home.aspx)  | XSGO |\n| Colombia       | [Colombia Securities Exchange](https://www.bvc.com.co/nueva/index_en.html)               | XBOG |\n| Peru           | [Lima Stock Exchange](https://www.bvl.com.pe)                                            | XLIM |\n| Iceland        | [Iceland Stock Exchange](http://www.nasdaqomxnordic.com/)                                | XICE |\n| Ireland        | [Irish Stock Exchange](http://www.ise.ie/)                                               | XDUB |\n| Denmark        | [Copenhagen Stock Exchange](http://www.nasdaqomxnordic.com/)                             | XCSE |\n| Finland        | [Helsinki Stock Exchange](http://www.nasdaqomxnordic.com/)                               | XHEL |\n| Sweden         | [Stockholm Stock Exchange](http://www.nasdaqomxnordic.com/)                              | XSTO |\n| Norway         | [Oslo Stock Exchange](https://www.oslobors.no/ob_eng/)                                   | XOSL |\n| Austria        | [Wiener Borse](https://www.wienerborse.at/en/)                                           | XWBO |\n| Czech Republic | [Prague Stock Exchange](https://www.pse.cz/en/)                                          | XPRA |\n| Hungary        | [Budapest Stock Exchange](https://bse.hu/)                                               | XBUD |\n| Poland         | [Poland Stock Exchange](http://www.gpw.pl)                                               | XWAR |\n| Greece         | [Athens Stock Exchange](http://www.helex.gr/)                                            | ASEX |\n| Turkey         | [Istanbul Stock Exchange](https://www.borsaistanbul.com/en/)                             | XIST |\n| Russia         | [Moscow Exchange](https://www.moex.com/en/)                                              | XMOS |\n| South Africa   | [Johannesburg Stock Exchange](https://www.jse.co.za/z)                                   | XJSE |\n| Malaysia       | [Malaysia Stock Exchange](http://www.bursamalaysia.com/market/)                          | XKLS |\n| Philippines    | [Philippine Stock Exchange](https://www.pse.com.ph/stockMarket/home.html)                | XPHS |\n| New Zealand    | [New Zealand Exchange](https://www.nzx.com/)                                             | XNZE |\n---\u003e\n\n## API References\nSome key functions:\n- **IsBusinessDay(t time.Time)**: Returns whether the date is a business day.\n- **NextBusinessDay(t time.Time)**: Gets the next business day after the given date.\n- **AddHolidays(h ...Holiday)**: Adds holidays to the calendar.\n- **SetSession(session *Session)**: Configures open/close times for the exchange.\n\n## Contributing\nContributions are welcome! Please submit issues or pull requests to improve the package. For significant changes, open an issue to discuss your ideas first.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscmhub%2Fcalendar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscmhub%2Fcalendar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscmhub%2Fcalendar/lists"}