3-Step Quickstart Guide

Need to get started using the API in under 1 minute? Click the button below to jump right to our interactive 3-Step Quickstart Guide.

Code Examples

To get you up and running even quicker, there are code examples in various programming languages sitting there waiting for you.

Code Examples

API Documentation

Welcome to the marketstack API documentation! In the following series of articles you will learn how to query the marketstack JSON API for real-time, intraday and historical stock market data, define multiple stock symbols, retrieve extensive data about 72+ stock exchanges, 125.000+ stock tickers from more than 50 countries, as well as information about timezones, currencies, and more.

Our API is built upon a RESTful and easy-to-understand request and response structure. API requests are always sent using a simple API request URL with a series of required and optional HTTP GET parameters, and API responses are provided in lightweight JSON format. Continue below to get started, or click the blue button above to jump to our 3-Step Quickstart Guide.

Getting Started

API Authentication

For every API request you make, you will need to make sure to be authenticated with the API by passing your API access key to the API's access_key parameter. You can find an example below.

Example API Request:

https://api.marketstack.com/v1/eod
    ? access_key = YOUR_ACCESS_KEY
    & symbols = AAPL

Important: Please make sure not to expose your API access key publicly. If you believe your API access key may be compromised, you can always reset in your account dashboard.

256-bit HTTPS Encryption Available on: Basic Plan and higher

If you are subscribed to the Basic Plan or higher, you will be able to access the marketstack API using industry-standard HTTPS. To do that, simply use the https protocol when making API requests.

Example API Request:

https://api.marketstack.com/v1

Are you a Free Plan user and looking to connect via HTTPS? You will need to upgrade your account to the Basic Plan.

API Errors

API errors consist of error code and message response objects. If an error occurs, the marketstack will also return HTTP status codes, such as 404 for "not found" errors. If your API request succeeds, status code 200 will be sent.

For validation errors, the marketstack API will also provide a context response object returning additional information about the error that occurred in the form of one or multiple sub-objects, each equipped with the name of the affected parameter as well as key and message objects. You can find an example error below.

Example Error:

{
   "error": {
      "code": "validation_error",
      "message": "Request failed with validation error",
      "context": {
         "symbols": [
            {
               "key": "missing_symbols",
               "message": "You did not specify any symbols."
            }
         ]
      }
   }
}        

Common API Errors:

Code Type Description
401 invalid_access_key An invalid API access key was supplied.
401 missing_access_key No API access key was supplied.
401 inactive_user The given user account is inactive.
403 https_access_restricted HTTPS access is not supported on the current subscription plan.
403 function_access_restricted The given API endpoint is not supported on the current subscription plan.
404 invalid_api_function The given API endpoint does not exist.
404 404_not_found Resource not found.
429 usage_limit_reached The given user account has reached its monthly allowed request volume.
429 rate_limit_reached The given user account has reached the rate limit.
500 internal_error An internal error occurred.

API Features

End-of-Day Data Available on: All plans

You can use the API's eod endpoint in order to obtain end-of-day data for one or multiple stock tickers. A single or multiple comma-separated ticker symbols are passed to the API using the symbols parameter.

Note: To request end-of-day data for single ticker symbols, you can also use the API's Tickers Endpoint.

Example API Request:

https://api.marketstack.com/v1/eod ? access_key = YOUR_ACCESS_KEY & symbols = AAPL

Endpoint Features:

Object Description
/eod/[date] Specify a date in YYYY-MM-DD format. You can also specify an exact time in ISO-8601 date format, e.g. 2020-05-21T00:00:00+0000. Example: /eod/2020-01-01
/eod/latest Obtain the latest available end-of-day data for one or multiple stock tickers.

HTTP GET Request Parameters:

