Skip to content

Commit

Permalink
Merge pull request #207 from sjquant/master
Browse files Browse the repository at this point in the history
ENH: Add 2021 holidays to xkrx calendar
  • Loading branch information
gerrymanoim authored Jan 5, 2021
2 parents 875de03 + 9407809 commit 56a0427
Show file tree
Hide file tree
Showing 4 changed files with 266 additions and 6 deletions.
251 changes: 251 additions & 0 deletions tests/resources/xkrx.csv
Original file line number Diff line number Diff line change
Expand Up @@ -8628,3 +8628,254 @@
2020-12-28,2020-12-28 00:01:00,2020-12-28 06:30:00
2020-12-29,2020-12-29 00:01:00,2020-12-29 06:30:00
2020-12-30,2020-12-30 00:01:00,2020-12-30 06:30:00
2021-01-04,2021-01-04 00:01:00,2021-01-04 06:30:00
2021-01-05,2021-01-05 00:01:00,2021-01-05 06:30:00
2021-01-06,2021-01-06 00:01:00,2021-01-06 06:30:00
2021-01-07,2021-01-07 00:01:00,2021-01-07 06:30:00
2021-01-08,2021-01-08 00:01:00,2021-01-08 06:30:00
2021-01-11,2021-01-11 00:01:00,2021-01-11 06:30:00
2021-01-12,2021-01-12 00:01:00,2021-01-12 06:30:00
2021-01-13,2021-01-13 00:01:00,2021-01-13 06:30:00
2021-01-14,2021-01-14 00:01:00,2021-01-14 06:30:00
2021-01-15,2021-01-15 00:01:00,2021-01-15 06:30:00
2021-01-18,2021-01-18 00:01:00,2021-01-18 06:30:00
2021-01-19,2021-01-19 00:01:00,2021-01-19 06:30:00
2021-01-20,2021-01-20 00:01:00,2021-01-20 06:30:00
2021-01-21,2021-01-21 00:01:00,2021-01-21 06:30:00
2021-01-22,2021-01-22 00:01:00,2021-01-22 06:30:00
2021-01-25,2021-01-25 00:01:00,2021-01-25 06:30:00
2021-01-26,2021-01-26 00:01:00,2021-01-26 06:30:00
2021-01-27,2021-01-27 00:01:00,2021-01-27 06:30:00
2021-01-28,2021-01-28 00:01:00,2021-01-28 06:30:00
2021-01-29,2021-01-29 00:01:00,2021-01-29 06:30:00
2021-02-01,2021-02-01 00:01:00,2021-02-01 06:30:00
2021-02-02,2021-02-02 00:01:00,2021-02-02 06:30:00
2021-02-03,2021-02-03 00:01:00,2021-02-03 06:30:00
2021-02-04,2021-02-04 00:01:00,2021-02-04 06:30:00
2021-02-05,2021-02-05 00:01:00,2021-02-05 06:30:00
2021-02-08,2021-02-08 00:01:00,2021-02-08 06:30:00
2021-02-09,2021-02-09 00:01:00,2021-02-09 06:30:00
2021-02-10,2021-02-10 00:01:00,2021-02-10 06:30:00
2021-02-15,2021-02-15 00:01:00,2021-02-15 06:30:00
2021-02-16,2021-02-16 00:01:00,2021-02-16 06:30:00
2021-02-17,2021-02-17 00:01:00,2021-02-17 06:30:00
2021-02-18,2021-02-18 00:01:00,2021-02-18 06:30:00
2021-02-19,2021-02-19 00:01:00,2021-02-19 06:30:00
2021-02-22,2021-02-22 00:01:00,2021-02-22 06:30:00
2021-02-23,2021-02-23 00:01:00,2021-02-23 06:30:00
2021-02-24,2021-02-24 00:01:00,2021-02-24 06:30:00
2021-02-25,2021-02-25 00:01:00,2021-02-25 06:30:00
2021-02-26,2021-02-26 00:01:00,2021-02-26 06:30:00
2021-03-02,2021-03-02 00:01:00,2021-03-02 06:30:00
2021-03-03,2021-03-03 00:01:00,2021-03-03 06:30:00
2021-03-04,2021-03-04 00:01:00,2021-03-04 06:30:00
2021-03-05,2021-03-05 00:01:00,2021-03-05 06:30:00
2021-03-08,2021-03-08 00:01:00,2021-03-08 06:30:00
2021-03-09,2021-03-09 00:01:00,2021-03-09 06:30:00
2021-03-10,2021-03-10 00:01:00,2021-03-10 06:30:00
2021-03-11,2021-03-11 00:01:00,2021-03-11 06:30:00
2021-03-12,2021-03-12 00:01:00,2021-03-12 06:30:00
2021-03-15,2021-03-15 00:01:00,2021-03-15 06:30:00
2021-03-16,2021-03-16 00:01:00,2021-03-16 06:30:00
2021-03-17,2021-03-17 00:01:00,2021-03-17 06:30:00
2021-03-18,2021-03-18 00:01:00,2021-03-18 06:30:00
2021-03-19,2021-03-19 00:01:00,2021-03-19 06:30:00
2021-03-22,2021-03-22 00:01:00,2021-03-22 06:30:00
2021-03-23,2021-03-23 00:01:00,2021-03-23 06:30:00
2021-03-24,2021-03-24 00:01:00,2021-03-24 06:30:00
2021-03-25,2021-03-25 00:01:00,2021-03-25 06:30:00
2021-03-26,2021-03-26 00:01:00,2021-03-26 06:30:00
2021-03-29,2021-03-29 00:01:00,2021-03-29 06:30:00
2021-03-30,2021-03-30 00:01:00,2021-03-30 06:30:00
2021-03-31,2021-03-31 00:01:00,2021-03-31 06:30:00
2021-04-01,2021-04-01 00:01:00,2021-04-01 06:30:00
2021-04-02,2021-04-02 00:01:00,2021-04-02 06:30:00
2021-04-05,2021-04-05 00:01:00,2021-04-05 06:30:00
2021-04-06,2021-04-06 00:01:00,2021-04-06 06:30:00
2021-04-07,2021-04-07 00:01:00,2021-04-07 06:30:00
2021-04-08,2021-04-08 00:01:00,2021-04-08 06:30:00
2021-04-09,2021-04-09 00:01:00,2021-04-09 06:30:00
2021-04-12,2021-04-12 00:01:00,2021-04-12 06:30:00
2021-04-13,2021-04-13 00:01:00,2021-04-13 06:30:00
2021-04-14,2021-04-14 00:01:00,2021-04-14 06:30:00
2021-04-15,2021-04-15 00:01:00,2021-04-15 06:30:00
2021-04-16,2021-04-16 00:01:00,2021-04-16 06:30:00
2021-04-19,2021-04-19 00:01:00,2021-04-19 06:30:00
2021-04-20,2021-04-20 00:01:00,2021-04-20 06:30:00
2021-04-21,2021-04-21 00:01:00,2021-04-21 06:30:00
2021-04-22,2021-04-22 00:01:00,2021-04-22 06:30:00
2021-04-23,2021-04-23 00:01:00,2021-04-23 06:30:00
2021-04-26,2021-04-26 00:01:00,2021-04-26 06:30:00
2021-04-27,2021-04-27 00:01:00,2021-04-27 06:30:00
2021-04-28,2021-04-28 00:01:00,2021-04-28 06:30:00
2021-04-29,2021-04-29 00:01:00,2021-04-29 06:30:00
2021-04-30,2021-04-30 00:01:00,2021-04-30 06:30:00
2021-05-03,2021-05-03 00:01:00,2021-05-03 06:30:00
2021-05-04,2021-05-04 00:01:00,2021-05-04 06:30:00
2021-05-06,2021-05-06 00:01:00,2021-05-06 06:30:00
2021-05-07,2021-05-07 00:01:00,2021-05-07 06:30:00
2021-05-10,2021-05-10 00:01:00,2021-05-10 06:30:00
2021-05-11,2021-05-11 00:01:00,2021-05-11 06:30:00
2021-05-12,2021-05-12 00:01:00,2021-05-12 06:30:00
2021-05-13,2021-05-13 00:01:00,2021-05-13 06:30:00
2021-05-14,2021-05-14 00:01:00,2021-05-14 06:30:00
2021-05-17,2021-05-17 00:01:00,2021-05-17 06:30:00
2021-05-18,2021-05-18 00:01:00,2021-05-18 06:30:00
2021-05-20,2021-05-20 00:01:00,2021-05-20 06:30:00
2021-05-21,2021-05-21 00:01:00,2021-05-21 06:30:00
2021-05-24,2021-05-24 00:01:00,2021-05-24 06:30:00
2021-05-25,2021-05-25 00:01:00,2021-05-25 06:30:00
2021-05-26,2021-05-26 00:01:00,2021-05-26 06:30:00
2021-05-27,2021-05-27 00:01:00,2021-05-27 06:30:00
2021-05-28,2021-05-28 00:01:00,2021-05-28 06:30:00
2021-05-31,2021-05-31 00:01:00,2021-05-31 06:30:00
2021-06-01,2021-06-01 00:01:00,2021-06-01 06:30:00
2021-06-02,2021-06-02 00:01:00,2021-06-02 06:30:00
2021-06-03,2021-06-03 00:01:00,2021-06-03 06:30:00
2021-06-04,2021-06-04 00:01:00,2021-06-04 06:30:00
2021-06-07,2021-06-07 00:01:00,2021-06-07 06:30:00
2021-06-08,2021-06-08 00:01:00,2021-06-08 06:30:00
2021-06-09,2021-06-09 00:01:00,2021-06-09 06:30:00
2021-06-10,2021-06-10 00:01:00,2021-06-10 06:30:00
2021-06-11,2021-06-11 00:01:00,2021-06-11 06:30:00
2021-06-14,2021-06-14 00:01:00,2021-06-14 06:30:00
2021-06-15,2021-06-15 00:01:00,2021-06-15 06:30:00
2021-06-16,2021-06-16 00:01:00,2021-06-16 06:30:00
2021-06-17,2021-06-17 00:01:00,2021-06-17 06:30:00
2021-06-18,2021-06-18 00:01:00,2021-06-18 06:30:00
2021-06-21,2021-06-21 00:01:00,2021-06-21 06:30:00
2021-06-22,2021-06-22 00:01:00,2021-06-22 06:30:00
2021-06-23,2021-06-23 00:01:00,2021-06-23 06:30:00
2021-06-24,2021-06-24 00:01:00,2021-06-24 06:30:00
2021-06-25,2021-06-25 00:01:00,2021-06-25 06:30:00
2021-06-28,2021-06-28 00:01:00,2021-06-28 06:30:00
2021-06-29,2021-06-29 00:01:00,2021-06-29 06:30:00
2021-06-30,2021-06-30 00:01:00,2021-06-30 06:30:00
2021-07-01,2021-07-01 00:01:00,2021-07-01 06:30:00
2021-07-02,2021-07-02 00:01:00,2021-07-02 06:30:00
2021-07-05,2021-07-05 00:01:00,2021-07-05 06:30:00
2021-07-06,2021-07-06 00:01:00,2021-07-06 06:30:00
2021-07-07,2021-07-07 00:01:00,2021-07-07 06:30:00
2021-07-08,2021-07-08 00:01:00,2021-07-08 06:30:00
2021-07-09,2021-07-09 00:01:00,2021-07-09 06:30:00
2021-07-12,2021-07-12 00:01:00,2021-07-12 06:30:00
2021-07-13,2021-07-13 00:01:00,2021-07-13 06:30:00
2021-07-14,2021-07-14 00:01:00,2021-07-14 06:30:00
2021-07-15,2021-07-15 00:01:00,2021-07-15 06:30:00
2021-07-16,2021-07-16 00:01:00,2021-07-16 06:30:00
2021-07-19,2021-07-19 00:01:00,2021-07-19 06:30:00
2021-07-20,2021-07-20 00:01:00,2021-07-20 06:30:00
2021-07-21,2021-07-21 00:01:00,2021-07-21 06:30:00
2021-07-22,2021-07-22 00:01:00,2021-07-22 06:30:00
2021-07-23,2021-07-23 00:01:00,2021-07-23 06:30:00
2021-07-26,2021-07-26 00:01:00,2021-07-26 06:30:00
2021-07-27,2021-07-27 00:01:00,2021-07-27 06:30:00
2021-07-28,2021-07-28 00:01:00,2021-07-28 06:30:00
2021-07-29,2021-07-29 00:01:00,2021-07-29 06:30:00
2021-07-30,2021-07-30 00:01:00,2021-07-30 06:30:00
2021-08-02,2021-08-02 00:01:00,2021-08-02 06:30:00
2021-08-03,2021-08-03 00:01:00,2021-08-03 06:30:00
2021-08-04,2021-08-04 00:01:00,2021-08-04 06:30:00
2021-08-05,2021-08-05 00:01:00,2021-08-05 06:30:00
2021-08-06,2021-08-06 00:01:00,2021-08-06 06:30:00
2021-08-09,2021-08-09 00:01:00,2021-08-09 06:30:00
2021-08-10,2021-08-10 00:01:00,2021-08-10 06:30:00
2021-08-11,2021-08-11 00:01:00,2021-08-11 06:30:00
2021-08-12,2021-08-12 00:01:00,2021-08-12 06:30:00
2021-08-13,2021-08-13 00:01:00,2021-08-13 06:30:00
2021-08-16,2021-08-16 00:01:00,2021-08-16 06:30:00
2021-08-17,2021-08-17 00:01:00,2021-08-17 06:30:00
2021-08-18,2021-08-18 00:01:00,2021-08-18 06:30:00
2021-08-19,2021-08-19 00:01:00,2021-08-19 06:30:00
2021-08-20,2021-08-20 00:01:00,2021-08-20 06:30:00
2021-08-23,2021-08-23 00:01:00,2021-08-23 06:30:00
2021-08-24,2021-08-24 00:01:00,2021-08-24 06:30:00
2021-08-25,2021-08-25 00:01:00,2021-08-25 06:30:00
2021-08-26,2021-08-26 00:01:00,2021-08-26 06:30:00
2021-08-27,2021-08-27 00:01:00,2021-08-27 06:30:00
2021-08-30,2021-08-30 00:01:00,2021-08-30 06:30:00
2021-08-31,2021-08-31 00:01:00,2021-08-31 06:30:00
2021-09-01,2021-09-01 00:01:00,2021-09-01 06:30:00
2021-09-02,2021-09-02 00:01:00,2021-09-02 06:30:00
2021-09-03,2021-09-03 00:01:00,2021-09-03 06:30:00
2021-09-06,2021-09-06 00:01:00,2021-09-06 06:30:00
2021-09-07,2021-09-07 00:01:00,2021-09-07 06:30:00
2021-09-08,2021-09-08 00:01:00,2021-09-08 06:30:00
2021-09-09,2021-09-09 00:01:00,2021-09-09 06:30:00
2021-09-10,2021-09-10 00:01:00,2021-09-10 06:30:00
2021-09-13,2021-09-13 00:01:00,2021-09-13 06:30:00
2021-09-14,2021-09-14 00:01:00,2021-09-14 06:30:00
2021-09-15,2021-09-15 00:01:00,2021-09-15 06:30:00
2021-09-16,2021-09-16 00:01:00,2021-09-16 06:30:00
2021-09-17,2021-09-17 00:01:00,2021-09-17 06:30:00
2021-09-23,2021-09-23 00:01:00,2021-09-23 06:30:00
2021-09-24,2021-09-24 00:01:00,2021-09-24 06:30:00
2021-09-27,2021-09-27 00:01:00,2021-09-27 06:30:00
2021-09-28,2021-09-28 00:01:00,2021-09-28 06:30:00
2021-09-29,2021-09-29 00:01:00,2021-09-29 06:30:00
2021-09-30,2021-09-30 00:01:00,2021-09-30 06:30:00
2021-10-01,2021-10-01 00:01:00,2021-10-01 06:30:00
2021-10-04,2021-10-04 00:01:00,2021-10-04 06:30:00
2021-10-05,2021-10-05 00:01:00,2021-10-05 06:30:00
2021-10-06,2021-10-06 00:01:00,2021-10-06 06:30:00
2021-10-07,2021-10-07 00:01:00,2021-10-07 06:30:00
2021-10-08,2021-10-08 00:01:00,2021-10-08 06:30:00
2021-10-11,2021-10-11 00:01:00,2021-10-11 06:30:00
2021-10-12,2021-10-12 00:01:00,2021-10-12 06:30:00
2021-10-13,2021-10-13 00:01:00,2021-10-13 06:30:00
2021-10-14,2021-10-14 00:01:00,2021-10-14 06:30:00
2021-10-15,2021-10-15 00:01:00,2021-10-15 06:30:00
2021-10-18,2021-10-18 00:01:00,2021-10-18 06:30:00
2021-10-19,2021-10-19 00:01:00,2021-10-19 06:30:00
2021-10-20,2021-10-20 00:01:00,2021-10-20 06:30:00
2021-10-21,2021-10-21 00:01:00,2021-10-21 06:30:00
2021-10-22,2021-10-22 00:01:00,2021-10-22 06:30:00
2021-10-25,2021-10-25 00:01:00,2021-10-25 06:30:00
2021-10-26,2021-10-26 00:01:00,2021-10-26 06:30:00
2021-10-27,2021-10-27 00:01:00,2021-10-27 06:30:00
2021-10-28,2021-10-28 00:01:00,2021-10-28 06:30:00
2021-10-29,2021-10-29 00:01:00,2021-10-29 06:30:00
2021-11-01,2021-11-01 00:01:00,2021-11-01 06:30:00
2021-11-02,2021-11-02 00:01:00,2021-11-02 06:30:00
2021-11-03,2021-11-03 00:01:00,2021-11-03 06:30:00
2021-11-04,2021-11-04 00:01:00,2021-11-04 06:30:00
2021-11-05,2021-11-05 00:01:00,2021-11-05 06:30:00
2021-11-08,2021-11-08 00:01:00,2021-11-08 06:30:00
2021-11-09,2021-11-09 00:01:00,2021-11-09 06:30:00
2021-11-10,2021-11-10 00:01:00,2021-11-10 06:30:00
2021-11-11,2021-11-11 00:01:00,2021-11-11 06:30:00
2021-11-12,2021-11-12 00:01:00,2021-11-12 06:30:00
2021-11-15,2021-11-15 00:01:00,2021-11-15 06:30:00
2021-11-16,2021-11-16 00:01:00,2021-11-16 06:30:00
2021-11-17,2021-11-17 00:01:00,2021-11-17 06:30:00
2021-11-18,2021-11-18 00:01:00,2021-11-18 06:30:00
2021-11-19,2021-11-19 00:01:00,2021-11-19 06:30:00
2021-11-22,2021-11-22 00:01:00,2021-11-22 06:30:00
2021-11-23,2021-11-23 00:01:00,2021-11-23 06:30:00
2021-11-24,2021-11-24 00:01:00,2021-11-24 06:30:00
2021-11-25,2021-11-25 00:01:00,2021-11-25 06:30:00
2021-11-26,2021-11-26 00:01:00,2021-11-26 06:30:00
2021-11-29,2021-11-29 00:01:00,2021-11-29 06:30:00
2021-11-30,2021-11-30 00:01:00,2021-11-30 06:30:00
2021-12-01,2021-12-01 00:01:00,2021-12-01 06:30:00
2021-12-02,2021-12-02 00:01:00,2021-12-02 06:30:00
2021-12-03,2021-12-03 00:01:00,2021-12-03 06:30:00
2021-12-06,2021-12-06 00:01:00,2021-12-06 06:30:00
2021-12-07,2021-12-07 00:01:00,2021-12-07 06:30:00
2021-12-08,2021-12-08 00:01:00,2021-12-08 06:30:00
2021-12-09,2021-12-09 00:01:00,2021-12-09 06:30:00
2021-12-10,2021-12-10 00:01:00,2021-12-10 06:30:00
2021-12-13,2021-12-13 00:01:00,2021-12-13 06:30:00
2021-12-14,2021-12-14 00:01:00,2021-12-14 06:30:00
2021-12-15,2021-12-15 00:01:00,2021-12-15 06:30:00
2021-12-16,2021-12-16 00:01:00,2021-12-16 06:30:00
2021-12-17,2021-12-17 00:01:00,2021-12-17 06:30:00
2021-12-20,2021-12-20 00:01:00,2021-12-20 06:30:00
2021-12-21,2021-12-21 00:01:00,2021-12-21 06:30:00
2021-12-22,2021-12-22 00:01:00,2021-12-22 06:30:00
2021-12-23,2021-12-23 00:01:00,2021-12-23 06:30:00
2021-12-24,2021-12-24 00:01:00,2021-12-24 06:30:00
2021-12-27,2021-12-27 00:01:00,2021-12-27 06:30:00
2021-12-28,2021-12-28 00:01:00,2021-12-28 06:30:00
2021-12-29,2021-12-29 00:01:00,2021-12-29 06:30:00
2021-12-30,2021-12-30 00:01:00,2021-12-30 06:30:00
8 changes: 4 additions & 4 deletions tests/test_xkrx_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_normal_year(self):
self.assertNotIn(session_label, self.calendar.all_sessions)

