Skip to content

Commit

Permalink
Merge pull request #22 from AlpacaDB/feature/add-2022-xtks
Browse files Browse the repository at this point in the history
Feature/Add-2022-XTKS
  • Loading branch information
sercant authored Dec 1, 2021
2 parents 9f0f899 + 3f99f7c commit 94e4a08
Show file tree
Hide file tree
Showing 3 changed files with 272 additions and 0 deletions.
244 changes: 244 additions & 0 deletions tests/resources/xtks.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5393,3 +5393,247 @@
2021-12-28,2021-12-28 00:01:00,2021-12-28 06:00:00
2021-12-29,2021-12-29 00:01:00,2021-12-29 06:00:00
2021-12-30,2021-12-30 00:01:00,2021-12-30 06:00:00
2022-01-04,2022-01-04 00:01:00,2022-01-04 06:00:00
2022-01-05,2022-01-05 00:01:00,2022-01-05 06:00:00
2022-01-06,2022-01-06 00:01:00,2022-01-06 06:00:00
2022-01-07,2022-01-07 00:01:00,2022-01-07 06:00:00
2022-01-11,2022-01-11 00:01:00,2022-01-11 06:00:00
2022-01-12,2022-01-12 00:01:00,2022-01-12 06:00:00
2022-01-13,2022-01-13 00:01:00,2022-01-13 06:00:00
2022-01-14,2022-01-14 00:01:00,2022-01-14 06:00:00
2022-01-17,2022-01-17 00:01:00,2022-01-17 06:00:00
2022-01-18,2022-01-18 00:01:00,2022-01-18 06:00:00
2022-01-19,2022-01-19 00:01:00,2022-01-19 06:00:00
2022-01-20,2022-01-20 00:01:00,2022-01-20 06:00:00
2022-01-21,2022-01-21 00:01:00,2022-01-21 06:00:00
2022-01-24,2022-01-24 00:01:00,2022-01-24 06:00:00
2022-01-25,2022-01-25 00:01:00,2022-01-25 06:00:00
2022-01-26,2022-01-26 00:01:00,2022-01-26 06:00:00
2022-01-27,2022-01-27 00:01:00,2022-01-27 06:00:00
2022-01-28,2022-01-28 00:01:00,2022-01-28 06:00:00
2022-01-31,2022-01-31 00:01:00,2022-01-31 06:00:00
2022-02-01,2022-02-01 00:01:00,2022-02-01 06:00:00
2022-02-02,2022-02-02 00:01:00,2022-02-02 06:00:00
2022-02-03,2022-02-03 00:01:00,2022-02-03 06:00:00
2022-02-04,2022-02-04 00:01:00,2022-02-04 06:00:00
2022-02-07,2022-02-07 00:01:00,2022-02-07 06:00:00
2022-02-08,2022-02-08 00:01:00,2022-02-08 06:00:00
2022-02-09,2022-02-09 00:01:00,2022-02-09 06:00:00
2022-02-10,2022-02-10 00:01:00,2022-02-10 06:00:00
2022-02-14,2022-02-14 00:01:00,2022-02-14 06:00:00
2022-02-15,2022-02-15 00:01:00,2022-02-15 06:00:00
2022-02-16,2022-02-16 00:01:00,2022-02-16 06:00:00
2022-02-17,2022-02-17 00:01:00,2022-02-17 06:00:00
2022-02-18,2022-02-18 00:01:00,2022-02-18 06:00:00
2022-02-21,2022-02-21 00:01:00,2022-02-21 06:00:00
2022-02-22,2022-02-22 00:01:00,2022-02-22 06:00:00
2022-02-24,2022-02-24 00:01:00,2022-02-24 06:00:00
2022-02-25,2022-02-25 00:01:00,2022-02-25 06:00:00
2022-02-28,2022-02-28 00:01:00,2022-02-28 06:00:00
2022-03-01,2022-03-01 00:01:00,2022-03-01 06:00:00
2022-03-02,2022-03-02 00:01:00,2022-03-02 06:00:00
2022-03-03,2022-03-03 00:01:00,2022-03-03 06:00:00
2022-03-04,2022-03-04 00:01:00,2022-03-04 06:00:00
2022-03-07,2022-03-07 00:01:00,2022-03-07 06:00:00
2022-03-08,2022-03-08 00:01:00,2022-03-08 06:00:00
2022-03-09,2022-03-09 00:01:00,2022-03-09 06:00:00
2022-03-10,2022-03-10 00:01:00,2022-03-10 06:00:00
2022-03-11,2022-03-11 00:01:00,2022-03-11 06:00:00
2022-03-14,2022-03-14 00:01:00,2022-03-14 06:00:00
2022-03-15,2022-03-15 00:01:00,2022-03-15 06:00:00
2022-03-16,2022-03-16 00:01:00,2022-03-16 06:00:00
2022-03-17,2022-03-17 00:01:00,2022-03-17 06:00:00
2022-03-18,2022-03-18 00:01:00,2022-03-18 06:00:00
2022-03-22,2022-03-22 00:01:00,2022-03-22 06:00:00
2022-03-23,2022-03-23 00:01:00,2022-03-23 06:00:00
2022-03-24,2022-03-24 00:01:00,2022-03-24 06:00:00
2022-03-25,2022-03-25 00:01:00,2022-03-25 06:00:00
2022-03-28,2022-03-28 00:01:00,2022-03-28 06:00:00
2022-03-29,2022-03-29 00:01:00,2022-03-29 06:00:00
2022-03-30,2022-03-30 00:01:00,2022-03-30 06:00:00
2022-03-31,2022-03-31 00:01:00,2022-03-31 06:00:00
2022-04-01,2022-04-01 00:01:00,2022-04-01 06:00:00
2022-04-04,2022-04-04 00:01:00,2022-04-04 06:00:00
2022-04-05,2022-04-05 00:01:00,2022-04-05 06:00:00
2022-04-06,2022-04-06 00:01:00,2022-04-06 06:00:00
2022-04-07,2022-04-07 00:01:00,2022-04-07 06:00:00
2022-04-08,2022-04-08 00:01:00,2022-04-08 06:00:00
2022-04-11,2022-04-11 00:01:00,2022-04-11 06:00:00
2022-04-12,2022-04-12 00:01:00,2022-04-12 06:00:00
2022-04-13,2022-04-13 00:01:00,2022-04-13 06:00:00
2022-04-14,2022-04-14 00:01:00,2022-04-14 06:00:00
2022-04-15,2022-04-15 00:01:00,2022-04-15 06:00:00
2022-04-18,2022-04-18 00:01:00,2022-04-18 06:00:00
2022-04-19,2022-04-19 00:01:00,2022-04-19 06:00:00
2022-04-20,2022-04-20 00:01:00,2022-04-20 06:00:00
2022-04-21,2022-04-21 00:01:00,2022-04-21 06:00:00
2022-04-22,2022-04-22 00:01:00,2022-04-22 06:00:00
2022-04-25,2022-04-25 00:01:00,2022-04-25 06:00:00
2022-04-26,2022-04-26 00:01:00,2022-04-26 06:00:00
2022-04-27,2022-04-27 00:01:00,2022-04-27 06:00:00
2022-04-28,2022-04-28 00:01:00,2022-04-28 06:00:00
2022-05-02,2022-05-02 00:01:00,2022-05-02 06:00:00
2022-05-06,2022-05-06 00:01:00,2022-05-06 06:00:00
2022-05-09,2022-05-09 00:01:00,2022-05-09 06:00:00
2022-05-10,2022-05-10 00:01:00,2022-05-10 06:00:00
2022-05-11,2022-05-11 00:01:00,2022-05-11 06:00:00
2022-05-12,2022-05-12 00:01:00,2022-05-12 06:00:00
2022-05-13,2022-05-13 00:01:00,2022-05-13 06:00:00
2022-05-16,2022-05-16 00:01:00,2022-05-16 06:00:00
2022-05-17,2022-05-17 00:01:00,2022-05-17 06:00:00
2022-05-18,2022-05-18 00:01:00,2022-05-18 06:00:00
2022-05-19,2022-05-19 00:01:00,2022-05-19 06:00:00
2022-05-20,2022-05-20 00:01:00,2022-05-20 06:00:00
2022-05-23,2022-05-23 00:01:00,2022-05-23 06:00:00
2022-05-24,2022-05-24 00:01:00,2022-05-24 06:00:00
2022-05-25,2022-05-25 00:01:00,2022-05-25 06:00:00
2022-05-26,2022-05-26 00:01:00,2022-05-26 06:00:00
2022-05-27,2022-05-27 00:01:00,2022-05-27 06:00:00
2022-05-30,2022-05-30 00:01:00,2022-05-30 06:00:00
2022-05-31,2022-05-31 00:01:00,2022-05-31 06:00:00
2022-06-01,2022-06-01 00:01:00,2022-06-01 06:00:00
2022-06-02,2022-06-02 00:01:00,2022-06-02 06:00:00
2022-06-03,2022-06-03 00:01:00,2022-06-03 06:00:00
2022-06-06,2022-06-06 00:01:00,2022-06-06 06:00:00
2022-06-07,2022-06-07 00:01:00,2022-06-07 06:00:00
2022-06-08,2022-06-08 00:01:00,2022-06-08 06:00:00
2022-06-09,2022-06-09 00:01:00,2022-06-09 06:00:00
2022-06-10,2022-06-10 00:01:00,2022-06-10 06:00:00
2022-06-13,2022-06-13 00:01:00,2022-06-13 06:00:00
2022-06-14,2022-06-14 00:01:00,2022-06-14 06:00:00
2022-06-15,2022-06-15 00:01:00,2022-06-15 06:00:00
2022-06-16,2022-06-16 00:01:00,2022-06-16 06:00:00
2022-06-17,2022-06-17 00:01:00,2022-06-17 06:00:00
2022-06-20,2022-06-20 00:01:00,2022-06-20 06:00:00
2022-06-21,2022-06-21 00:01:00,2022-06-21 06:00:00
2022-06-22,2022-06-22 00:01:00,2022-06-22 06:00:00
2022-06-23,2022-06-23 00:01:00,2022-06-23 06:00:00
2022-06-24,2022-06-24 00:01:00,2022-06-24 06:00:00
2022-06-27,2022-06-27 00:01:00,2022-06-27 06:00:00
2022-06-28,2022-06-28 00:01:00,2022-06-28 06:00:00
2022-06-29,2022-06-29 00:01:00,2022-06-29 06:00:00
2022-06-30,2022-06-30 00:01:00,2022-06-30 06:00:00
2022-07-01,2022-07-01 00:01:00,2022-07-01 06:00:00
2022-07-04,2022-07-04 00:01:00,2022-07-04 06:00:00
2022-07-05,2022-07-05 00:01:00,2022-07-05 06:00:00
2022-07-06,2022-07-06 00:01:00,2022-07-06 06:00:00
2022-07-07,2022-07-07 00:01:00,2022-07-07 06:00:00
2022-07-08,2022-07-08 00:01:00,2022-07-08 06:00:00
2022-07-11,2022-07-11 00:01:00,2022-07-11 06:00:00
2022-07-12,2022-07-12 00:01:00,2022-07-12 06:00:00
2022-07-13,2022-07-13 00:01:00,2022-07-13 06:00:00
2022-07-14,2022-07-14 00:01:00,2022-07-14 06:00:00
2022-07-15,2022-07-15 00:01:00,2022-07-15 06:00:00
2022-07-19,2022-07-19 00:01:00,2022-07-19 06:00:00
2022-07-20,2022-07-20 00:01:00,2022-07-20 06:00:00
2022-07-21,2022-07-21 00:01:00,2022-07-21 06:00:00
2022-07-22,2022-07-22 00:01:00,2022-07-22 06:00:00
2022-07-25,2022-07-25 00:01:00,2022-07-25 06:00:00
2022-07-26,2022-07-26 00:01:00,2022-07-26 06:00:00
2022-07-27,2022-07-27 00:01:00,2022-07-27 06:00:00
2022-07-28,2022-07-28 00:01:00,2022-07-28 06:00:00
2022-07-29,2022-07-29 00:01:00,2022-07-29 06:00:00
2022-08-01,2022-08-01 00:01:00,2022-08-01 06:00:00
2022-08-02,2022-08-02 00:01:00,2022-08-02 06:00:00
2022-08-03,2022-08-03 00:01:00,2022-08-03 06:00:00
2022-08-04,2022-08-04 00:01:00,2022-08-04 06:00:00
2022-08-05,2022-08-05 00:01:00,2022-08-05 06:00:00
2022-08-08,2022-08-08 00:01:00,2022-08-08 06:00:00
2022-08-09,2022-08-09 00:01:00,2022-08-09 06:00:00
2022-08-10,2022-08-10 00:01:00,2022-08-10 06:00:00
2022-08-12,2022-08-12 00:01:00,2022-08-12 06:00:00
2022-08-15,2022-08-15 00:01:00,2022-08-15 06:00:00
2022-08-16,2022-08-16 00:01:00,2022-08-16 06:00:00
2022-08-17,2022-08-17 00:01:00,2022-08-17 06:00:00
2022-08-18,2022-08-18 00:01:00,2022-08-18 06:00:00
2022-08-19,2022-08-19 00:01:00,2022-08-19 06:00:00
2022-08-22,2022-08-22 00:01:00,2022-08-22 06:00:00
2022-08-23,2022-08-23 00:01:00,2022-08-23 06:00:00
2022-08-24,2022-08-24 00:01:00,2022-08-24 06:00:00
2022-08-25,2022-08-25 00:01:00,2022-08-25 06:00:00
2022-08-26,2022-08-26 00:01:00,2022-08-26 06:00:00
2022-08-29,2022-08-29 00:01:00,2022-08-29 06:00:00
2022-08-30,2022-08-30 00:01:00,2022-08-30 06:00:00
2022-08-31,2022-08-31 00:01:00,2022-08-31 06:00:00
2022-09-01,2022-09-01 00:01:00,2022-09-01 06:00:00
2022-09-02,2022-09-02 00:01:00,2022-09-02 06:00:00
2022-09-05,2022-09-05 00:01:00,2022-09-05 06:00:00
2022-09-06,2022-09-06 00:01:00,2022-09-06 06:00:00
2022-09-07,2022-09-07 00:01:00,2022-09-07 06:00:00
2022-09-08,2022-09-08 00:01:00,2022-09-08 06:00:00
2022-09-09,2022-09-09 00:01:00,2022-09-09 06:00:00
2022-09-12,2022-09-12 00:01:00,2022-09-12 06:00:00
2022-09-13,2022-09-13 00:01:00,2022-09-13 06:00:00
2022-09-14,2022-09-14 00:01:00,2022-09-14 06:00:00
2022-09-15,2022-09-15 00:01:00,2022-09-15 06:00:00
2022-09-16,2022-09-16 00:01:00,2022-09-16 06:00:00
2022-09-20,2022-09-20 00:01:00,2022-09-20 06:00:00
2022-09-21,2022-09-21 00:01:00,2022-09-21 06:00:00
2022-09-22,2022-09-22 00:01:00,2022-09-22 06:00:00
2022-09-26,2022-09-26 00:01:00,2022-09-26 06:00:00
2022-09-27,2022-09-27 00:01:00,2022-09-27 06:00:00
2022-09-28,2022-09-28 00:01:00,2022-09-28 06:00:00
2022-09-29,2022-09-29 00:01:00,2022-09-29 06:00:00
2022-09-30,2022-09-30 00:01:00,2022-09-30 06:00:00
2022-10-03,2022-10-03 00:01:00,2022-10-03 06:00:00
2022-10-04,2022-10-04 00:01:00,2022-10-04 06:00:00
2022-10-05,2022-10-05 00:01:00,2022-10-05 06:00:00
2022-10-06,2022-10-06 00:01:00,2022-10-06 06:00:00
2022-10-07,2022-10-07 00:01:00,2022-10-07 06:00:00
2022-10-11,2022-10-11 00:01:00,2022-10-11 06:00:00
2022-10-12,2022-10-12 00:01:00,2022-10-12 06:00:00
2022-10-13,2022-10-13 00:01:00,2022-10-13 06:00:00
2022-10-14,2022-10-14 00:01:00,2022-10-14 06:00:00
2022-10-17,2022-10-17 00:01:00,2022-10-17 06:00:00
2022-10-18,2022-10-18 00:01:00,2022-10-18 06:00:00
2022-10-19,2022-10-19 00:01:00,2022-10-19 06:00:00
2022-10-20,2022-10-20 00:01:00,2022-10-20 06:00:00
2022-10-21,2022-10-21 00:01:00,2022-10-21 06:00:00
2022-10-24,2022-10-24 00:01:00,2022-10-24 06:00:00
2022-10-25,2022-10-25 00:01:00,2022-10-25 06:00:00
2022-10-26,2022-10-26 00:01:00,2022-10-26 06:00:00
2022-10-27,2022-10-27 00:01:00,2022-10-27 06:00:00
2022-10-28,2022-10-28 00:01:00,2022-10-28 06:00:00
2022-10-31,2022-10-31 00:01:00,2022-10-31 06:00:00
2022-11-01,2022-11-01 00:01:00,2022-11-01 06:00:00
2022-11-02,2022-11-02 00:01:00,2022-11-02 06:00:00
2022-11-04,2022-11-04 00:01:00,2022-11-04 06:00:00
2022-11-07,2022-11-07 00:01:00,2022-11-07 06:00:00
2022-11-08,2022-11-08 00:01:00,2022-11-08 06:00:00
2022-11-09,2022-11-09 00:01:00,2022-11-09 06:00:00
2022-11-10,2022-11-10 00:01:00,2022-11-10 06:00:00
2022-11-11,2022-11-11 00:01:00,2022-11-11 06:00:00
2022-11-14,2022-11-14 00:01:00,2022-11-14 06:00:00
2022-11-15,2022-11-15 00:01:00,2022-11-15 06:00:00
2022-11-16,2022-11-16 00:01:00,2022-11-16 06:00:00
2022-11-17,2022-11-17 00:01:00,2022-11-17 06:00:00
2022-11-18,2022-11-18 00:01:00,2022-11-18 06:00:00
2022-11-21,2022-11-21 00:01:00,2022-11-21 06:00:00
2022-11-22,2022-11-22 00:01:00,2022-11-22 06:00:00
2022-11-24,2022-11-24 00:01:00,2022-11-24 06:00:00
2022-11-25,2022-11-25 00:01:00,2022-11-25 06:00:00
2022-11-28,2022-11-28 00:01:00,2022-11-28 06:00:00
2022-11-29,2022-11-29 00:01:00,2022-11-29 06:00:00
2022-11-30,2022-11-30 00:01:00,2022-11-30 06:00:00
2022-12-01,2022-12-01 00:01:00,2022-12-01 06:00:00
2022-12-02,2022-12-02 00:01:00,2022-12-02 06:00:00
2022-12-05,2022-12-05 00:01:00,2022-12-05 06:00:00
2022-12-06,2022-12-06 00:01:00,2022-12-06 06:00:00
2022-12-07,2022-12-07 00:01:00,2022-12-07 06:00:00
2022-12-08,2022-12-08 00:01:00,2022-12-08 06:00:00
2022-12-09,2022-12-09 00:01:00,2022-12-09 06:00:00
2022-12-12,2022-12-12 00:01:00,2022-12-12 06:00:00
2022-12-13,2022-12-13 00:01:00,2022-12-13 06:00:00
2022-12-14,2022-12-14 00:01:00,2022-12-14 06:00:00
2022-12-15,2022-12-15 00:01:00,2022-12-15 06:00:00
2022-12-16,2022-12-16 00:01:00,2022-12-16 06:00:00
2022-12-19,2022-12-19 00:01:00,2022-12-19 06:00:00
2022-12-20,2022-12-20 00:01:00,2022-12-20 06:00:00
2022-12-21,2022-12-21 00:01:00,2022-12-21 06:00:00
2022-12-22,2022-12-22 00:01:00,2022-12-22 06:00:00
2022-12-23,2022-12-23 00:01:00,2022-12-23 06:00:00
2022-12-26,2022-12-26 00:01:00,2022-12-26 06:00:00
2022-12-27,2022-12-27 00:01:00,2022-12-27 06:00:00
2022-12-28,2022-12-28 00:01:00,2022-12-28 06:00:00
2022-12-29,2022-12-29 00:01:00,2022-12-29 06:00:00
2022-12-30,2022-12-30 00:01:00,2022-12-30 06:00:00
26 changes: 26 additions & 0 deletions tests/test_xtks_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,29 @@ def test_2021(self):

