Last time I posted I demonstrated how to use Yahoo Query Language to get real-time stock quotes from Yahoo Finance. I would encourage you to have the SVB code from last time running smoothly before proceeding with today’s post. I will show how to automate the collection of the data using the SVB code from last time with the Windows Task Scheduler.
The first step is to create a batch file. This can be done in a plain text editor such as Notepad. The path in the following command line code will need to be pointed to the location you saved the SVB code from the last post. The following code opens an instance of STATISTICA and runs the specified macro.
Example code for batch file:
“C:\Program Files\StatSoft\STATISTICA 12\statist.exe” /runmacro=”C:\temp\StockQuote.svb”
Once you have typed in the text in Notepad, go ahead and save the text with a file extension of “.bat”. I named my batch file StockQuote.bat. The default will be to have a file extension of .txt. It is very important that you add .bat to the end of the filename when saving it in Notepad.
Creating an automated task using a Windows Scheduled Task
Now you can proceed to create a Windows scheduled task to run this batch file. Keep in mind that the stock market opens at 9:30 AM EDT and closes at 4 PM EDT. I live in the Mountain time zone so I will specify 7:30 AM as the start time and 2 PM as the stop time.