def test_constrain_construction_dates(self):
# the XKRX calendar currently goes from 1986 to 2020, inclusive.
# the XKRX calendar currently goes from 1986 to 2021, inclusive.
with self.assertRaises(ValueError) as e:
self.calendar_class(T('1985-12-31'), T('2005-01-01'))

Expand All @@ -53,13 +53,13 @@ def test_constrain_construction_dates(self):
)

with self.assertRaises(ValueError) as e:
self.calendar_class(T('2005-01-01'), T('2021-01-01'))
self.calendar_class(T('2005-01-01'), T('2022-01-03'))

self.assertEqual(
str(e.exception),
(
'The XKRX holidays are only recorded to 2020,'
' cannot instantiate the XKRX calendar for 2021.'
'The XKRX holidays are only recorded to 2021,'
' cannot instantiate the XKRX calendar for 2022.'
)
)

Expand Down
12 changes: 11 additions & 1 deletion trading_calendars/exchange_calendar_xkrx.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,17 @@
"2020-10-02",
"2020-10-09",
"2020-12-25",
"2020-12-31"
"2020-12-31",
"2021-01-01",
"2021-02-11",
"2021-02-12",
"2021-03-01",
"2021-05-05",
"2021-05-19",
"2021-09-20",
"2021-09-21",
"2021-09-22",
"2021-12-31",
])


Expand Down
1 change: 0 additions & 1 deletion trading_calendars/precomputed_trading_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def __init__(self, start=None, end=None):
end = pd.Timestamp(
'{}-12-31'.format(latest_precomputed_year), tz=UTC
)

super(PrecomputedTradingCalendar, self).__init__(start=start, end=end)

if earliest_precomputed_year > self.first_trading_session.year:
Expand Down

0 comments on commit 56a0427

Please sign in to comment.