1. Code

Real-Time Stock Market Data With the marketstack API

Scroll to top
Read Time: 5 min

To make sound financial decisions, you need a reliable, up-to-the-minute source of real-time stock market data. 

You want the same source of data used by Microsoft, Amazon, Credit Suisse, and Uber.

The good news is you don't have to be a major player to have this data in real time. 

Whether you're an individual, small business, financial advisor, or developer, the marketstack API gives you access to real-time, intraday, and historical stock data from 72 global stock exchanges, including Nasdaq, the New York Stock Exchange, and the London Stock Exchange. 

You too can now deliver real-time, intraday, historical stock, or end-of-day market data to your website and to your clients and create satisfying user experiences. 

It's simple and cost-effective: let me introduce you to marketstack. 

What Is the marketstack API?

marketstack APImarketstack APImarketstack API

marketstack is a popular, easy-to-use REST API interface that delivers real-time, intraday, and historical stock market data.          

The API is powered by cutting-edge technology and a scalable cloud infrastructure capable of handling several million API requests per hour with ease. 

You can search from 125,000+ worldwide stock tickers, collected from 72 global exchanges, including Nasdaq and the NYSE.

Using the marketstack REST API, you will be able to obtain end-of-day and intraday data, as well as historical market data for the last 30 years.

With the marketstack API, you can:

  • query for real-time, intraday, and historical stock market data
  • define multiple stock symbols
  • retrieve extensive data from about 72+ stock exchanges
  • access 125,000+ stock tickers from more than 50 countries
  • retrieve information on time zones, currencies, and more

Why Use the marketstack API?

It Uses JSON

marketstack uses the lightweight JSON format, and HTTP GET for all the requests. API queries are easy to create and to interpret.

Integration With Multiple Languages

The API integrates with widely used programming languages and platforms: PHP, Python, jQuery, Node, Go, and Ruby.               


The marketstack API can scale with your information and data demands. It can easily handle spikes and increases in your daily queries. 

Bank-Grade Security

Client data is protected by a layer of heavy security. Each bit and byte sent to and from the marketstack API is encrypted using industry-standard 256-bit HTTPS encryption.

Reliable Information Sources 

Stock market data provided by the marketstack API is licensed and sourced from multiple high-authority market data providers around the world. 

Proof in Numbers 

Trusted by 30,000 companies and 75 universities. 


The marketstack API comes with extensive and detailed documentation. 

How It Works

The marketstack API is built upon a RESTful and easy-to-understand request and response structure. 

  1. API requests are always sent in the URL string with a series of required and optional HTTP GET parameters.
  2. API responses are provided in lightweight JSON format.

Quick Tutorial

Here is an example of the information returned from a marketstack API query.

marketstack API query resultmarketstack API query resultmarketstack API query result

It's very easy to get set up and start using marketstack. This short tutorial will show you how. 

To get started, first sign up for a free account at marketstack. Once you've registered, you'll be taken to the marketstack API quick start screen. From here, you can get your API key and try some example API queries.    

API endpointsAPI endpointsAPI endpoints

Now you can perform a request. Using your API key and the example queries shown in the quick start guide, you can look up stock prices and other information. For example, let's perform a single request for Apple stock.

The quick start guide shows the following format for the query.

Make API Request formatMake API Request formatMake API Request format

Click the example to try the request, or enter it into your address bar: 

Be sure to copy your access key into this URL to try it. If your API request was successful, the marketstack API will return pagination information as well as a data object, which contains a separate sub-object for each requested date/time and symbol. 

pagination information and data objectpagination information and data objectpagination information and data object

Note that requests you make on the free plan are not encrypted, so you must use the HTTP protocol for free requests. If you try to use HTTPS, you will get the message that "Your current subscription plan does not support HTTPS encryption". If HTTPS is important to you, then you'll need to go with a paid plan.

You can learn more from the official marketstack documentation, including code examples for JavaScript, PHP, Python, and more. 


marketstack subscription optionsmarketstack subscription optionsmarketstack subscription options

marketstack has several market data subscription plans. 

Free: You get 1,000 data requests per month without paying anything. This applies for all supported stock tickers and exchanges. It does not offer intraday data, and you are restricted to one year of historical data. No credit card is needed to register. 

Who is this plan best for? It's best for beginners wanting to test the waters and see how marketstack works. 

Basic: gets you 10,000 requests per month, support for intraday data, access to ten-year historical data, HTTPS encryption, a commercial license, and more. At the time of writing, this plan is $9.99 per month, or $7.99 if billed yearly. 

Who is this plan best for? For those who have seen how marketstack works and want to get serious using it. 

Professional (Most Popular): With this plan, you get real-time updates, full historical data, up to 100,000 requests per month, and technical support. 

Business: This plan gives you all the tools you will ever need, for up to 500,000 monthly requests, real-time updates, and direct support.  

Enterprise: If none of the other plans are adequate, you can get custom pricing that is tailored to your needs. 


marketstack is trusted by 30,000 companies and 75 universities. This is a big mark of approval. The interfaces for requests and responses are easy to use, and there is detailed documentation that explains all the API parameters.

Try it out today with a free API key!

Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.