Skip to content

ggoodwin/go-nyse-time

Repository files navigation

Time logo
New York Stock Exchange (NYSE) Time Go Library

GMan#0001 Go Package Devs

Go Reference Go Version Size Last Commit License

GoReportCard CodeFactor Codacy Badge codecov

Build lint CodeQL


🌟 How it works

The library uses the current time to determine if the market is open, closed, or closed early. It also determines if the current day is a holiday.

πŸ“¦ Installation and Usage

Go

Make sure you have Go installed on your machine.

You can check by running the following command in the console

go version

If you don't have Go installed, you can download it from here.

Add to your project

Run the following command in the console, in the project directory, to install the library with go get

go get github.com/ggoodwin/go-nyse-time

Importing

Add the import to your .go file

import nyse_time "github.com/ggoodwin/go-nyse-time"

πŸ’° Usage

Check if the Market is Open at Current Time

// Returns: bool
open := nyse_time.IsMarketOpen()

Check if the Market will be Open based on a specific time and date

// Parameters: time.Time
// Returns: bool
open := nyse_time.IsMarketOpenCustom(time.Time)

Is It A Holiday?

// Parameters: time.Time
// Returns: bool
isHoliday := nyse_time.IsHoliday(time.Time)

Is It An Early Close Day?

// Parameters: time.Time
// Returns: bool
isEarlyClose := nyse_time.IsEarlyClose(time.Time)

Is It A Weekend?

// Parameters: time.Time
// Returns: bool
isWeekend := nyse_time.IsWeekend(time.Time)

πŸ’» Dependencies

πŸ™‡β€β™‚οΈ Issues and Contributing

If you find an issue with this library, please report the issue using our GITHUB-ISSUES or check out the SECURITY details if it is security related.

If you'd like, I welcome any contributions. Please read the CONTRIBUTING document then FORK this library and submit a PULL-REQUEST. Make sure to click compare across forks to see your fork.

βš–οΈ License

This project is under the MIT License. See the LICENSE file for the full license text.

πŸ“œ Changes

Check out our CHANGELOG

πŸ‘πŸ» Code of Conduct

Please read my CODE-OF-CONDUCT before contributing or engaging in discussions.