PureBytes Links
Trading Reference Links
|
Hello,
I did this, and AmiBroker up and running, but still nothing happens
when I click the script.
I got the script and URLGet.exe both in C:\Yahoo a new directory I
made.
Amibroker is installed in c:\programfiles\amibroker
So I don't have a clue how to go about this. I have a windows 98
machine with IE 5.5 so what is wrong here?
Thanks for help
Robert Feddes
--- In amibroker@xxxx, "Tomasz Janeczko" <tj@xxxx> wrote:
> Hello,
>
> Your Dest dir should be written as follows:
> DestDir = "c:\\Yahoo";
>
> Also you might also download the very latest update
> (http://www.amibroker.com/bin/ab361.zip).
>
> Also remember to have AmiBroker RUNNING before
> clicking on the script.
>
> Best regards,
> Tomasz Janeczko
>
>
> ----- Original Message -----
> From: <rffeddes@xxxx>
> To: <amibroker@xxxx>
> Sent: 10 July, 2001 10:03
> Subject: [amibroker] automatic quotes from Yahoo
>
>
> Hello there,
>
> I have only this weekend acquired the Amibroker program.
>
> I downloaded the yahoo script and copied it to the c:\Yahoo
directory
>
> I also copied the URLGet.exe program to that same directory
>
> I can click all I like on the script, but nothing happens.
>
> I would appreciate very much if someone who has this working
properly
> could explain how it works and where I should put what.
>
> I am enclosing the script as I have it now, I tried more
backslashes
> for the DestDir = "c:\\Yahoo\\"; but nothing seems to work.
>
>
> Anybody who can help, Thanks a lot.
>
> Robert Feddes
>
>
>
> /*
> ** AmiBroker/Win32 scripting Example
> **
> ** File: Yahoo.js
> ** Created: Tomasz Janeczko, March 4rd, 2001
> ** Purpose: Download and import DAILY updates from Yahoo
> ** Language: JavaScript (Windows Scripting Host)
> **
> **
> */
>
> /**************************************************************/
> /* Constants */
> /**************************************************************/
>
> /* The ticker to check */
> /* Set it to empty string "" if you don't want to check */
> ChkTicker = "^NDX";
>
> /* The folder where the files will be downloaded */
> DestDir = "C:\Yahoo";
>
> /* The name and the path to downloader program */
> DownloaderPrg = "URLGet.exe";
>
> /* Force download - if true causes downloading data file */
> /* even if it exists on the local drive */
> ForceDownloadFlag = false;
>
> /* URL from where data are downloaded */
> /* quote.yahoo.com supports US and Canada markets only */
> URLPrefix = "http://quote.yahoo.com/d/quotes.csv?s=";
> URLPostfix = "&f=snl1d1t1c1ohgv&e=.csv";
>
> /* extension of file name, YYYYMMDD will be prepended */
> FileExt = ".aqd";
>
> /* Max. number of tickers to download in one run */
> /* Should be no more than 30 because of the limitations of command
> line string length */
> ChunkSize = 30;
>
> /**************************************************************/
> /* Main part */
> /**************************************************************/
>
> /* Create AmiBroker app object */
> AmiBroker = new ActiveXObject( "Broker.Application" );
> /* ... and file system object */
> FileSys = new ActiveXObject( "Scripting.FileSystemObject" );
> WshShell = new ActiveXObject( "WScript.Shell" );
>
> function Download( URL, filename )
> {
> if( ! ForceDownloadFlag && FileSys.FileExists( filename ) )
> return true;
>
> if( WshShell.Run( DownloaderPrg + " " + URL + " " + filename,
> 0, true ) == 0 ) return true;
>
> WScript.echo("Download of " + URL + " failed." );
>
> return false;
> }
>
> function Import( filename )
> {
> try
> {
> AmiBroker.Import( 0, filename, "aqd.format" );
> }
> catch( e )
> {
> return false;
> }
>
> /* refresh ticker list and windows */
> AmiBroker.RefreshAll();
> return true;
> }
>
> function CheckFolder()
> {
> if( ! FileSys.FolderExists( DestDir ) )
> {
> FileSys.CreateFolder( DestDir );
> }
> }
>
> function IsValidDatabase()
> {
> if( ChkTicker != "" && AmiBroker.Stocks.Count > 0 )
> {
> try
> {
> return AmiBroker.Stocks( ChkTicker ).Ticker
> == ChkTicker;
> }
> catch( e )
> {
> WScript.echo("The database currently loaded
> into AmiBroker does not have " + ChkTicker + "\nSo I guess this is
> not correct database.\nUpdate failed.");
> }
> }
>
> return false;
> }
>
> function Main()
> {
> bOK = true;
> var Today = new Date();
>
> if( ! IsValidDatabase() ) return;
>
> CheckFolder();
>
> var Qty = AmiBroker.Stocks.Count;
>
> var TickerList = "";
>
> var j = 0; /* this variable is used for marking different
> files from one day */
>
> for( i = 0; i < Qty; i++ )
> {
> TickerList += AmiBroker.Stocks( i ).Ticker;
>
> if( ( i % ChunkSize ) == (ChunkSize-1) || i == ( Qty -
> 1) )
> {
>
> y = Today.getFullYear();
> m = Today.getMonth() + 1;
> d = Today.getDate();
>
> bOK = true;
>
> filename = y + ( m < 10 ? "0" : "" ) + m + (
> d < 10 ? "0" : "" ) + d + "_" + j + FileExt;
>
> URL = URLPrefix + TickerList + URLPostfix;
>
> if( Download( URL, DestDir + filename ) )
> {
> if( ! Import( DestDir + filename ) )
> bOK = false;
> }
> else
> {
> bOK = false;
> }
>
> if( ! bOK && WshShell.popup( "The download
> and/or import of the " + filename + " has failed.\nThis can be
> because the data are not available or network connection
problem.\nDo
> you want to abort?" , 0, "Abort updating", 4 + 256 ) == 6 )
> {
> break;
> }
>
> j++;
>
> TickerList = "";
> }
> else
> {
> TickerList += "+";
> }
>
> }
>
> if( bOK ) WScript.echo("Update script finished. Your database
is
> now up-to-date" );
> else WScript.echo("Update script finished. There were,
> however, some errors during download/import");
>
> }
>
> Main();
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
|