Object Description
access_key [Required] Specify your API access key, available in your account dashboard.
symbols [Required] Specify one or multiple comma-separated stock symbols (tickers) for your request, e.g. AAPL or AAPL,MSFT. Each symbol consumes one API request. Maximum: 100 symbols
exchange [Optional] Filter your results based on a specific stock exchange by specifying the MIC identification of a stock exchange. Example: XNAS
sort [Optional] By default, results are sorted by date/time descending. Use this parameter to specify a sorting order. Available values: DESC (Default), ASC.
date_from [Optional] Filter results based on a specific timeframe by passing a from-date in YYYY-MM-DD format. You can also specify an exact time in ISO-8601 date format, e.g. 2020-05-21T00:00:00+0000.
date_to [Optional] Filter results based on a specific timeframe by passing an end-date in YYYY-MM-DD format. You can also specify an exact time in ISO-8601 date format, e.g. 2020-05-21T00:00:00+0000.
limit [Optional] Specify a pagination limit (number of results per page) for your API request. Default limit value is 100, maximum allowed limit value is 1000.
offset [Optional] Specify a pagination offset value for your API request. Example: An offset value of 100 combined with a limit value of 10 would show results 100-110. Default value is 0, starting with the first available result.

Example API Response:

If your API request was successful, the marketstack API will return both pagination information as well as a data object, which contains a separate sub-object for each requested date/time and symbol. All response objects are explained below.

{
    "pagination": {
        "limit": 100,
        "offset": 0,
        "count": 100,
        "total": 9944
    },
    "data": [
        {
            "date": "2020-05-21T00:00:00+0000",
            "symbol": "AAPL",
            "exchange": "XNAS",
            "open": 318.66,
            "high": 320.89,
            "low": 315.87,
            "close": 316.85,
            "volume": 25672211.0,
            "adj_open": 318.66,
            "adj_high": 320.89,
            "adj_low": 315.87,
            "adj_close": 316.85,
            "adj_volume": 25672211.0
        },
        [...]
    ]
}

API Response Objects:

Response Object Description
pagination > limit Returns your pagination limit value.
pagination > offset Returns your pagination offset value.
pagination > count Returns the results count on the current page.
pagination > total Returns the total count of results available.
date Returns the exact UTC date/time the given data was collected in ISO-8601 format.
symbol Returns the stock ticker symbol of the current data object.
exchange Returns the exchange MIC identification associated with the current data object.
open Returns the raw opening price of the given stock ticker.
high Returns the raw high price of the given stock ticker.
low Returns the raw low price of the given stock ticker.
close Returns the raw closing price of the given stock ticker.
volume Returns the raw volume of the given stock ticker.
adj_open Returns the adjusted opening price of the given stock ticker.
adj_high Returns the adjusted high price of the given stock ticker.
adj_low Returns the adjusted low price of the given stock ticker.
adj_close Returns the adjusted closing price of the given stock ticker.
adj_volume Returns the adjusted volume of given stock ticker.

Adjusted Prices: "Adjusted" prices are stock price values that were amended to accurately reflect the given stock's value after accounting for any corporate actions, such as splits or dividends. Adjustments are made in accordance with the "CRSP Calculations" methodology set forth by the Center for Research in Security Prices (CRSP).

Intraday Data Available on: Basic Plan and higher

In additional to daily end-of-day stock prices, the marketstack API also supports intraday data with data intervals as short as one minute. Intraday prices are available for all US stock tickers included in the IEX (Investors Exchange) stock exchange.

To obtain intraday data, you can use the API's intraday endpoint and specify your preferred stock ticker symbols.

Note: To request intraday data for single ticker symbols, you can also use the API's Tickers Endpoint.

Example API Request:

https://api.marketstack.com/v1/intraday ? access_key = YOUR_ACCESS_KEY & symbols = AAPL

Endpoint Features:

Object Description
/intraday/[date] Specify a date in YYYY-MM-DD format. You can also specify an exact time in ISO-8601 date format, e.g. 2020-05-21T00:00:00+0000. Example: /intraday/2020-01-01
/intraday/latest Obtain the latest available intraday data for one or multiple stock tickers.

HTTP GET Request Parameters:

