From: Csaba Gabor on 11 Jan 2010 14:19 Is there any way (at 5pm in the continental USA) I can (fairly) conclusively determine the most recent date on which the stock market was open? This question comes from the following: If I have my VBScript hop over to http://my.msn.com/ then I can take a look at a fixed set of stock quotes (provided I have set them up). However, I don't see the date shown in any way. Now, if I could guarantee that the script would be run every day, then I could do some tricks (like checking whether all the quotes are the same as the prior accepted set - if so, I can assume the next date). However, I cannot guarantee this since the machine might not be turned on for some days at a time. Thus, my question. I know this probably isn't a VBScript response, per se (for example, a fairly stable web site with the last business date would do just fine), but it's remotely related since I'm using VBScript (sort of) and anyways, this is my group of choice. Happy New Year's greetings to all, Csaba Gabor from Portland
From: mr_unreliable on 11 Jan 2010 17:56 Csaba Gabor wrote: > Is there any way (at 5pm in the continental USA) I > can (fairly) conclusively determine the most recent date > on which the stock market was open? > hi Csaba, This is not an answer to the question you asked, I gave up on msn quotes a long time ago -- in favor of getting quotes from the "Yahoo Quote Server". You input (one- or-more) ticker symbols, and it will return whatever you ask. There are several webpages which will describe what the YQS does, but not published by Yahoo(?). Here is some code I use to get quotes. As you can see, I am asking for the latest quote, and some other stuff, delivered in a "csv" format: --- <code> --- Sub GetYahooQuotes(sSymbols) Const sMe = "[getQuotes], " ' switches as far as I can see are: ' # quote.yahoo.com format flags ' #s: stock: ' #l1: last: ' #d1: date: ' #t1: time: ' #c1: change: ' #o: open: ' #h:rangehi: ' #g:rangelo: ' #v: volume: ' #b: bid: ' #a: ask: ' ask for quotes to be downloaded to csv file, flag values: ' s => (ticker) symbol, n => name, l1 = last trade, p = previous close ' stock symbols added as a BUNCH of STOCK SYMBOLS separated by "+"... ' RWCString source("/d/quotes.csv?s=" + lticker + "&f=sl1d1t1v&e=.csv"); ' Const sYahoo = "http://finance.yahoo.com/d/quotes.csv/?f=snp&s=" ' previous close Const sYahoo = "http://finance.yahoo.com/d/quotes.csv/?f=snl1&s=" ' last trade Const bGetAsAsync = False ' wait for response Dim sHTMLPage ' as string Dim i dbPrint sMe & "entered.. " ' --- discussion ------------------------------- ' This is an attempt to retrieve stock quotes from the Yahoo! Finance ' Quote Server. There are quite a few examples of demo code showing ' how to get quotes from the Yahoo Quote Server. Strangely enough, ' if you call the quote server from Internet Explorer and Firefox ' you get different results. Internet Explorer displays the results ' DIRECTLY in its display panel, whereas Firefox asks you about ' opening the file in msXL or downloading it as a "quotes.csv" file. ' ' Fortunately, for this script anyway, microsoft's xmlHTTP behaves ' just like internet explorer, i.e., it gives you the result as ' a (text) html page (but still the lines are in "comma-separated" ' format)... ' Note: the page is retrieved as TEXT, the graphics are ' retrieved as BINARY data... ' --- end of discussion ------------------------ ' Const sSymbols = "MSFT+IBM" ' Const sSymbols = "^DJI+^GSPC" ' formulate a request to get the Yahoo Finance website... xmlHTTP.Open "GET", sYahoo & sSymbols, bGetAsAsync xmlHTTP.Send ' send it (to the web, wait for result) sHTMLPage = xmlHTTP.responseText ' (note: as TEXT) ' split up the quotes, if more than one... Dim saQuotes : saQuotes = Split(sHTMLPage, vbCrLf) For i = LBound(saQuotes) to UBound(saQuotes) if (saQuotes(i) <> "") then dbPrint sMe & saQuotes(i) ' write this line to the quotes file... oOutFile.WriteLine saQuotes(i) End If Next ' i End Sub ' GetYahooQuotes --- </code> --- Obviously, once you retrieve the quotes, you may use them however you like, including stuffing them into msXL. I assume you already know that msXL has a "quote-getter" of its own (as best I can tell - XLODBC.XLA), and apparently you know about the msMoney add-in, but that you wish to do-it-yourself via vbscript. cheers, jw ____________________________________________________________ You got questions? WE GOT ANSWERS!!! ..(but, no guarantee the answers will be applicable to the questions) p.s. Why give up on msMoney? "Back-in-the-day" when I first started going online for quotes (as opposed to looking them up in the WSJ), ms kept changing their software and formatting every couple of months. It drove me crazy. I looked for something else -- that hopefully stayed consistent. And YQS did that. It has not changed for years.
|
Pages: 1 Prev: objExcel.ActiveWorkbook.SaveAs Next: [ann] google code search |