I'm trying to request hour information from the TD Ameritrade API. Is there any way I could get the hours for the New York Stock Exchange?
Here is the link to the API: https://developer.tdameritrade.com/
I'm trying to request hour information from the TD Ameritrade API. Is there any way I could get the hours for the New York Stock Exchange?
Here is the link to the API: https://developer.tdameritrade.com/
There is a widget and JSON feed on https://www.isthemarketopen.com/ - It's an atomic clock for the U.S. Stock Market
Here is the code to simply embed their widget:
<iframe src="https://www.isthemarketopen.com/widget/#/" width="565" height="200" frameBorder="0">Browser not compatible.</iframe>
Here is their JSON feed
https://www.isthemarketopen.com/static/markets.json
TD Ameritrade's API provides an endpoint for market hours however you can't specify which exchange to check, only which market (BOND, EQUITY, ETF etc..).
For some reason, it allows you to specify which date but it only accepts the current date. Providing an access token doesn't do anything so I won't be including a header with the token in my example.
According to their site, most of NYSE is open 06:30 - 20:00 EST, it might be easier to just check if the current time is within that timeframe and if the current day is not a holiday.