2020// weather, national emergencies and presidential proclamations.
2121// All closure events are included from year 2000.
2222
23- require ' vendor/autoload.php ' ;
23+ namespace Yasumi \ Provider \ USA ;
2424
25- class NYSE extends Yasumi \Provider \USA
25+ use Yasumi \Provider \USA ;
26+ use Yasumi \Holiday ;
27+ use DateTime ;
28+
29+ class NYSE extends USA
2630{
2731 /**
2832 * Initialize holidays for the NYSE.
@@ -31,18 +35,23 @@ class NYSE extends Yasumi\Provider\USA
3135 */
3236 public function initialize (): void
3337 {
34- parent :: initialize () ;
38+ $ this -> timezone = ' America/New_York ' ;
3539
3640 // Add exhange-specific holidays
41+ $ this ->addHoliday ($ this ->newYearsDay ($ this ->year , $ this ->timezone , $ this ->locale ));
42+ $ this ->calculateMartinLutherKingday ();
43+ $ this ->calculateWashingtonsBirthday ();
3744 $ this ->addHoliday ($ this ->goodFriday ($ this ->year , $ this ->timezone , $ this ->locale ));
38-
39- // Remove exchange-specific holidays
40- $ this ->removeHoliday ( ' columbusDay ' );
41- $ this ->removeHoliday ( ' veteransDay ' );
42- $ this ->holidaysCalculator -> removeHoliday ( ' substituteHoliday:veteransDay ' );
43- if ( 2022 < $ this ->year )
44- $ this ->removeHoliday ( ' juneteenth ' );
45+ $ this -> calculateMemorialDay ();
46+ if ( 2021 < $ this -> year )
47+ $ this ->calculateJuneteenth ( );
48+ $ this ->calculateIndependenceDay ( );
49+ $ this ->calculateLabourDay ( );
50+ $ this ->calculateThanksgivingDay ();
51+ $ this ->addHoliday ( $ this -> christmasDay ( $ this -> year , $ this -> timezone , $ this -> locale ) );
4552
53+ $ this ->calculateSubstituteHolidays ();
54+
4655 // Add other full-day closure events
4756 $ this ->addWeatherEvents ();
4857 $ this ->addEmergencies ();
@@ -52,31 +61,31 @@ public function initialize(): void
5261 private function addWeatherEvents ()
5362 {
5463 if (2012 == $ this ->year ) {
55- $ this ->holidaysCalculator -> addHoliday (new Holiday ('HurricaneSandy1 ' , [], new DateTime ('2012-10-29 ' )));
56- $ this ->holidaysCalculator -> addHoliday (new Holiday ('HurricaneSandy2 ' , [], new DateTime ('2012-10-30 ' )));
64+ $ this ->addHoliday (new Holiday ('hurricaneSandy1 ' , [], new DateTime ('2012-10-29 ' )));
65+ $ this ->addHoliday (new Holiday ('hurricaneSandy2 ' , [], new DateTime ('2012-10-30 ' )));
5766 }
5867 }
5968
6069 private function addEmergencies ()
6170 {
6271 if (2001 == $ this ->year ) {
63- $ this ->holidaysCalculator -> addHoliday (new Holiday ('WTCAttack1 ' , [], new DateTime ('2001-09-11 ' )));
64- $ this ->holidaysCalculator -> addHoliday (new Holiday ('WTCAttack2 ' , [], new DateTime ('2001-09-12 ' )));
65- $ this ->holidaysCalculator -> addHoliday (new Holiday ('WTCAttack3 ' , [], new DateTime ('2001-09-13 ' )));
66- $ this ->holidaysCalculator -> addHoliday (new Holiday ('WTCAttack4 ' , [], new DateTime ('2001-09-14 ' )));
72+ $ this ->addHoliday (new Holiday ('WTCAttack1 ' , [], new DateTime ('2001-09-11 ' )));
73+ $ this ->addHoliday (new Holiday ('WTCAttack2 ' , [], new DateTime ('2001-09-12 ' )));
74+ $ this ->addHoliday (new Holiday ('WTCAttack3 ' , [], new DateTime ('2001-09-13 ' )));
75+ $ this ->addHoliday (new Holiday ('WTCAttack4 ' , [], new DateTime ('2001-09-14 ' )));
6776 }
6877 }
6978
7079 private function addProclamations ()
7180 {
7281 if (2004 == $ this ->year )
73- $ this ->holidaysCalculator -> addHoliday (new Holiday ('ReaganMourning ' , [], new DateTime ('2004-06-11 ' )));
82+ $ this ->addHoliday (new Holiday ('ReaganMourning ' , [], new DateTime ('2004-06-11 ' )));
7483 if (2007 == $ this ->year )
75- $ this ->holidaysCalculator -> addHoliday (new Holiday ('GRFordMourning ' , [], new DateTime ('2007-01-02 ' )));
84+ $ this ->addHoliday (new Holiday ('GRFordMourning ' , [], new DateTime ('2007-01-02 ' )));
7685 if (2018 == $ this ->year )
77- $ this ->holidaysCalculator -> addHoliday (new Holiday ('HWBushMourning ' , [], new DateTime ('2018-12-05 ' )));
86+ $ this ->addHoliday (new Holiday ('HWBushMourning ' , [], new DateTime ('2018-12-05 ' )));
7887 if (2025 == $ this ->year )
79- $ this ->holidaysCalculator -> addHoliday (new Holiday ('CarterMourning ' , [], new DateTime ('2025-01-09 ' )));
88+ $ this ->addHoliday (new Holiday ('CarterMourning ' , [], new DateTime ('2025-01-09 ' )));
8089 }
8190
8291 public function getSources (): array
@@ -89,7 +98,5 @@ public function getSources(): array
8998 'https://www.thecorporatecounsel.net/blog/2021/10/nyse-makes-juneteenth-a-new-market-holiday.html ' ,
9099 ];
91100 }
92-
93-
94101}
95102
0 commit comments