Object Description
access_key [Required] Specify your API access key, available in your account dashboard.
symbols [Required] Specify one or multiple comma-separated stock symbols (tickers) for your request, e.g. AAPL or AAPL,MSFT. Each symbol consumes one API request. Maximum: 100 symbols
exchange [Optional] Filter your results based on a specific stock exchange by specifying the MIC identification of a stock exchange. Example: IEXG
interval [Optional] Specify your preferred data interval. Available values: 1min, 5min, 10min, 15min, 30min, 1hour (Default), 3hour, 6hour, 12hour and 24hour.
sort [Optional] By default, results are sorted by date/time descending. Use this parameter to specify a sorting order. Available values: DESC (Default), ASC.
date_from [Optional] Filter results based on a specific timeframe by passing a from-date in YYYY-MM-DD format. You can also specify an exact time in ISO-8601 date format, e.g. 2020-05-21T00:00:00+0000.
date_to [Optional] Filter results based on a specific timeframe by passing an end-date in YYYY-MM-DD format. You can also specify an exact time in ISO-8601 date format, e.g. 2020-05-21T00:00:00+0000.
limit [Optional] Specify a pagination limit (number of results per page) for your API request. Default limit value is 100, maximum allowed limit value is 1000.
offset [Optional] Specify a pagination offset value for your API request. Example: An offset value of 100 combined with a limit value of 10 would show results 100-110. Default value is 0, starting with the first available result.

Real-Time Updates: Please note that data frequency intervals below 15 minutes (15min) are only supported if you are subscribed to the Professional Plan or higher. If you are the Free or Basic Plan, please upgrade your account.

Example API Response:

If your API request was successful, the marketstack API will return both pagination information as well as a data object, which contains a separate sub-object for each requested date/time and symbol. All response objects are explained below.

{
    "pagination": {
        "limit": 100,
        "offset": 0,
        "count": 100,
        "total": 5000
    },
    "data": [
        {
            "date": "2020-06-02T00:00:00+0000"
            "symbol": "AAPL",
            "exchange": "IEXG",
            "open": 317.75,
            "high": 322.35,
            "low": 317.21,
            "close": 317.94,
            "last": 318.91,
            "volume": 41551000
        },
        [...]
    ]
}

API Response Objects:

Response Object Description
pagination > limit Returns your pagination limit value.
pagination > offset Returns your pagination offset value.
pagination > count Returns the results count on the current page.
pagination > total Returns the total count of results available.
date Returns the exact UTC date/time the given data was collected in ISO-8601 format.
symbol Returns the stock ticker symbol of the current data object.
exchange Returns the exchange MIC identification associated with the current data object.
open Returns the raw opening price of the given stock ticker.
high Returns the raw high price of the given stock ticker.
low Returns the raw low price of the given stock ticker.
close Returns the raw closing price of the given stock ticker.
last Returns the last executed trade of the given symbol on its exchange.
volume Returns the volume of the given stock ticker.

Real-Time Updates Available on: Professional Plan and higher

For customers with an active subscription to the Professional Plan, the marketstack API's intraday endpoint is also capable of providing real-time market data, updated every minute, every 5 minutes or every 10 minutes.

To obtain real-time data using this endpoint, simply append the API's interval parameter and set it to 1min, 5min or 10min.

Example API Request:

https://api.marketstack.com/v1/intraday ? access_key = YOUR_ACCESS_KEY & symbols = AAPL & interval = 1min

Endpoint Features, Parameters & API Response:

To learn about endpoint features, request parameters and API response objects, please navigate to the Intraday Data section.

Historical Data Available on: All plans

Historical stock prices are available both from the end-of-day (eod) and intraday (intraday) API endpoints. To obtain historical data, simply use the date_from and date_to parameters as shown in the example request below.

Example API Request:

https://api.marketstack.com/v1/eod
    ? access_key = YOUR_ACCESS_KEY
    & symbols = AAPL
    & date_from = 2019-01-01
    & date_to = 2019-02-01

