-
-
Notifications
You must be signed in to change notification settings - Fork 167
Expand file tree
/
Copy pathNYSE.php
More file actions
107 lines (94 loc) · 4.17 KB
/
Copy pathNYSE.php
File metadata and controls
107 lines (94 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
declare(strict_types = 1);
/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2025 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me at sachatelgenhof dot com>
* @author Art Kurbakov <admin at mgwebgroup dot com>
*/
// This file in addition to regular holidays observed by
// the New York Stock Exchange (NYSE),
// includes full day special closure events due to:
// weather, national emergencies and presidential proclamations.
// All closure events are included from year 2000.
namespace Yasumi\Provider\USA;
use Yasumi\Holiday;
use Yasumi\Provider\USA;
class NYSE extends USA
{
/**
* Initialize holidays for the NYSE.
*
* @throws \Exception
*/
public function initialize(): void
{
$this->timezone = 'America/New_York';
// Add exchange-specific holidays
$this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale));
$this->calculateMartinLutherKingday();
$this->calculateWashingtonsBirthday();
$this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale));
$this->calculateMemorialDay();
if (2021 < $this->year) {
$this->calculateJuneteenth();
}
$this->calculateIndependenceDay();
$this->calculateLabourDay();
$this->calculateThanksgivingDay();
$this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale));
$this->calculateSubstituteHolidays();
// Add other full-day closure events
$this->addWeatherEvents();
$this->addEmergencies();
$this->addProclamations();
}
public function getSources(): array
{
return [
'https://www.nyse.com/trader-update/history#11507',
'https://s3.amazonaws.com/armstrongeconomics-wp/2013/07/NYSE-Closings.pdf',
'https://ir.theice.com/press/news-details/2018/New-York-Stock-Exchange-to-Honor-President-George-H-W-Bush/default.aspx',
'https://ir.theice.com/press/news-details/2024/The-New-York-Stock-Exchange-Will-Close-Markets-on-January-9-to-Honor-the-Passing-of-Former-President-Jimmy-Carter-on-National-Day-of-Mourning/default.aspx',
'https://www.thecorporatecounsel.net/blog/2021/10/nyse-makes-juneteenth-a-new-market-holiday.html',
];
}
private function addWeatherEvents()
{
if (2012 == $this->year) {
$this->addHoliday(new Holiday('hurricaneSandy1', [], new \DateTime('2012-10-29', new \DateTimeZone($this->timezone))));
$this->addHoliday(new Holiday('hurricaneSandy2', [], new \DateTime('2012-10-30', new \DateTimeZone($this->timezone))));
}
}
private function addEmergencies()
{
if (2001 == $this->year) {
$this->addHoliday(new Holiday('groundZero1', [], new \DateTime('2001-09-11', new \DateTimeZone($this->timezone))));
$this->addHoliday(new Holiday('groundZero2', [], new \DateTime('2001-09-12', new \DateTimeZone($this->timezone))));
$this->addHoliday(new Holiday('groundZero3', [], new \DateTime('2001-09-13', new \DateTimeZone($this->timezone))));
$this->addHoliday(new Holiday('groundZero4', [], new \DateTime('2001-09-14', new \DateTimeZone($this->timezone))));
}
}
private function addProclamations()
{
if (2004 == $this->year) {
$this->addHoliday(new Holiday('ReaganMourning', [], new \DateTime('2004-06-11', new \DateTimeZone($this->timezone))));
}
if (2007 == $this->year) {
$this->addHoliday(new Holiday('GRFordMourning', [], new \DateTime('2007-01-02', new \DateTimeZone($this->timezone))));
}
if (2018 == $this->year) {
$this->addHoliday(new Holiday('HWBushMourning', [], new \DateTime('2018-12-05', new \DateTimeZone($this->timezone))));
}
if (2025 == $this->year) {
$this->addHoliday(new Holiday('CarterMourning', [], new \DateTime('2025-01-09', new \DateTimeZone($this->timezone))));
}
}
}