knowledge-base How to use VBA to call MarketXlS Api in Excel for stock data

Last Updated On December 15, 2018
You are here:
  • KB Home
  • General
  • knowledge-base How to use VBA to call MarketXlS Api in Excel for stock data
< Back

Please use this code below to get Market data with MarketXLS API.

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

Shopping Cart