HTTP GET Request Parameters:

For details on request parameters on the eod data endpoint, please jump to the End-of-Day Data section.

Example API Response:

{
    "pagination": {
        "limit": 100,
        "offset": 0,
        "count": 22,
        "total": 22
    },
    "data": [
        {
            "date": "2019-02-01T00:00:00+0000",
            "symbol": "AAPL",
            "exchange": "XNAS",
            "open": 166.96,
            "high": 168.98,
            "low": 165.93,
            "close": 166.52,
            "volume": 32668138.0,
            "adj_open": 164.0861621594,
            "adj_high": 166.0713924395,
            "adj_low": 163.073891274,
            "adj_close": 163.6537357617,
            "adj_volume": 32668138.0
        },
        {
            "date": "2019-01-31T00:00:00+0000",
            "symbol": "AAPL",
            "exchange": "XNAS",
            "open": 166.11,
            "high": 169.0,
            "low": 164.56,
            "close": 166.44,
            "volume": 40739649.0,
            "adj_open": 163.2507929821,
            "adj_high": 166.0910481848,
            "adj_low": 161.7274727177,
            "adj_close": 163.5751127804,
            "adj_volume": 40739649.0
        }
        [...]
    ]
}

API Response Objects:

For details on API response objects, please jump to the End-of-Day Data section.

Note: Historical end-of-day data (eod) is available for up to 30 years back, while intraday data (intraday) always only offers the last 10.000 entries for each of the intervals available. Example: For a 1-minute interval, historical intraday data is available for up to 10.000 minutes back.

Tickers Available on: All plans

Using the API's tickers endpoint you will be able to look up information about one or multiple stock ticker symbols as well as obtain end-of-day, real-time and intraday market data for single tickers. You will be able to find and try out an example API request below.

Example API Request:

https://api.marketstack.com/v1/tickers ? access_key = YOUR_ACCESS_KEY

Endpoint Features:

Object Description
/tickers/[symbol] Obtain information about a specific ticker symbol by attach it to your API request URL, e.g. /tickers/AAPL.
/tickers/[symbol]/eod Obtain end-of-day data for a specific stock ticker by attaching /eod to your URL, e.g. /tickers/AAPL/eod. This route supports parameters of the End-of-day Data endpoint.
/tickers/[symbol]/intraday Obtain real-time & intraday data for a specific stock ticker by attaching /intraday to your URL, e.g. /tickers/AAPL/intraday. This route supports parameters of the Intraday Data endpoint.
/tickers/[symbol]/eod/[date] Specify a date in YYYY-MM-DD format. You can also specify an exact time in ISO-8601 date format, e.g. 2020-05-21T00:00:00+0000. Example: /eod/2020-01-01 or /intraday/2020-01-01
/tickers/[symbol]/eod/latest Obtain the latest end-of-day data for a given stock symbol. Example: /tickers/AAPL/eod/latest
/tickers/[symbol]/intraday/latest Obtain the latest intraday data for a given stock symbol. Example: /tickers/AAPL/intraday/latest

HTTP GET Request Parameters:

Object Description
access_key [Required] Specify your API access key, available in your account dashboard.
exchange [Optional] To filter your results based on a specific stock exchange, use this parameter to specify the MIC identification of a stock exchange. Example: XNAS
search [Optional] Use this parameter to search stock tickers by name or ticker symbol.
limit [Optional] Specify a pagination limit (number of results per page) for your API request. Default limit value is 100, maximum allowed limit value is 1000.
offset [Optional] Specify a pagination offset value for your API request. Example: An offset value of 100 combined with a limit value of 10 would show results 100-110. Default value is 0, starting with the first available result.

API Response:

