How can I retreive stock price in simplest way possible?

With Polygon.io, a competitor to Alpaca, I can place a simple API request from a URL.

The only information I need is stock price. Installing the alpaca packages seems like overkill.

Here is the entire string I use to access the polygon api:
const tempURL = https://api.polygon.io/v3/snapshot/options/+ SYM +?strike_price=+ strikePrice +&expiration_date=+ dateToday_api +&apiKey=+ APIKEY;

When copied into Browser address bar, this returns my JSON data.

I then use axios, a node.js package, to make the call to the API.

How would I build a URL to continue making the request with my preferred package?
To rephrase, where do I find the URL to enter into address bar to make a request?

Thanks!

@sethschaffner While Alpaca data requests can be made as simply as requests in Polygon, there is one subtle difference. Notice the Polygon API key is part of the query parameters (ie it’s in the URL after the “?”). That can be entered easily into a browser. Alpaca however requires the API keys to be passed in the header portion of the request. There isn’t a direct way to modify the header information in most browsers (though there are some extensions or developer tools which can be used).

One can make API calls directly from node.js with the correct URL and header (ie API key) data. Take a look at the docs to see how to format the request.

1 Like