how could we detect holidays by code?

 

Hi there,
Hope you are having a nice day

How can we detect future holidays by code? Should I do this by just hardcoding or is there any way to automate it for history data holidays?

Your advice is greatly appreciated!

 
HosseinKOGO: How can we detect future holidays by code?
  1. Depends on the market and the broker.
  2. Why do you care? When you receive a tick, the market is open.
 
William Roeder #:
  1. Depends on the market and the broker.
  2. Why do you care? When you receive a tick, the market is open.
I care because I want to close my orders before market close time. In usual weeks, I close my orders at Friday 23:00 NYT. But I see my EA does not close orders when Friday is market holiday or closes before 23:00.