{
    "pagination": {
        "limit": 100,
        "offset": 0,
        "count": 100,
        "total": 136785
    },
    "data": [
        {
            "name": "MICROSOFT CORP",
            "symbol": "MSFT",
            "stock_exchange": {
                "name": "NASDAQ Stock Exchange",
                "acronym": "NASDAQ",
                "mic": "XNAS",
                "country": "USA",
                "country_code": "US",
                "city": "New York",
                "website": "www.nasdaq.com",
                "timezone": {
                    "timezone": "America/New_York",
                    "abbr": "EST",
                    "abbr_dst": "EDT"
                }
            }
        },
        [...]
    ]
}

API Response Objects:

Response Object Description
pagination > limit Returns your pagination limit value.
pagination > offset Returns your pagination offset value.
pagination > count Returns the results count on the current page.
pagination > total Returns the total count of results available.
name Returns the name of the given stock ticker.
symbol Returns the symbol of the given stock ticker.
stock_exchange > name Returns the name of the stock exchange associated with the given stock ticker.
stock_exchange > acronym Returns the acronym of the stock exchange associated with the given stock ticker.
stock_exchange > mic Returns the MIC identification of the stock exchange associated with the given stock ticker.
stock_exchange > country Returns the country of the stock exchange associated with the given stock ticker.
stock_exchange > country_code Returns the 3-letter country code of the stock exchange associated with the given stock ticker.
stock_exchange > city Returns the city of the stock exchange associated with the given stock ticker.
stock_exchange > website Returns the website URL of the stock exchange associated with the given stock ticker.
timezone > timezone Returns the timezone name of the stock exchange associated with the given stock ticker.
timezone > abbr Returns the timezone abbreviation of the stock exchange associated with the given stock ticker.
timezone > abbr_dst Returns the Summer time timezone abbreviation of the stock exchange associated with the given stock ticker.

Exchanges Available on: All plans

Using the exchanges API endpoint you will be able to look up information any of the 72+ stock exchanges supported by marketstack. You will be able to find and try out an example API request below.

Example API Request:

https://api.marketstack.com/v1/exchanges ? access_key = YOUR_ACCESS_KEY

Endpoint Features:

Object Description
/exchanges/[mic] Obtain information about a specific stock exchange by attaching its MIC identification to your API request URL, e.g. /exchanges/XNAS.
/exchanges/[mic]/tickers Obtain all available tickers for a specific exchange by attaching the exchange MIC as well as /tickers, e.g. /exchanges/XNAS/tickers.
/exchanges/[mic]/eod Obtain end-of-day data for all available tickers from a specific exchange, e.g. /exchanges/XNAS/eod. For parameters, refer to End-of-day Data endpoint.
/exchanges/[mic]/intraday Obtain intraday data for tickers from a specific exchange, e.g. /exchanges/XNAS/intraday. For parameters, refer to Intraday Data endpoint.
/exchanges/[mic]/eod/[date] Obtain end-of-day data for a specific date in YYYY-MM-DD or ISO-8601 format. Example: /exchanges/XNAS/eod/2020-01-01.
/exchanges/[mic]/intraday/[date] Obtain intraday data for a specific date and time in YYYY-MM-DD or ISO-8601 format. Example: /exchanges/IEXG/intraday/2020-05-21T00:00:00+0000.
/exchanges/[mic]/eod/latest Obtain the latest end-of-day data for tickers of the given exchange. Example: /exchanges/XNAS/eod/latest
/exchanges/[mic]/intraday/latest Obtain the latest intraday data for tickers of the given exchange. Example: /exchanges/IEXG/intraday/latest

HTTP GET Request Parameters:

Object Description
access_key [Required] Specify your API access key, available in your account dashboard.
search [Optional] Use this parameter to search stock exchanges by name or MIC.
limit [Optional] Specify a pagination limit (number of results per page) for your API request. Default limit value is 100, maximum allowed limit value is 1000.
offset [Optional] Specify a pagination offset value for your API request. Example: An offset value of 100 combined with a limit value of 10 would show results 100-110. Default value is 0, starting with the first available result.

API Response:

