How to detect whether the a future market is open or not?

Is it possible to detect whether the market is open or closed with the Tradovate API? If it is not possible, does anyone have any suggestions? For example, on Saturday and Sunday, the market is closed, and I want to get a signal at the exact time when the market is closed.

You don’t really need the API for this, just use a library to fetch the time and limit your solution from executing during Saturday and Sunday. Make sure that the time that you’re requesting aligns with the exchange’s timezone.

Something like:
if (request.day(‘EST’) == Saturday || request.day(‘EST’) == Sunday) { do not trade }
else { trade }

I’m sure you could find better examples on stackoverflow.
Also, confirm that the library you’re using is trusted.

I can use the “America/New_York” time in 17:00 week 1~5 ,but if there has some other reason for the market is closed,like holiday.

There is a currently undocumented endpoint that we’ve recently made publicly available that can get you info about a product’s open hours. However I don’t believe that this accounts for holidays. It will give you accurate margin data and general open and close times.

//for all available products
'https://live.tradovateapi.com/markets/products?text='

//for a single product
'https://live.tradovateapi.com/markets/getproduct?id=ES'

For holidays, you’ll have to code around the schedule, this is for 2022:
http://investor.cmegroup.com/static-files/1047cbcc-7569-40ab-bb6b-6973eea07ea3

The other option is, try to trade every day and catch the failures gracefully. I’m pretty sure that orders sent during closed hours respond with an error message that says you can’t trade during market closed hours. If you get that response during what would regularly be open hours, you can assume the markets are closed for a holiday that day.

thanks for your reply.
but I call the two endpoint with postman after get access token and replay auth token,it is block and has not response,
change endpoint to GET http://live.tradovateapi.com/markets/getproduct?id=ES
get 404 response

That’s actually an expected caveat of these particular endpoints (notice they aren’t the normal prefix, the /v1 is missing). You actually don’t (and can’t) use the accessToken to make these calls. You should include no Authorization header in your request. These endpoints are undocumented and were not originally intended for client consumption, however we have relaxed that situation slightly for these particularly useful endpoints.