Determining the last business date

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
0
Csaba
1/11/2010 7:19:44 PM
scripting.vbscript 564 articles. 0 followers. Follow

1 Replies
757 Views

Similar Articles

[PageSpeed] 18

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.


0
mr_unreliable
1/11/2010 10:53:02 PM
Reply:

Similar Artilces:

determine mail flow problem!!!!!!!!
Help! :-( Our mailflow from 2 backend 2003 exchange servers keeps queuing up in the outbound queue (which is set to always run delivery). Messages stay in there from 10 to 120 minutes before being sent to our gateway MTA and then sent off site (to hotmail.com for example). However when I telnet from a backend server to the gateway over port 25 and send a test message it goes right away. I can't for the life of me figure out why. One example when viewed in message tracking history says: 10:16am - smtp: store driver, message submitted from store 10:16am - smtp: message submitted to ...

Free Busy Schedule
I cannot see the Free Busy Schedule between two Exchange 2003 Servers that are in different Administrative Groups, but in the same Exchange OU. I get the message that "Service is no longer available". This also happens when I'm just setting up appointments on my server alone with members on my server only. What do I need to check on? Everyone has initiated a meeting or accepted one. It use to work fine. Thank you Richard ...

Determine columns used
I have 100+ spreadsheets which i have to edit into a certain format. The spreadsheets currently have 100 columns (from 1-100). From there i have to reduce the number of columns set to 8 columns. E.g: 1 2 3 4 5 6 7 8 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 (from column 9 onwards, it goes to the 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 next rows' column 1) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 How do i do that without altering the order of the value of the cell? Let me make sure we understand the question. You have ...

Date formatting #2
I have a cell which contains a date in the form dd.mm.yyyy e.g 27.01.2005, however it does seem to be formatted properly. I have a lot of this data, how can I get excel to recognise it as a date and allow me to alter the date format etc which I cannot do at the moment. -- Turnipboy ------------------------------------------------------------------------ Turnipboy's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=24527 View this thread: http://www.excelforum.com/showthread.php?threadid=504394 On Tue, 24 Jan 2006 04:24:43 -0600, Turnipboy <Turnipboy.224wnm_11...

Enter Sales tansactions with previous dates when connected to netw
Enter Sales tansactions with previous dates when connected to network Hello, How can I enter invoices with previous dates in POS? When I change the date on the terminal, the system still gets the date from the server. And even when I tried offline mode, I could not use the store account tender. Any workaround? Thanks for your suggestions. ...

Enter last name, auto fill full name & address--HOW?
Hello, I'm trying to simplify a "customer info" form in which a commonly used individual and his/her full name, address, phone #s, etc. is required. Is there a method in which I can enter a keyword (preferably the individual's last name) and Excel will automatically insert his/her full name, address, etc.? There is a large list of individuals that require this shortcut. For Example: If I enter "Robertson", can Excel automatically enter (in place of "Robertson"): Mr. John Robertson 111 Any Street Anytown, ON A1A 1A1 Phone: (555) 555-5555 Fax: (55...

Dates are not displayed in ComboBox
I have a From ComboBox and a To ComboBox on a Form; cboFrom and cboTo. The Row Source is this: SELECT DISTINCT SharePrices.DateTime FROM SharePrices ORDER BY SharePrices.DateTime; The SQL is this: SELECT DISTINCT SharePrices.DateTime FROM SharePrices ORDER BY SharePrices.DateTime; Nothing is showing in either ComboBox; all I see is a whole bunch of blanks. I just did this in another form in another Access database. I can’t figure out why it’s not working for me now. I’m using Access 2007. I’d sincerely appreciate any insight with this. Thanks! Ryan -- Ryan--...

Dynamically determining when a month ends
Hello all, Ok, I have a simple excel spreadsheet, where I keep track of my spending on one tab, my income in another and my summary in a thrid. My problem happens when I try to dynamically calc. avg's for months in the summary page. For instance, if I want to see how much money I spent on average per month, or even per day, I draw from the data entered into the spending page. Now, the spending page is set up with the following columns: Date:: Description:: Amount The problem with this is that I can't predefine a max row # for each month, since I might have 80 entries in spending...

Sort a range of Dates on a subform
I have a Form and a Subform where I have datas and every record has a field named: Wdate also I have a field where I put a date I would like to press a button to sort equal or less dates than the date that I put on the field, please help Thanks in advance -- Lorenzo Díaz Cad Technician On Sat, 23 Feb 2008 08:28:00 -0800, ldiaz <ldiaz@discussions.microsoft.com> wrote: >I have a Form and a Subform where I have datas and every record has a field >named: Wdate >also I have a field where I put a date >I would like to press a button to sort equal or less dates than ...

how to determine the size of the sheet
Hi I had a collegue who told me once a way to dtermine the number of the rows in a sheet of the workbook I am working at. It is known that when you open a new workbook each sheet has maybe 65365 or something like that rows. MY QUESTION IS: HOW TO MAKE THE SHEET 1000 ROWS OR WHATEVER NUMBERS OF ROWS I ONLY NEED? Thanks in Advance, Ahmed Hi Ahmed The number of rows and columns are fixed. Your workaround would be to hide the ones you consider unneeded. HTH. Best wishes Harald "Ahmed SHEBL" <ahmad.shebl@hotmail.com> skrev i melding news:%231uFO3IcHHA.4720@TK2MSFTNGP0...

How to display project date on report
Hi-- I have a project that spans two days and I'm printing each day on its own page. I want to be able to display the actual day that the tasks occur on each page. I can't seem to find an appropriate field in the drop down box in the print options. Is it possible to do this? Many thanks. If you're printing a Gantt chart, zoom in to day by day. Under Tools, Options and the View tab, select a date format that includes the day of the week. -- Rod Gill Microsoft MVP for Project - http://www.project-systems.co.nz Author of the only book on Project VBA, see: http:/...

Money Small Business #4
1. Is it explained anywhere who Microsoft Small Business is recommended for? I really like Microsoft Money and have been using it for several years for managing personal finances, and now that we have a business I'm wondering if Money would be suitable for that too. On the website it only says it is suitable for small businesses and sole proprietorships. Okay, that fits at this point, but what if we would like to incorporate in the future, or if we grow bigger? What are the limits of Money in this regard? 2. Also, is it a software that accountants would accept? In other words; i...

Business contact manager
I just upgraded to Office 2003, outlook 2003, and I am looking for Business contact manager. Where is it located. Nothing was installed when I took the option of a Complete install. I have exchange 2000, and server 2000, and we would like to review Business Contact Manager, instead of using a different product. This product seems to be a good place for us start out with, and what my sales managers of 2 people would like to have, and my sales department of 12 people would really work with since they all know outlook. What version of Office did you get and where did you get it? Do y...

Convert Date & hour to decimal
If I have a column of values with a format like 9/2/2005 4:30, how do I convert that to decimal hours after (say) 1/1/2005 0:0? Also, is 4:30 routinely treated as HH:MM or might it be interpreted as MM:SS? Thanks, E-Jo Hi Take the earlier date/time from the later one and format the result as [hh] Andy. "Everett Joline" <ejoline@optonline.net> wrote in message news:emvmG3yVFHA.4056@TK2MSFTNGP15.phx.gbl... > If I have a column of values with a format like 9/2/2005 4:30, how > do I convert that to decimal hours after (say) 1/1/2005 0:0? > Also, is 4:30 routinely ...

Label/business card printing alignment
I have Office 2003 and now have found they removed the avery templates we use for business cards and other things have gone away as well. Has anyone found where they are? If you do please email them to pastordlewis@verizon.net (1) I have Pub 2003 and they are still there for me. (2) We don't generally do private email responses. -- JoAnn Paules MVP Microsoft [Publisher] "Dan Lewis" <anonymous@discussions.microsoft.com> wrote in message news:37fa01c4a315$c06790f0$a601280a@phx.gbl... >I have Office 2003 and now have found they removed the > avery template...

Fix the order of the last name and first name
How do I fix the order of the names, when the last name is first and the first name is second, separated by a comma. Hi! What order do you want them in? Biff >-----Original Message----- >How do I fix the order of the names, when the last name is first and the >first name is second, separated by a comma. >. > Hi try =TRIM(MID(A1,FIND(",",A1)+1,255)) & " " & TRIM(LEFT(A1,FIND(",",A1)-1)) -- Regards Frank Kabel Frankfurt, Germany Zami wrote: > How do I fix the order of the names, when the last name is first and > the first na...

How do I determine
I have X number of rows that show employee names and a column (A2) that lists the value of products sold by each employee and I want to pay them a percentage based upon value of sales. For example: If they sell up to =A31,000 worth of products, I will pay them 3% of the value. Between =A31,000 & =A32,000, I will pay them 5% of the value Over =A32,000, I will pay them 10% of the value The amount paid to them in commission will be show in column (A3). Many thanks D.Haste darren.haste@ttt.co.uk "Hastey" <darrenhaste@sky.com> wrote in message news:6a0a4fa9-adcd-484a-80...

Error in adding Business Portal user 2.5 with Feature Pack
When i add new user in business portal the ff. error message display below. "User cannot be added because it is an invalid domain user" I have check the user id in the domain and it is valid. What cause this error below eventhough the userid is valid Mike, Ron, If you are a microsoft partner, You can also post your question in Dynamics GP Partner forum that might help you receive suggestions from others also http://social.microsoft.com/Forums/en-US/partnerdynamicsgp/threads Thanks Janakiram M.P. MCP-GP "mike" wrote: > When i add new user in business portal th...

How do you determine if you have access to remote files
I'm trying to scan a list of servers for a specific file (say for example \\<servername>\C$\MyApp\Test.ini\which may exist on some servers but not on others. In addition, I may not have have access to all servers that I'm checking. When using any commands in Powershell (1.0) that attempt to get the file (such as Get-Item) PowerShell returns the same "Cannot find path '<filename>' because it does not exist.)" error message in the following two scenarions: 1. I have access to the remote filesystem and the file does not exist (expected beha...

Outlook Rule
Does anyone know how to set up a rule in Outlook XP so that the emails sent in Jan 04 (For example) are moved into a folder I've set up called Jan04 and the mails sent in Feb04 are moved into the Feb04 folder etc Thank you for your help Hi, Here's how you can do that. Create a new rule : 1. check messages when they arrive. 2. Received in a specific date span ( specify Jan 01 to Jan 31.. for Example ) 3. Move it to a specified folder ( specify Jan 04 for ex ) 4. Next and then Finish and then Apply the rule for the already existing mails in the Inbox. That should do the tr...

How to find highest, lowest and last cell in row?
Hi I'm having trouble trying to find an excel function that will let me return the highest, lowest and last cell in a row of cells spanning M10..CF10 (60 cells). All the consecutive cells will have a value, but the row will only be partially full with some number of still empty cells at the end. Is there someone who knows how I can solve this problem. Thanks for your kind help. Please reply to the newsgroup as my email address is false to avoid spam. Thanks again Sam Hi 1. Min value: MIN(M10:CF10) 2. Max value: MAX(M10:CF10) 3. Last value (if you only have numeric values): =I...

Find last day of month depending on criteria
Range A1:JA1 has all our work days for the year (holidays and weekends are excluded). In P32 I want to enter the number of a month (i.e. 1 = Jan, 2 = Feb, etc.) and have a formula in Q32 that looks in A1:JA1 and returns the largest date for the month I entered in P32. Thank you, Jeff On Wed, 6 Jan 2010 14:13:02 -0800, Jeff Jensen <JeffJensen@discussions.microsoft.com> wrote: >Range A1:JA1 has all our work days for the year (holidays and weekends are >excluded). > >In P32 I want to enter the number of a month (i.e. 1 = Jan, 2 = Feb, etc.) >and hav...

Last Date in List
Hi I have a table set out as follows, Account Date Text Amount 31405535 01/01/04 nnnn 100000 31405535 12/12/03 tttt 222222 31405535 03/03/05 ttt 122456 There are 5 different accounts which could be entered under Account. The list is a export from out bank statement, I would like a formula to display the last date of transaction per account number. For eg in the above list I would like the formula to return 03/03/05. Can anyone help? TIA Enter your list of account numbers in a column, let's say Column F, starting at F2... G2, copied down: =LOOKUP(2,1/($A$2:$A$100=F2),$B$...

Conditional formatting of dates in two cells using Excel 2007
Hi, I've got a spreadsheet set up as: Column A - task Column B - Expected completion date Column C - Actual completion date and I want to set it up so that all tasks that have not yet been completed but should have been are highlighted in red (that is, for example, if B2< todays date and C2 is blank then A2 is highlighted red). I've been messing about but can't seem to get it right in the conditional formatting - any suggestions? thanks Select cell A2 Select conditional format -> formula Enter the following forumla =AND(B2<TODAY(),C2=&qu...

Date formatting in Pivot Chart
Hi, I'm trying to create a pivot chart and the date field is not formatting properly - the format comes out different from that of the pivot table. How can I fix this? Format axis doesn't give me an option for date format. In the pivot table, right-click the date field button, and choose Field Settings. Click the Number button, and select a date format Click OK twice The chart should show the selected format. JessicaMc wrote: > Hi, > > I'm trying to create a pivot chart and the date field is not formatting > properly - the format comes out different from that o...