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
1031 Views

Similar Articles

[PageSpeed] 23

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:

count between a date range
Hi, I want to be able to count between a date range and return the value yes. I will show you the formula I currently have: =IF(M2>=DateCell-365,"Yes","No") This gives a yes if the date is greater than the date in M2 minus 365. This however cincludes all the dates beyond M2 which isnt what I want. I want the dates upto M2. If that makes sense? Any help would be greatly appreciated Thanks Try.. =IF(M2>=datecell-DATE(1,0,0),"Yes","No") -- Jacob (MVP - Excel) "Dave" wrote: > Hi, I want to be able to count be...

Help with Dates
Hi all, I have a table with field name "ConnectionDate". I want to create a form with ComboBox that will show the "ConnectionDate" as month and year only. The value the user will choose will be a criteria for a query. Please help. TIA, Tom ?Format(Date,"mmyyyy") would return 112007 so, SELECT Format(ConnectionDate,"mmyyyy") AS ConnectDate FROM SomeTable -- Dave Hargis, Microsoft Access MVP "Tom" wrote: > Hi all, > > I have a table with field name "ConnectionDate". > I want to create a form with ComboBox tha...

Converting Dates from YYMMDD to MMDDYYYY
Hi All; I'm looking for a format function that will convert a date in the text format of YYMMDD to text format of MMDDYYYY. Any help would be GREATLY appreciated! Thanks in advance! You can't do it using a Format function, but try: Function SwitchDateFormat(YYMMDD As String) As String Dim strDay As String Dim strMonth As String Dim strYear As String If Len(YYMMDD) = 6 Then strYear = Left$(YYMMDD, 2) strMonth = Mid$(YYMMDD, 3, 2) strDay = Right$(YYMMDD, 2) If strYear < "30" Then strYear = "19" & strYear Else strYear =...

Simple Cash Flow Small business
I have a small janitorial business with recurring jobs w/the same clients. I want something simple & very inexpensive to keep track. Ideas? ...

Page not found error when opening business portal
Hi We're trying to install Invoice Approvals and Accruals 8.0, sharepoint services sp2 and Business Portal 2.5 Feature Pack to work with Great Plains 8.0 We can install Sharepoint services and Invoice Approvals and Accruals ok and they work fine However, when we install Business Portal and browse to http://servername/sites/businessportal/ We receive a "page not found" error screen We've tried several things but nothing seems to work Sharepoint services is installed in server farm mode and has been configured correctly (as far as I can tell) Any help would be great...

Determine Which Button was Right-Clicked?
All, I am using the code below (started from a sample from one of these groups) to programmatically create a series of buttons in a vertical strip on a form on Form Open. I have a context menu which appears when the user right-clicks any button on the form. How do I "tell" the context menu (really a function on the context menu) which button was right-clicked? I know how to get button attributes when the user left-clicks...but that's not what I need... Is there a way to do this? Thanks, Patrick Code::: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ...

Automatic Data Entry Script OnChange Event for Date Field.
Hi, Sub: Automatic Data Entry Script OnChange Event for Date Field. has anyone assigned 'Today date'( new Date()) to a custom date filed on the form - OnChange of a Picklist field, I have the following code. DatefiledName.value = new Date(); This assigns, currect date to the field, but then when I save it does not like it. When I manually assign a date it displays in the format mm/dd/yyyy, and saves correctly, so I changed the script to: d= new Date(); s = d.(getMonth() +1); s += '/' + d.getDate(); s += '/' + d.getFullYear(); DatefiledName.value = s; This also acc...

Load Last Page
I know you can "load first page" In CRM. Is there a way to Load LAST page instead of having to load each page? thank you The easiest way is changing the sort order (click on the appropriate column header). This then displays the "last" page. It's not exactly the same though. -- Michael H�hne, Microsoft Dynamics CRM MVP CRM Blog on http://www.stunnware.com ---------------------------------------------------------- "Bernardina" <dl@discussions.microsoft.com> schrieb im Newsbeitrag news:6243B5ED-9377-49CD-8CB3-9E84F1BAE5FA@microsoft.com... >I ...

