[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: AW: AW: [amibroker] Advice Needed (offtopic)



PureBytes Links

Trading Reference Links




<SPAN 
class=734004018-16052004>The JScript below might help you. Its the one I modded 
for downloading quotes from the Brite.com website. 
<SPAN 
class=734004018-16052004> 
<SPAN 
class=734004018-16052004>It uses the GETURL program.
<SPAN 
class=734004018-16052004> 
<SPAN 
class=734004018-16052004>If you need me to write one for you give me the exact 
details you want done.
<SPAN 
class=734004018-16052004> 
<SPAN 
class=734004018-16052004>d
<SPAN 
class=734004018-16052004> 
<SPAN 
class=734004018-16052004>---------------------------8<-------------------------------------------------------
<FONT face="Courier New" color=#0000ff 
size=1> 
/*** 
AmiBroker/Win32 scripting Example**** File:     
Brite.js** Created:  Tomasz Janeczko, January 3rd, 2002** Modified: 
dingo,  April 22, 2004  - Added weekly & monthly** 
Purpose:  Download and import quotes from BriteFutures.com** 
Language:     _javascript_ (Windows Scripting 
Host)*****/
 
<FONT face="Courier New" color=#0000ff 
size=1>/**************************************************************//* 
Constants                                                  
*//**************************************************************/
 
TickerFile 
= "Symbols.txt"
 
/* 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 */
 
<FONT face="Courier New" 
size=1>URLPart1 = "<FONT 
face="Courier New" size=1>http://www.britefutures.com/codeword/<FONT 
face="Courier New" size=1>";URLPart2 = 
".csv?redir=/scripts/x_dl.asp&contract=";URLPart3 = 
"&ext=ext.csv";
 
// 
weekly history URLURLWHistPart1 = "<A 
href=""><FONT face="Courier New" 
size=1>http://www.britefutures.com/codeword/<FONT face="Courier New" 
size=1>";URLWHistPart2 = 
".csv?redir=/scripts/x_dl.asp&period=w&symbol=";URLWHistPart3 = 
"&ext=ext.csv"
 
// 
monthly history URLURLMHistPart1 = "<A 
href=""><FONT face="Courier New" 
size=1>http://www.britefutures.com/codeword/<FONT face="Courier New" 
size=1>";URLMHistPart2 = 
".csv?redir=/scripts/x_dl.asp&period=m&symbol=";URLMHistPart3 = 
"&ext=ext.csv"
 
/* 
extension of file name, ticker will be prepended */FileExt = 
".prn";FileExt_Wkly = "_Wkly.prn";FileExt_Mthly = 
"_Mthly.prn";
 
<FONT face="Courier New" color=#0000ff 
size=1>/**************************************************************//* 
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" 
);
 
/* find 
out what is the path to our script */DestDir = 
WScript.ScriptFullNameDestDir = DestDir.substr( 0, DestDir.length - 
WScript.ScriptName.length );  //WScript.echo( DestDir );
 
function 
Download( URL, filename ){    if( ! ForceDownloadFlag 
&& FileSys.FileExists( filename ) ) return true;
 
<FONT face="Courier New" color=#0000ff 
size=1>    CmdLine = DownloaderPrg + " " + URL + " " + 
filename;
 
<FONT face="Courier New" color=#0000ff 
size=1>    //WScript.echo( CmdLine );
 
<FONT face="Courier New" color=#0000ff 
size=1>    if( WshShell.Run( CmdLine, 0, true ) == 0 ) return 
true;
 
<FONT face="Courier New" color=#0000ff 
size=1>    WScript.echo("Download of " + URL + " failed." 
);
 
<FONT face="Courier New" color=#0000ff 
size=1>    return false;}
 
function 
Import( filename, format_file ){    
try    {        
AmiBroker.Import( 0, filename, DestDir + format_file );    
}    catch( e )    
{        return 
false;    }
 
<FONT face="Courier New" color=#0000ff 
size=1>    /* refresh ticker list and windows 
*/    AmiBroker.RefreshAll();    return 
true;}
 
function 
CheckFolder(){    if( ! FileSys.FolderExists( DestDir ) 
)    {        
FileSys.CreateFolder( DestDir );    }}
 
function 
Main(){    bOK = true;
 
<FONT face="Courier New" color=#0000ff 
size=1>    CheckFolder();
 
<FONT face="Courier New" color=#0000ff 
size=1>    tf = FileSys.OpenTextFile( DestDir + TickerFile, 1 
);
 
<FONT face="Courier New" color=#0000ff 
size=1>    while( ! tf.AtEndOfStream )    
{        
//------------------------------------------        
// Get current data section        
//------------------------------------------        
ticker = tf.ReadLine();        URL ="" 
+ URLPart1 + ticker + URLPart2 + ticker + URLPart3 + 
'"';        filename = '"' + DestDir + 
ticker + FileExt + '"';        
//WScript.echo( URL );        
//WScript.echo( filename );        if( 
Download( URL, filename ) )        
{            if( ! 
Import( DestDir + ticker + FileExt, "brite.format" ) ) 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;        
}        
//------------------------------------------        
// Get weekly history section        
//------------------------------------------        
W_Ticker = ticker.substr (0,ticker.length -3); 
        //WScript.echo( W_Ticker 
);        URL ="" + URLWHistPart1 + 
W_Ticker + URLWHistPart2 + W_Ticker + URLWHistPart3 + 
'"';        filename = '"' + DestDir + 
W_Ticker + FileExt_Wkly + '"';        
//WScript.echo( URL );        
//WScript.echo( filename );        if( 
Download( URL, filename ) )        
{            if( ! 
Import( DestDir + W_Ticker + FileExt_Wkly, "briteW.format" ) ) bOK = 
false;        
}        
else        
{            bOK = 
false;        
}        if( ! bOK && 
WshShell.popup( "The download and/or import of the " + filename + " weekly 
history 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;        
}        
//------------------------------------------        
// Get monthly history section        
//------------------------------------------        
M_Ticker = ticker.substr (0, ticker.length -3); 
        //WScript.echo( M_Ticker 
);        URL ="" + URLMHistPart1 + 
M_Ticker + URLMHistPart2 + M_Ticker + URLMHistPart3 + 
'"';        filename = '"' + DestDir + 
M_Ticker + FileExt_Mthly + '"';        
//WScript.echo( URL );        
//WScript.echo( filename );        if( 
Download( URL, filename ) )        
{            if( ! 
Import( DestDir + M_Ticker + FileExt_Mthly, "briteM.format" ) ) bOK = 
false;        
}        
else        
{            bOK = 
false;        
}        if( ! bOK && 
WshShell.popup( "The download and/or import of the " + filename + " monthly 
history 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;        }    
}
 
<FONT face="Courier New" color=#0000ff 
size=1>    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");
 
<FONT face="Courier New" color=#0000ff 
size=1>}
 
<FONT face="Courier New" color=#0000ff 
size=1>Main();
 
<FONT face=Arial color=#0000ff 
size=2> 

  
  
  From: JJ [mailto:jparent@xxxxxxxxx] 
  Sent: Sunday, May 16, 2004 1:21 PMTo: 
  amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] how to? with script, 
  download data from web
  i've read TJ's "HOWTO: Import quotes from Yahoo's site in CSV 
  format"found at <A 
  href="">http://www.amibroker.com/docs/ab302.html 
  .  from this i canfigure out how to assign stocks to industry groups 
  and so on usinginfo from a text file located on a local hard drive.  
  i want to skipseveral steps and access a CSV file located on the 
  web.here's an example:<A 
  href="">http://www2.standardandpoors.com/spf/csv/index/500growth.csvthe 
  only problem i'm having is trying to figure out how in windowsscript to 
  call data from a web based source.if that sounds easy, then how about 
  accessing data from XLS filesstored on the 
  net?/jeffSend BUG REPORTS to 
  bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html








Yahoo! Groups Sponsor


  ADVERTISEMENT 












Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.