for session_label in expected_holidays_2021:
self.assertNotIn(session_label, self.calendar.all_sessions)

def test_2022(self):
expected_holidays_2022 = [
pd.Timestamp("2022-01-01", tz="UTC"), # New Year's Day
pd.Timestamp("2022-01-02", tz="UTC"), # Market Holiday
pd.Timestamp("2022-01-03", tz="UTC"), # Market Holiday
pd.Timestamp("2022-01-10", tz="UTC"), # Coming of Age Day
pd.Timestamp("2022-02-11", tz="UTC"), # National Foundation Day
pd.Timestamp("2022-02-23", tz="UTC"), # Emperor's Birthday
pd.Timestamp("2022-03-21", tz="UTC"), # Vernal Equinox
pd.Timestamp("2022-04-29", tz="UTC"), # Showa Day
pd.Timestamp("2022-05-03", tz="UTC"), # Constitution Memorial Day
pd.Timestamp("2022-05-04", tz="UTC"), # Greenery Day
pd.Timestamp("2022-05-05", tz="UTC"), # Children's Day
pd.Timestamp("2022-07-18", tz="UTC"), # Marine Day
pd.Timestamp("2022-08-11", tz="UTC"), # Mountain Day
pd.Timestamp("2022-09-19", tz="UTC"), # Respect for the Aged Day
pd.Timestamp("2022-09-23", tz="UTC"), # Autumnal Equinox
pd.Timestamp("2022-10-10", tz="UTC"), # Sports Day
pd.Timestamp("2022-11-03", tz="UTC"), # Culture Day
pd.Timestamp("2022-11-23", tz="UTC"), # Labor Thanksgiving Day
pd.Timestamp("2022-12-31", tz="UTC"), # Market Holiday
]

for session_label in expected_holidays_2022:
self.assertNotIn(session_label, self.calendar.all_sessions)
2 changes: 2 additions & 0 deletions trading_calendars/xtks_holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def sunday_to_wednesday(dt):
Timestamp('2019-03-21'),
Timestamp('2020-03-20'),
Timestamp('2021-03-20'),
Timestamp('2022-03-21'),
]

# The Golden Week holidays (late April - early May) are listed in reverse
Expand Down Expand Up @@ -258,6 +259,7 @@ def sunday_to_wednesday(dt):
Timestamp('2019-09-23'),
Timestamp('2020-09-22'),
Timestamp('2021-09-23'),
Timestamp('2022-09-23'),
]

# If the Autumnal Equinox falls on a Wednesday, the Tuesday before
Expand Down

0 comments on commit 94e4a08

Please sign in to comment.