{
    "pagination": {
        "limit": 100,
        "offset": 0,
        "count": 71,
        "total": 71
    },
    "data": [
        {
            "name": "NASDAQ Stock Exchange",
            "acronym": "NASDAQ",
            "mic": "XNAS",
            "country": "USA",
            "country_code": "US",
            "city": "New York",
            "website": "www.nasdaq.com",
            "timezone": {
                "timezone": "America/New_York",
                "abbr": "EST",
                "abbr_dst": "EDT"
            }
        },
        [...]
    ]
}

API Response Objects:

Response Object Description
pagination > limit Returns your pagination limit value.
pagination > offset Returns your pagination offset value.
pagination > count Returns the results count on the current page.
pagination > total Returns the total count of results available.
name Returns the name of the given stock exchange.
acronym Returns the acronym of the given stock exchange.
mic Returns the MIC identification of the given stock exchange.
country Returns the country of the given stock exchange.
country_code Returns the 3-letter country code of the given stock exchange.
city Returns the given city of the stock exchange.
website Returns the website URL of the given stock exchange.
timezone > timezone Returns the timezone name of the given stock exchange.
timezone > abbr Returns the timezone abbreviation of the given stock exchange.
timezone > abbr_dst Returns the Summer time timezone abbreviation of the given stock exchange.

Currencies Available on: All plans

Using the currencies API endpoint you will be able to look up all currencies supported by the marketstack API. You will be able to find and try out an example API request below.

Example API Request:

https://api.marketstack.com/v1/currencies ? access_key = YOUR_ACCESS_KEY

HTTP GET Request Parameters:

Object Description
access_key [Required] Specify your API access key, available in your account dashboard.
limit [Optional] Specify a pagination limit (number of results per page) for your API request. Default limit value is 100, maximum allowed limit value is 1000.
offset [Optional] Specify a pagination offset value for your API request. Example: An offset value of 100 combined with a limit value of 10 would show results 100-110. Default value is 0, starting with the first available result.

API Response:

{
    "pagination": {
        "limit": 100,
        "offset": 0,
        "count": 40,
        "total": 40
    },
    "data": [
        {
            "code": "USD",
            "name": "US Dollar",
            "symbol": "$",
            "symbol_native": "$",
        },
        [...]
    ]
}

API Response Objects:

Response Object Description
pagination > limit Returns your pagination limit value.
pagination > offset Returns your pagination offset value.
pagination > count Returns the results count on the current page.
pagination > total Returns the total count of results available.
code Returns the 3-letter code of the given currency.
name Returns the name of the given currency.
symbol Returns the text symbol of the given currency.
symbol_native Returns the native text symbol of the given currency.

Timezones Available on: All plans

Using the timezones API endpoint you will be able to look up information about all supported timezones. You will be able to find and try out an example API request below.

Example API Request:

https://api.marketstack.com/v1/timezones ? access_key = YOUR_ACCESS_KEY

HTTP GET Request Parameters:

Object Description
access_key [Required] Specify your API access key, available in your account dashboard.
limit [Optional] Specify a pagination limit (number of results per page) for your API request. Default limit value is 100, maximum allowed limit value is 1000.
offset [Optional] Specify a pagination offset value for your API request. Example: An offset value of 100 combined with a limit value of 10 would show results 100-110. Default value is 0, starting with the first available result.

API Response:

{
    "pagination": {
        "limit": 100,
        "offset": 0,
        "count": 57,
        "total": 57
    },
    "data": [
        {
            "timezone": "America/New_York",
            "abbr": "EST",
            "abbr_dst": "EDT"
        },
        [...]
    ]
}

API Response Objects:

Response Object Description
pagination > limit Returns your pagination limit value.
pagination > offset Returns your pagination offset value.
pagination > count Returns the results count on the current page.
pagination > total Returns the total count of results available.
timezone Returns the name of the given timezone.
abbr Returns the abbreviation of the given timezone.
abbr_dst Returns the Summer time abbreviation of the given timezone.

Code Examples

We have prepared a series of handy code examples in various programming languages, including PHP, Python, Node.js, jQuery, Go and Ruby. You will find all available code examples below.

