polygon-io / client-js

The official JS client library for the Polygon REST and WebSocket API.
MIT License
183 stars 56 forks source link

`options.snapshotOptionContract` and `reference.optionsContract` are not working, returning empty array. #193

Open Finalet opened 4 months ago

Finalet commented 4 months ago

The polygon.options.snapshotOptionContract always returns an empty array.

const polygonResults = await polygon.options.snapshotOptionContract('SPY', 'O:SPY240426C00517000');

// {
//   "results": [],
//   "status": "OK",
//   "request_id": "06deb361223937c365ebae0b41320f63",
//   "count": 0,
//   "next_url": null
// }

Expected behavior: polygonResults.results should be an object containing the snapshot of the option (docs)

Running this endpoint on the docs website works fine.

https://api.polygon.io/v3/snapshot/options/SPY/O:SPY240426C00517000?apiKey=API_KEY

// {
//   "results": {
//       "day": {
//           "change": 0.09,
//           "change_percent": 150,
//           ...
justinpolygon commented 4 months ago

Thanks for reporting @Finalet. Looking into this now.

Finalet commented 4 months ago

Same happens to the polygon.reference.optionsContract endpoint.

const polygonOption = await polygon.reference.optionsContract(`O:AMZN240426C00187500`);

// {
//   "results": [],
//   "status": "OK",
//   "request_id": "9a19fd532fb7b297eb8188c87b4d6529",
//   "count": 0,
//   "next_url": null
// }

Calling the endpoint directly and on the docs website works fine.

https://api.polygon.io/v3/reference/options/contracts/O:AMZN240426C00187500?apiKey=API_KEY

// {
//     "results": {
//         "cfi": "OCASPS",
//         "contract_type": "call",
//         "exercise_style": "american",
//          ...