You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sub JnewCOP22()
Dim req As New MSXML2.XMLHTTP60
Dim URL As String, ws As Worksheet
Dim json As Object, r, r1 As String, i, j As Integer
URL = "https://www.nseindia.com/api/quote-equity?symbol=DRREDDY§ion=trade_info"
With req
.Open "GET", URL, False
.send
Set json = JsonConverter.ParseJson(.responseText)
r = json("securityWiseDP")("quantityTraded")
End With
MsgBox r
End Sub
The API DATA
{"noBlockDeals":true,"bulkBlockDeals":[{"name":"Session I"},{"name":"Session II"}],"marketDeptOrderBook":{"totalBuyQuantity":0,"totalSellQuantity":264,"bid":[{"price":0,"quantity":0},{"price":0,"quantity":0},{"price":0,"quantity":0},{"price":0,"quantity":0},{"price":0,"quantity":0}],"ask":[{"price":4659.2,"quantity":264},{"price":0,"quantity":0},{"price":0,"quantity":0},{"price":0,"quantity":0},{"price":0,"quantity":0}],"tradeInfo":{"totalTradedVolume":1945164,"totalTradedValue":92498.58,"totalMarketCap":7713541.51,"ffmc":5659504.6195251,"impactCost":0.02},"valueAtRisk":{"securityVar":10.89,"indexVar":0,"varMargin":10.89,"extremeLossMargin":3.5,"adhocMargin":0,"applicableMargin":14.39}},"securityWiseDP":{"quantityTraded":1945164,"deliveryQuantity":417789,"deliveryToTradedQuantity":21.48,"seriesRemarks":null,"secWiseDelPosDate":"29-OCT-2021 EOD"}}
The text was updated successfully, but these errors were encountered:
put a Debug.Print of req.responseText. It looks that that call is returning an XML/HTML document? Perhaps you need to set the Accepts header to get the JSON back?
The API DATA
{"noBlockDeals":true,"bulkBlockDeals":[{"name":"Session I"},{"name":"Session II"}],"marketDeptOrderBook":{"totalBuyQuantity":0,"totalSellQuantity":264,"bid":[{"price":0,"quantity":0},{"price":0,"quantity":0},{"price":0,"quantity":0},{"price":0,"quantity":0},{"price":0,"quantity":0}],"ask":[{"price":4659.2,"quantity":264},{"price":0,"quantity":0},{"price":0,"quantity":0},{"price":0,"quantity":0},{"price":0,"quantity":0}],"tradeInfo":{"totalTradedVolume":1945164,"totalTradedValue":92498.58,"totalMarketCap":7713541.51,"ffmc":5659504.6195251,"impactCost":0.02},"valueAtRisk":{"securityVar":10.89,"indexVar":0,"varMargin":10.89,"extremeLossMargin":3.5,"adhocMargin":0,"applicableMargin":14.39}},"securityWiseDP":{"quantityTraded":1945164,"deliveryQuantity":417789,"deliveryToTradedQuantity":21.48,"seriesRemarks":null,"secWiseDelPosDate":"29-OCT-2021 EOD"}}
The text was updated successfully, but these errors were encountered: