Close

September 21, 2017

Stock Market API in Excel – with MarketXLS API -(VBA & Google Sheets)

Stock Market Data API

With MarketXLS Stock Market API, you can use VBA and Javascript code to run access Stock Market API with a few lines of code. You can use any language you want like Python, c# or VB.net to create your own applications for any platform (Android, Windows, or Mac). Access all US Historical and live data with very easy to use urls. The result of the API can be obtained in JSON or CSV format. Multiple periodicity is available in case you need Intraday data. Live prices are also available with API Calls.

Get MarketXLS Templates emailed to you right away.

Below are the sample codes for VBA and google sheets to get Stock Market Data API feed urls….

VBA CODE BELOW…..

Sub Test()

Dim objRequest As Object
Dim strResponse As String
Dim blnAsync As Boolean

Set objRequest = CreateObject(“WinHttp.WinHttpRequest.5.1”)
blnAsync = True

With objRequest
.Open “GET”, “https://api.marketxls.com/historical-prices/MSFT/2011-01-01/2017-01-01/daily/ohlcv”, blnAsync
.setRequestHeader “x-api-key”, “Enter your Key here
.send
.WaitForResponse
strResponse = .responseText

Debug.Print strResponse
Debug.Print .Status
End With

MsgBox strResponse

End Sub

Google Sheets

function MarketXLS(inputurl) {

var headers = {
‘x-api-key’: ‘Your Key here‘ };

var options =
{
“method” : “get”,
“headers”: headers
};

var result = JSON.parse(UrlFetchApp.fetch(inputurl, options).getContentText());

return result

}

—————–

API Documentation is available here. MarketXLS Stock Market Data API pricing is available here.

https://app.swaggerhub.com/apis/marketxls-api1/marketxls-api/

Stock Market Data API

Author: Ankur Mohan

Educated in Finance, Business and Statistics, Ankur is passionate about finance, investing, trading and programming.

Leave a Reply

Your email address will not be published. Required fields are marked *