Easy Stock Market Quotes with marketstack (Sponsored)
Publikováno: 12.7.2020
The stock market is wild right now, at least in the United States. Between pandemic, political events, and everything else going on, the stock market is one swing after another. There are a host of services that give you stock quotes but I don’t trust them; I feel like they delay information, good or bad, […]
The post Easy Stock Market Quotes with marketstack (Sponsored) appeared first on David Walsh Blog.
The stock market is wild right now, at least in the United States. Between pandemic, political events, and everything else going on, the stock market is one swing after another. There are a host of services that give you stock quotes but I don’t trust them; I feel like they delay information, good or bad, so they can get their transactions first. That’s why I created my own price alert system, and to do so, I used marketstack!
Quick Hits
- Free to join!
- Provides real-time, history, and end of day quotes
- Covers 72 major exchanges around the globe (NYSE, NASDAQ, DAX, etc.)
- Trusted by Garmin, Revolut, Uber, Amazon, and more
- Documentation provides code samples in PHP, Node.js, Python, and more
After joining marketstack, you can start hitting the marketstack API with your stock quote requests. A basic request is as easy as:
# Single stock curl http://api.marketstack.com/v1/eod ?access_key=MY_API_KEY &symbols=MEIP # Multiple stocks curl http://api.marketstack.com/v1/eod ?access_key=MY_API_KEY &symbols=FB,AAPL,TWTR
As with every endpoint, you get very detailed results:
{ "pagination":{ "limit":1, "offset":0, "count":1, "total":28 }, "data":[ { "open":3.42, "high":3.44, "low":3.29, "close":3.32, "volume":1236100.0, "adj_high":3.44, "adj_low":3.29, "adj_close":3.32, "adj_open":3.42, "adj_volume":1236100.0, "symbol":"MEIP", "exchange":"XNAS", "date":"2020-07-10T00:00:00+0000" } ] }
If I’m looking for by-the-minute quotes, I can grab intra-day results or even real time quotes with the interval
parameter:
# Intra-day curl http://api.marketstack.com/v1/intraday ?access_key=MY_API_KEY &symbols=MEIP # Real-time curl http://api.marketstack.com/v1/intraday ?access_key=MY_API_KEY &symbols=MEIP &interval=1min
I’ve used the historical data API to create my own charts:
# Historical # Buy date to today, so I can calculate loss or profit curl http://api.marketstack.com/v1/intraday ?access_key=MY_API_KEY &symbols=MEIP &date_from=2019-01-01 &date_to=2019-02-01
marketstack also features JSONP support, ticker information, and much more! I really enjoyed using marketstack and the wealth of information it provided for my important use cases. If you need to present stock and financial information on your website, marketstack might be your best bet!
The post Easy Stock Market Quotes with marketstack (Sponsored) appeared first on David Walsh Blog.