I am able to get a single option quote from yahoo.finance with the data being delivered vertically over two columns (one headers, one data), but all my attempts to receive the data horizontally has been unsuccessful. I'm ultimately trying to write a command that will download a series option quotes that will be delivered as one per row. Currently, I can't even get one horizontal line of data. Please help!
If there is a way of doing this with some other free service (e.g., CBOE, Google), then please let me know. Any and all help would be appreciated!
Sub getOption()
'
' Attempting to return a stock option in a csv format with all datat in either one cell or accross 5 cells in one row
' data desired to Retrieve:
' name = n
' previous close = p
' ask = a
' bid = b
' open interest = o1
'
Const YAHOO_FINANCE_URL = "http://finance.yahoo.com/q/?s=SKX160122C00035000" 'retrieves option data vertically with a header, but adding &f=npbao1, /d/quotes.csv or &e=.csv makes it not work at all.
On Error Resume Next
With ActiveSheet.QueryTables.Add(Connection:="URL;" & YAHOO_FINANCE_URL, Destination:=ActiveCell)
.Name = "qtActiveRange" & Rnd()
.RefreshStyle = xlOverwriteCells
.AdjustColumnWidth = False
.BackgroundQuery = False
.Refresh
End With
End Sub