Code Example - PHP

$queryString = http_build_query([
  'access_key' => 'YOUR_ACCESS_KEY'
]);

$ch = curl_init(sprintf('%s?%s', 'https://api.marketstack.com/v1/tickers/aapl/eod', $queryString));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$json = curl_exec($ch);
curl_close($ch);

$apiResult = json_decode($json, true);

foreach ($apiResult['data'] as $stocksData) {
  echo sprintf('Ticker %s has a day high of %s on %s', $stockData['symbol'], $stockData['high'], $stockData['date'] )
}

Code Example - Python

import requests

params = {
  'access_key': 'YOUR_ACCESS_KEY'
}

api_result = requests.get('https://api.marketstack.com/v1/tickers/aapl/eod', params)

api_response = api_result.json()

for stock_data in api_response['data']:
    print(u'Ticker %s has a day high of  %s on %s' % (
      stock_data['symbol']
      stock_data['high']
      stock_data['date']
    ))ate']
))

Code Example - Nodejs

const axios = require('axios');
const params = {
  access_key: 'YOUR_ACCESS_KEY'
}

axios.get('https://api.marketstack.com/v1/tickers/aapl/eod', {params})
  .then(response => {
    const apiResponse = response.data;
    if (Array.isArray(apiResponse['data'])) {
        apiResponse['data'].forEach(stockData => {
              console.log(`Ticker ${stockData['symbol']}`,
                  `has a day high of ${stockData['high']},
                  `on ${stockData['date']}`);
        });
    }
  }).catch(error => {
    console.log(error);
  });

Code Example - jQuery

$.ajax({
  url: 'https://api.marketstack.com/v1/tickers/aapl/eod',
  data: {
    access_key: 'YOUR_ACCESS_KEY'
  },
  dataType: 'json',
  success: function(apiResponse) {
    if (Array.isArray(apiResponse['data'])) {
      apiResponse['data'].forEach(stockData => {
            console.log(`Ticker ${stockData['symbol']}`,
                `has a day high of ${stockData['high']},
                `on ${stockData['date']}`);
      });
    }
  }
});

Code Example - Go

package main

import (
  "encoding/json"
  "fmt"
  "net/http"
)

type StockData struct {
  Open string `json:"open"`
  High string `json:"high"`
  Low string `json:"low"`
  Close string `json:"close"`
  Volume string `json:"volume"`
  Date string `json:"date"`
  Symbol string `json:"symbol"`
}

type Response struct {
	Data []StockData `json:"data"`
}

func main() {
  httpClient := http.Client{}

  req, err := http.NewRequest("GET", "https://api.marketstack.com/v1/tickers/aapl/eod", nil)
  if err != nil {
    panic(err)
  }

  q := req.URL.Query()
  q.Add("access_key", "YOUR_ACCESS_KEY")
  req.URL.RawQuery = q.Encode()

  res, err := httpClient.Do(req)
  if err != nil {
    panic(err)
  }
  defer res.Body.Close()

  var apiResponse Response
  json.NewDecoder(res.Body).Decode(&apiResponse)

  for _, stockData := range apiResponse.Data {
      fmt.Println(fmt.Sprintf("Ticker %s has a day high of %s on %s",
          stockData.StockData.Symbol,
          stockData.StockData.High,
          stockData.StockData.Date))
  }
}

Code Example - Ruby

require 'net/http'
require 'json'

params = {
  :access_key => "YOUR_ACCESS_KEY"
}
uri = URI('https://api.marketstack.com/v1/tickers/aapl/eod')
uri.query = URI.encode_www_form(params)
json = Net::HTTP.get(uri)
api_response = JSON.parse(json)

for stock_data in api_response['data']
      puts sprintf("Ticker %s has a day high of %s on %s",
        stock_data['symbol']
        stock_data['high']
        stock_data['date']
      )
end

Don't have an API key yet? Get one now, it's free Get Instant Access