Using Excel to design business forms
I have been using excel hit and miss to design business forms. I have been pretty successful but in many places I have found myself doing many inelegant things to get stuff to layout. Is there a good place to start looking to see how this is done properly, as I have seen many well done forms produced in excel. ...

number changes to date ... how do I change
I am trying to do an "age" range: 1-9 10-19 20-29 Instead I get September 9, 2004 or October 19 I can't figure out how to change it. Please help! Thank you! kk Format->Cells->Number Change the type to Text, and it should keep everything the way you want it. If you don't specify a type, Excel takes a guess based on what you enter. Hope that helps. -Bob --- Message posted from http://www.ExcelForum.com/ ...

Automatic date/time aquisition for graphs
Ok, I collect particle count data for a cleanroom which looks like th following: "LASAIR110","04/05/19","15:47:41",2700.0,45.00,"V6.3",0,0,0,1,433,486,236,113,294,196,103,328,4.993,1.0000,0.000,0.000,0.000,0.000,0.000,"22de" "LASAIR110","04/05/19","16:33:15",2700.0,45.00,"V6.3",0,0,0,1,458,432,163,55,107,55,46,139,5.007,1.0000,0.000,0.000,0.000,0.000,0.000,2299 "LASAIR110","04/05/19","17:18:49",2700.0,45.00,"V6.3",0,0,0,1,305,286,76,29,14,1,0,0,5.017,1.0000,0.000...

Date Range
When I use the following macro, what reference range is being employed that makes certain decisions for the conversion? For example, when I have a date of 1/12/46, this converts to January 12, 1946, not January 12, 2046; when I have a date of 1/14/20, this converts to January 14, 2020, not January 14, 1920; when I have a date of 2/3//10 this converts to February 3, 2010 not February 3, 1910??? Seems like this was only project so far into the future. I haven't tried all numbers but once you reach that boundary it assigns the 20th century to any number there and above. Su...

MS Small Business Manager and CRM
Does anyone know if there is a way to link MS Small Business Manager with CRM? We are planning on marketing both products. Thank You, Barry Sunshine 21cs Century Solutions ...

GPA and Small Business Financials
I know this isn't a Small Business Financials NG, but I couldn't find one . .. . and I figured this group would be familiar with SBF. I have a client who is still working in the old DOS version of Great Plains Accounting and they're wanting to migrate their data to something newer. I'm trying to find out if GPA data can be migrated to SBF (i.e. is a migration tool included?). Does anyone know? -- Brandon ================== Presentations Direct - http://www.presentationsdirect.com > Binding Machines http://www.presentationsdirect.com/binding-machines/gbc-bi...

