Message Boards Message Boards

0
|
2673 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Can I create a custom HolidayCalendar

Posted 1 year ago

Hello,

I was exploring the accuracy of Mathematica's TimeSeriesResample[ ] function trying to transform 15 min financial time series into daily "BusinessDay" data time series.

Dealing with french stock data, I use this command :

tsr = TimeSeriesResample[ts, "BusinessDay", HolidayCalendar -> "France"]

Sadly, it seems that the french HolidayCalendar used by Mathematica may not be accurate.

Indeed, Euronext official Calendar of business days 2022 (https://www.euronext.com/en/trade/trading-hours-holidays) gives Friday 15 April 2022 and Monday 18 April 2022 as closed trading days. As such, my 15 min source time series "ts" doesn't contain any values nor timestamps for those dates, iterating from 14 April 2022 straight to 19 April 2022.

But "tsr" has those dates, creating interpolated values.

Is this behaviour normal ? Isn't the whole point of using "BusinessDay" specification to suppress datapoints from time series when market is closed ?

Going forward, I did read the official documentation for HolidayCalendar (https://reference.wolfram.com/language/ref/HolidayCalendar.html) which says that we can define a custom holiday schedule under the Scope section.

Does that mean that I can use a list of closed market dates of my creation and feed that list as argument in TimeSeriesResample function ? I did read the documentation's examples, but couldn't find a way to make it work at all.

Thank you in advance for any help you can give me.

Cheers.

POSTED BY: Clarisse Wagner
2 Replies

Thank your for your insights.

Also, it's worth mentioning that when we use FinancialData function for french stocks, at least 10% of resulting time series dates are wrong :

  • some Euronext official quoting dates are skipped,
  • some official Euronext holidays are listed in the time series,
  • also, there is not always consistency between dates of quotation between tickers of the same country.

For example :

firstTwoWeeksOfEuronextParis={{2022, 1, 3, 0, 0, 0.}, {2022, 1, 4, 0, 0, 0.}, {2022, 1, 5, 0, 0, 
  0.}, {2022, 1, 6, 0, 0, 0.}, {2022, 1, 7, 0, 0, 0.}, {2022, 1, 10, 
  0, 0, 0.}, {2022, 1, 11, 0, 0, 0.}, {2022, 1, 12, 0, 0, 0.}, {2022, 
  1, 13, 0, 0, 0.}, {2022, 1, 14, 0, 0, 0.}}
financialDataAC=Map[DateList, Map[DateObject[#, "Day"] &, FinancialData["PA:AC", "Close", {{2022, 1, 1}, {2022, 1, 14}}]["Dates"]]]
financialDataMC=Map[DateList, Map[DateObject[#, "Day"] &, FinancialData["PA:MC", "Close", {{2022, 1, 1}, {2022, 1, 14}}]["Dates"]]]

firstTwoWeeksOfEuronextParis are the official days of Euronext Paris, when trading occurs. financialDataAC is a call of EURONEXT:ACCOR and financialDataMC is a call of EURONEXT:LVMH.

In financialDataAC result, 22/01/10 and 22/01/11 are missing dates and values.

In financialDataMC result, only 22/01/10 dates and values are missing.

FinancialData can't be trusted on french equities, and maybe anything that isn't US equities related data.

I'll report to Wolfram Support.

POSTED BY: Clarisse Wagner

Hi Clarisse,

This looks like a bug to me. The Euronext calendar is supposedly the default

CalendarData["France"]
(* {"Euronext"} *)

However, as you discovered, the 15th and 18th of April are not identified as holidays

DayRange[{2022, 4, 13}, {2022, 4, 19},
 "BusinessDay",
 HolidayCalendar -> {"France", "Euronext"}]

They can be explicitly set to a holiday

DayRange[{2022, 4, 13}, {2022, 4, 19},
 "BusinessDay",
 HolidayCalendar -> {"Gregorian" -> {{True &, # == 4 &, # == 15 || # == 18 &}}}]

It seems like there is no way to inherit the Euronext calendar and add this filter, so the above will not include other Euronext holidays. You will have to manually extract them from your date range of interest and add them to the filter function.

From the documentation for HolidayCalendar

The basic unit of a holiday schedule is a holiday criterion, a three-element list of tests in the form of pure functions that are to be applied to the year, month, and day of a given calendar, respectively. A date is a holiday if all three tests return true when applied to it

You should report this bug to Wolfram Support.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract