I am after a code to fetch close of business prices for any particular instrument/share through YahooFinanceAPI or any other code through VB.NET
I have find below similar post but the issue I am getting is with “GetWebResponse” as VB.NET doesn’t recognize it.
Retrieve the historical close price for each stock from yahoo finance?
Thanks
‘ Get the prices for this symbol.
Private Function GetStockPrices(ByVal symbol As String) As _
List(Of Single)
‘ Compose the URL.
Dim url As String = _
“http://www.google.com/finance/historical?output=csv&q=” _
& symbol
' Get the result.
' Get the web response.
Dim result As String = GetWebResponse(url)
' Get the historical prices.
Dim lines() As String = result.Split( _
New String() {vbCr, vbLf}, _
StringSplitOptions.RemoveEmptyEntries)
Dim prices As New List(Of Single)()
' Process the lines, skipping the header.
For i As Integer = 1 To lines.Length - 1
Dim line As String = lines(i)
prices.Add(Single.Parse(line.Split(","c)(4)))
Next i
Return prices
End Function
New contributor