It runs on X. I stopped developing it for 6.
This is the text:
/*
This procedure will get a stock quote for a given stock symbol and return it as a numeric value.
It will return a dictionary with other information.
This is the stock or mutual fund symbol
This is the last sale. The other parameter may be omitted to return only the quote.
This returns a dictionary with further information
TYPE=TEXT>This returns a dictionary (see GETDICTIONARYVALUE) with information about this stock.
The dictionary will contains one or more of the values listed below.
“Name”=Company Name
“LastSale”=Quote for last sale
“DChange”=Change from previous close
“Target”=One year target value
“DHigh”=Daily high
“DLow”=Daily low
"Volume=Daily volume
“Previous”=Previous close
“Dividend”=Annual dividend
“Ex-dividend”=Ex-dividend date
“PaymentDate”=Dividend payment date
“EPS”=Earnings per share
“P/E”=Price/earnings ratio
“AHigh”=52 week high
“ALow”=52 week low
“Description”=Company Description
“MarketCap”=Market Capitalization
“AnnualEPSest”=Annual EPS Estimate
“QuarterEPSest”=Quarterly EPS Estimate
“PEGratio”=PEG ratio
“MeanRecommendation”=Mean Recommendation
Local Quote
GetStockQuote "AAPL", LAST will return only the last sale quote.
GetStockQuote "AAPL", LAST, QUOTE
QUOTE will return a dictionary with the above data as text.
*/
Local NPage, QUOTE, vOPEN, vPREV, vEPS, vPRICEEARN, vTARGET, vADIV, vXDD, vDPDATE, vNAME, vLAST, vCHANGE, vHIGH, vLOW, vHILOW, vVOLUME, vHIGH52, vLOW52, dump
Local vDESCRIPTION, vMARCAP, vAEPSEST, vQEPSEST, vPEGRAT, vMEANREC
loadurl NPage,“http://www.nasdaq.com/symbol/” + lower(parameter(1))
//displaydata NPage
vNAME = replace(textbefore(textafter(NPage,{stock quote - }),{ price}),“&”,“&”)
vLAST = tagdata(NPage,‘_LastSale2">$ ‘,’’,1)
vTARGET = textafter(tagdata(NPage,‘1 Year Target’,‘</td’,1),‘’)
vHILOW = tagdata(NPage,{Today’s High /Low},‘’,1)
vHIGH = tagdata(vHILOW,{$ },“”,1)
vLOW = tagdata(vHILOW,{id=“Label1”>$ },“”,1)
vVOLUME = textafter(tagdata(tagdata(NPage,{Share Volume},“”,1),{<label},{},1),{">})
vPREV = tagdata(tagdata(NPage,{“Previous Close”},“”,1),{nowrap>$ },{},1)
vCHANGE = str(val(replace(vLAST,“,”,“”)) - val(replace(vPREV,“,”,“”)))
vADIV = ?(textafter(tagdata(NPage,{Annualized dividend},“”,1),{ nowrap>$ }) contains “N/A”,“N/A”,tagdata(tagdata(NPage,{Annualized dividend},“”,1),“$”,“”,1))
vXDD = tagdata(textafter(NPage,“Ex Dividend Date”),{},“”,1)
vDPDATE = replace(textafter(tagdata(NPage,{Dividend Payment Date},“”,1),{}),“.”,“”)
vHILOW = tagdata(textafter(NPage,“52 Week High/Low”),{},“”,1)
//displaydata vHILOW
vHIGH52 = tagdata(vHILOW,{$ }," “,1)
vLOW52 = strip(textafter(vHILOW,”/ $ "))
vEPS = tagdata(textafter(NPage,“Earnings Per Share (EPS)”),{$ },“”,1)
vPRICEEARN = tagdata(textafter(NPage,“P/E Ratio”),{},“”,1)
//Note: Returned as text. NE means Negative Earnings
vMARCAP = strip(tagdata(textafter(NPage,“Market Cap”),“$”,“<”,1))
vAEPSEST = tagdata(textafter(NPage,“Annual EPS Est”),“”,“”,1)
vQEPSEST = tagdata(tagdata(NPage,“Quarterly EPS Est”,“”,1),“”,“”,1)
vPEGRAT = tagdata(textafter(NPage,“PEG Ratio:”),“”,“”,1)
vMEANREC = tagdata(tagdata(NPage,“Mean Recommendation”,“”,1),“”,“”,1)
vDESCRIPTION = tagdata(textafter(NPage,{Company Description}),“
”,“
”,1)
QUOTE = initializedictionary( “Name”, vNAME, “LastSale”, vLAST, “DChange”, vCHANGE, “Target”, vTARGET, “DHigh”, vHIGH, “DLow”, vLOW, “Volume”, vVOLUME, “Previous”, vPREV, “Dividend”, vADIV, “Ex-dividend”, vXDD, “PaymentDate”, vDPDATE, “EPS”, vEPS, “P/E”, vPRICEEARN, “AHigh”, vHIGH52, “ALow”, vLOW52, “Description”, vDESCRIPTION, “MarketCap”, vMARCAP, “AnnualEPSest”, vAEPSEST, “QuarterEPSest”, vQEPSEST, “PEGratio”, vPEGRAT, “MeanRecommendation”, vMEANREC)
//dumpdictionary QUOTE, dump
//displaydata dump
/* This section is for testing, and to note the way the data are accessed.
Message "Name " + getdictionaryvalue(QUOTE,“Name”)
Message "LastSale " + getdictionaryvalue(QUOTE,“LastSale”)
Message "DChange " + getdictionaryvalue(QUOTE,“DChange”)
Message "Target " + getdictionaryvalue(QUOTE,“Target”)
Message "DHigh " + getdictionaryvalue(QUOTE,“DHigh”)
Message "DLow " + getdictionaryvalue(QUOTE,“DLow”)
Message "Volume " + getdictionaryvalue(QUOTE,“Volume”)
Message "Previous " + getdictionaryvalue(QUOTE,“Previous”)
Message "Dividend " + getdictionaryvalue(QUOTE,“Dividend”)
Message "Ex-dividend " + getdictionaryvalue(QUOTE,“Ex-dividend”)
Message "PaymentDate " + getdictionaryvalue(QUOTE,“PaymentDate”)
Message "P/E " + getdictionaryvalue(QUOTE,“P/E”)
Message "EPS " + getdictionaryvalue(QUOTE,“EPS”)
Message "AHigh " + getdictionaryvalue(QUOTE,“AHigh”)
Message "ALow " + getdictionaryvalue(QUOTE,“ALow”)
Message “MarketCap” +getdictionaryvalue(QUOTE,“MarketCap”)
Message “Description” + getdictionaryvalue(QUOTE,“Description”)
Message "Annual EPS estimate " + getdictionaryvalue(QUOTE,“AnnualEPSest”)
Message "Quarterly EPS estimate " + getdictionaryvalue(QUOTE,“QuarterEPSest”)
Message "PEG Ratio " + getdictionaryvalue(QUOTE,“PEGratio”)
Message "Mean Recommendation " + getdictionaryvalue(QUOTE,“MeanRecommendation”)
*/
setparameter 2,vLAST
setparameter 3,QUOTE
IF ERROR
RTN
ENDIF
// End of procedure