Free Market Data API Frequently Asked Questions (FAQ)


1. What is an API?
2. What Barchart APIs are included in my subscription?
3. What exchange data is included in my free API data feed?
4. Can I pull indices with the free market data API?
5. Can I pull mutual funds with the free market data API?
6. Can I receive options on futures and equity options with the free market data API?
7. How many queries am I allowed to make?
8. How do I request XML, JSON or CSV data?
9. When is end of day data updated?
10. Where can I find coding examples in Python, PHP, ASP, PERL, and Ruby?
11. I am getting the message “API key is missing or not valid.” What does this mean?
12. How can I avoid CORS issues?
13. Is data adjusted and corrected for historical splits and dividends?



1. What is an API?

API stands for application program interface and is a set of routines, protocols, and tools for building software applications. An API specifies how different pieces of software should interact with one another. Typically, APIs are used when programming graphical user interface components. A good API makes it easier for a developer to program by providing specific building blocks, in Barchart’s case - financial market data.




2. What Barchart APIs are included in my subscription?

Barchart’s free market data API only allows for both getQuote and getHistory APIs. Any additional APIs require a paid subscription to Barchart OnDemand. For pricing, please contact solutions@barchart.com




3. What exchange data is included in my free API data feed?

The free market data API includes data from AMEX, NYSE, NASDAQ in end of day frequency. Cboe BZX Exchange equity and Forex data is included on a 15-minute delay.




4. Can I pull indices with the free market data API?

No. You are limited to end of day US stocks and futures with the free market data API. To upgrade, please contact solutions@barchart.com.




5. Can I pull mutual funds with the free market data API?

No. You are limited to end of day US stocks and futures with the free market data API. To upgrade, please contact solutions@barchart.com.




6. Can I receive options on futures and equity options with the free market data API?

No. You will need to upgrade to Barchart OnDemand in order to receive futures or equity options data. Please contact solutions@barchart.com.




7. How many queries am I allowed to make?

Every user is able to make 400 getQuote queries and 150 getHistory queries per day.




8. How do I request XML, JSON or CSV data?

You can query for XML, JSON, or CSV by changing the extension of the API. See the highlighted section in the API query below.

https://marketdata.websol.barchart.com/getHistory.xml?apikey=YOUR_API_KEY&symbol=IBM&type=daily&startDate=20160608000000
https://marketdata.websol.barchart.com/getHistory.json?apikey=YOUR_API_KEY&symbol=IBM&type=daily&startDate=20160608000000
https://marketdata.websol.barchart.com/getHistory.csv?apikey=YOUR_API_KEY&symbol=IBM&type=daily&startDate=20160608000000




9. When is end of day data updated?

End of day data is updated by 16:45 Central Standard Time.




10. Where can I find coding examples in Python, PHP, ASP, PERL, and Ruby?

See: https://www.barchart.com/ondemand/api/getQuote/free. Click on the “Sample Code” button.




11. I am getting the message “API key is missing or not valid.” What does this mean?

First, check to make sure you are using your supplied API key and it is correct. If you are still getting this message it could mean you're connecting to the wrong endpoint.

With the free service, you need to request data from marketdata.websol.barchart.com as opposed to ondemand.websol.barchart.com.

INCORRECT: https://ondemand.websol.barchart.com/getQuote.json?apikey=YOUR_API_KEY&symbols=AAPL
CORRECT: https://marketdata.websol.barchart.com/getQuote.json?apikey=YOUR_API_KEY&symbols=AAPL




12. How can I avoid Cross-Origin Resource Sharing (CORS) issues?

Our APIs can be used without us enabling CORS by using JSONP, which can be used to overcome the CORS issue.

Below is sample code of this:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script>
    var apiResult = document.getElementById("quoteData"),
    getQuoteURL = "https://marketdata.websol.barchart.com/getQuote.jsonp";
    $.ajax({
        method: "POST",
        crossDomain: true,
        dataType: "jsonp",
        url: getQuoteURL,
        data: {
            "apikey": "YOUR_API_KEY",
            "symbols": "IBM"
        },
        success: function(data) {
            var html = "";
            for (var k in data.results) {
                html += "Symbol: " + data.results[k]['symbol'] + "<br />";
                html += "Last: " + data.results[k]['lastPrice'] + "<br />";
                html += "Change: " + data.results[k]['netChange'] + "<br />";
                html += "Pct. Chg.: " + data.results[k]['percentChange'] + "<br />";
                html += "Volume: " + data.results[k]['volume'] + "<br />";
                html += "Trade Time: " + data.results[k]['tradeTimestamp'] + "<br /><br />";
            }
            apiResult.innerHTML = html;
        },
        error: function() {
            console.log('Something went wrong!');
        }
    });
</script>



13. Is data adjusted and corrected for historical splits and dividends?

With getHistory splits and dividends are automatically adjusted into the historical data set. If you would like to remove historical splits and dividends, include the parameters &dividends=false and &splits=false to the historical data query.