I am writing a stock market-related app, and would like to include an indicator of whether the stock market (NYSE) is currently open/closed. The Apple "Stocks" app on the iPhone includes this information. I figure the Stocks app is testing something from Yahoo since the quotes are from there and they link to Yahoo finance directly. However, for all my searching around both YQL, StackOverflow, and the web I can't find a direct query.

+1: no need for overkill. if NYSE market is closed when it shouldn't be your customers will hear of it on TV news :)
–
rokjarcFeb 24 '12 at 12:43

1

+1 for the suggestion, but this isn't really the answer I'm hoping for. I think there must be a programmatic way - if not a direct query, then at least checking the current quote of a heavily traded stock and seeing if it is within the last X minutes or something like that. Using a hardcoded table means also hooking up to a web service of some kind to keep it updated for future years, with in-app updates. I'd love to know what Apple's own Stocks app does. Thanks.
–
Damien Del RussoFeb 24 '12 at 16:00

1

Sorry @DamienDelRusso, I dont know of another way but I would suggest not to over engineer, where a simple hack would work. If you go to the NYSE website, it provides a schedule for the next 3 years corporate.nyx.com/en/holidays-and-hours/nyse?sa_campaign=/…. In my experience, originations like the NYSE, follow a very strict schedule. The last time I can remember it did not follow its own schedule was 9/11, when it closed for 4 sessions.
–
alykhalidFeb 24 '12 at 18:34

Look for the <status> element. If the value is 0, the NYSE is closed, otherwise the NYSE is open.

Details

Apple provides a service, which the MacOS Stocks Dashboard widget uses to determine if the markets are open or close (presumably the iPhone app uses it as well). This service is undocumented, as far as I know, but this answer attempts to document information pertinent to your question.

The service is really for obtaining stock quote information, but in the response, there is a status property, which seems to correspond to if the market that the stock is traded in is open or close. To make a call, post the following XML to it:

Since you stated that you are interested in NYSE, you'd post the symbol for a company like GE (which is traded on the NYSE, as in my example above). If you are interested in, say, NASDAQ, you'd post a NASDAQ-traded company (e.g., AAPL).