Skip to content

Commit 868e060

Browse files
committed
Fixed Timezone
1 parent 09e42a2 commit 868e060

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@ and this project adheres to [Semantic Versioning].
99

1010
- Will list future updates here
1111

12+
## [0.0.3] - 2023-01-17
13+
14+
### Added
15+
16+
### Changed
17+
18+
### Deprecated
19+
20+
### Removed
21+
22+
### Fixed
23+
24+
- Fixed README.md
25+
- Fixed Timezone
26+
27+
### Security
28+
1229
## [0.0.2] - 2023-01-16
1330

1431
### Added

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,6 @@ isHoliday := stocks.IsHoliday()
8181
isEarlyClose := stocks.IsEarlyClose()
8282
```
8383

84-
### Is the Stock Market Open?
85-
86-
Add this to your `.go` file
87-
88-
```go
89-
//Returns `bool`
90-
isOpen := stocks.IsMarketOpen()
91-
```
92-
9384
### Get EST Time
9485

9586
```go

isopen.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ func GetESTTime() time.Time {
1515
* * Checks if the market is open
1616
*/
1717
func IsMarketOpen() bool {
18+
loc, _ := time.LoadLocation("America/New_York")
1819
currentTime := GetESTTime()
19-
openTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 9, 30, 0, 0, time.UTC)
20-
closeTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 16, 00, 0, 0, time.UTC)
21-
earlyClose := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 13, 00, 0, 0, time.UTC)
20+
openTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 9, 30, 0, 0, loc)
21+
closeTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 16, 00, 0, 0, loc)
22+
earlyClose := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 13, 00, 0, 0, loc)
2223
dayOfWeek := currentTime.Weekday()
2324

2425
// Check Holidays
25-
if IsHoliday() {
26-
return false
27-
}
26+
// if IsHoliday() {
27+
// return false
28+
// }
2829

2930
// Check Early Close Days
3031
if IsEarlyClose() {

0 commit comments

Comments
 (0)