Calculating Date Fields
I have a document that is filled with FormFields and users go from field to field filling the fields for a final document. I have been reading up on 'calculated dates' but have not seen a scenario like this. Three of my formfields are "Date1", "Date2" and "Date180." What I am trying to figure out is how to evaluate/compare Date1 and Date2 to see which is the earliest and then provide in Date180 the date 180 days from the earliest date. (Unless the form is blank there will always be a Date1, but there may not be a Date2 and if Date2 exist...

Business Portal for Great Plains
Is this the right group for asking questions regarding the Microsoft Business Portal for Great Plains? If not can anyone recommend a good group/forum? thanks ~john Fire away -- Charles Allen, MVP "~john" wrote: > Is this the right group for asking questions regarding the Microsoft > Business Portal for Great Plains? If not can anyone recommend a good > group/forum? > > thanks > > ~john > > Here's a link the thread with my question... http://groups.google.com/group/microsoft.public.greatplains/browse_thread/thread/8087e359b64746ef/5a28ef19...

Need to convert Julian Day to Gregorian date
I have a table that has a year field and day field. I only need to convert the day field which is a Julian date to Gregorian. If possible in a query. If not then in a module, but, I'm real rusty with access so please give explicit instructions. I have found some codes but have not been able to make them work with the table, I'm sure its me. Thanks for any help you can provide me with. There are loads of examples out there. The simplist one I could find that works is SELECT DatePart("y",[TableName]![FieldName])+(Year(Now())-1900)*1000 AS NewDate FROM TableName; -- ...

Custom or conditional format to highlight today's date?
Using Excel 2002, I have all 365 days of the year listed in column B, formatted as "03/14/01". When i open the workbook, I would like the current date to be bold and red. Can I do this with a conditional format? I have tried =Today with no success. Thanks Tonso "Tonso" <wthomasss@hotmail.com> wrote in message news:13885af2-777c-43ff-9684-1b5bda8d95d6@o6g2000yql.googlegroups.com... > Using Excel 2002, I have all 365 days of the year listed in column B, > formatted as "03/14/01". When i open the workbook, I would like the > current date to b...

Exchange 5.5 System Free/Busy objects left in Exchange 2003 since Migration.
Hi I hope somebody can help with this. I migrated our old Exchange 5.5 Org to Exchange 2003 last year and followed all the MS KB's about doing this. Since then we have switched to Native Mode 2003 and working fine. However we found that our AD infrastructure wasn't at its best and are currently deploying a new Domain. Now this is where the fun starts. While creating a new Exchange 2003 Org in the new Domain, we are replicating the Public/System Folders from the old Org and we have been getting some errors. On investigation we have found that there are redundant Free/Busy Schedule+ obj...

Excel formula with date constraints
Could use some help with the following: I created a spreadsheet to track payments made to contractors. In this spreadsheet I have a simple formula that tells when the payment has to be made based on the date it was rec'd from the contractor and adding on the payment terms. Now what I have to do is add in some date constraints. Our paying office only processes payments between certain windows during the month. Lets say that for this month the payment window closes Jan 27th to Feb 2nd. What I need to do is if after someone enters the date the payment is rec'd and the 14 days is ...

Mail Merge Date Format Problem
Trying to merge in data from an Excel spreadsheet but when the date goes in, it is in US format rather than english format, i.e 08/31/04 rather than 31/08/04. Tried changing the format in Excel first which doesn't work and my PC is set up with UK date as standard. Any ideas how I can change it? Cheers Nick Hi Nick (anonymous@discussions.microsoft.com), in the newsgroups you posted: || Trying to merge in data from an Excel spreadsheet but when || the date goes in, it is in US format rather than english || format, i.e 08/31/04 rather than 31/08/04. Tried changing || the format in E...

sum of dates
I have a list of sales with dates, like 23-Mar-00. I would like to add up how many sales were made in the year 2001. I know this is probably very easy but I am new at this. Thanks for your help. Brent ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ =SUMPRODUCT((YEAR(date_range)=2003)*1,sales_range) Jerry debtless wrote: > I have a list of sales with dates, like 23-Mar-00. I would like to add > up how many sales were made in the year 2001. I know this is proba...

summing a column gives me a date
I have a worksheet with each month listed on the columns. I have each row totaled out, and wish to total expenditures for the month. But when I do, I get a date, and not a numerical value - which is what I want. What am I doing wrong. Without seeing the formula, it is impossible to give a meaningful reply. Cordially, Chip Pearson Microsoft MVP 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com [email on web site] On Sun, 3 Jan 2010 15:13:01 -0800, jimfitegcs <jimfitegcs@discussions.microsoft.com> wrote: >I have a worksheet with each month listed on...

Search records with dates, then Group by month
I'm writing a macro that searches a spreadsheet for dates. I want to find records that are associated with a certain month. The dates in the spreadsheet are in the mmddyyyy format. How can I write code that would recognize any date within a given month and return true. For example, 7/12/2007 or 7/2/2007 would both return "true" for the month of July. 5/5/2007 or 5/27/2007 would return "true" for May, etc. thanks You could use the Autofilter to give you a LessthanGreaterthan range. Otherwise, keying just on Months, you would get May06, May07, etc if your datab...

Auto detect the range depending up on the input date.
Hi All, I have an excel as below. If I give the date as input, suppose 6/1/2009, excel should do a count if function with the range starting from the 1st cell below the input date till the next date in the dates column. I am confused, please help. 6/1/2009 N New 291420 Roger N New 291425 Fred N New 291427 Lisa N New 291532 Lima N New 291741 Lisa N New 291531 Roger N New 291494 Roger 6/2/2009 N New 291532 Lima N New 291741 Lisa N New 291531 Roger N New 291494 Roger 6/3/2009 Thanks, S Where do you give the date as input? In the same sheet? ...