Skip to content

BUG: reference.marketStatus() works in 7.4.0 but getMarketStatus() returns 'undefined' or throws HTTP status code 429 in 8.0.0 #234

@ManfredLange

Description

@ManfredLange

I have the following code using version 7.4.0 which has been working fine since I started to use polygon.io a few months ago:

      const polygon = restClient(environment.polygonApiKey);
      const marketStatus = await polygon.reference.marketStatus();

I have wrapped this inside an if block so that this is executed not more than once per minute in order to avoid exceeding my quota (HTTP status 429). My code caches the result in a file. Unless the serverTime value in that file is older than 1 minute, my code will return the cached value read from that local file.

Here is the equivalent code using version 8.0.0, which runs into the 429 issue:

      const polygon = restClient(environment.polygonApiKey);
      const marketStatus: GetMarketStatus200Response = await polygon.getMarketStatus();

It appears as if the data structure that is return is identical between the two versions:

{
   "afterHours": false,
   "currencies": {
      "crypto": "open",
      "fx": "open"
   },
   "earlyHours": true,
   "exchanges": {
      "nasdaq": "extended-hours",
      "nyse": "extended-hours",
      "otc": "closed"
   },
   "indicesGroups": {
      "s_and_p": "open",
      "societe_generale": "open",
      "msci": "closed",
      "ftse_russell": "closed",
      "mstar": "open",
      "mstarc": "open",
      "cccy": "open",
      "cgi": "open",
      "nasdaq": "open",
      "dow_jones": "closed"
   },
   "market": "extended-hours",
   "serverTime": "2025-07-22T04:36:07-04:00"
}

However, with version 7.4.0 everything is fine. Using version 8.0.0 very quickl the call to getMarketStatus() returns undefined and within perhaps a half dozen calls or so an AxiosError is thrown with status 429 and error message You've exceeded the maximum requests per minute, please wait or upgrade your subscription to continue. https://polygon.io/pricing.

I am on the free plan, so making one call per minute for getting the market status should continue to work and not be dependent on the version of the client library. Since it works with version 7.4.0 but not with version 8.0.0, I believe this to be a bug in version 8.0.0.

As a short-term solution I will downgrade to version 7.4.0.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions