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

RE: [amibroker] Re: Multi Monitor Layout



PureBytes Links

Trading Reference Links




Hi dingo,
 
I had once explained my problem here "String name: 
Import over the Net" for which TJ had given me the Java script which I posted 
for Jeff, but here goes my prob yet again. My Data provider has given me a 
software which downloads 5 minutes data and updates the same to text 
files. Since the system on which I installed the software is in my office (Stock 
Exchange to be precise) and the Software cannot be installed in another place I 
have to download the data only @ my office PC. I am thinking of working 
from a few days from my home, I wanted to download & update the data to my 
Amibroker at my home, I wanted to have a script which will do it for 
me.
 
For this purpose I have installed a Web Server 
software on my office PC and hence can access the file from anywhere through the 
Internet. As I have explained in my earlier letter, I use a DSL connection to 
access the Net and since it is connected only during market hours I get a fresh 
IP address everytime I connect to the web.
 
I tried using your script but got some errors @ 
ticker file line. Will try to modify & if I still have problems will get 
back to you.
 
Thanks & Regards
 
Prashanth
<BLOCKQUOTE dir=ltr 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  dingo 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Monday, May 17, 2004 1:03 AM
  Subject: RE: [amibroker] how to? with 
  script, download data from web
  
  <FONT face=Arial 
  color=#0000ff size=2>I'm having trouble understanding you.  Are you able 
  to write in JScript?  Are you trying to download data from your office 
  computer via a script?  Is the data in separate files by ticker 
  name?  What do you want to do when you get the data on your home 
  computer? 
  <FONT face=Arial 
  color=#0000ff size=2> 
  <FONT face=Arial 
  color=#0000ff size=2>Why don't you list what you want to do in a very simple 
  step by step fashion so an old fart like me can understand it. Then I might be 
  able to get you going.
  <FONT face=Arial 
  color=#0000ff size=2> 
  <FONT face=Arial 
  color=#0000ff size=2>d
  <FONT face=Arial 
  color=#0000ff size=2> 
  
    
    
    From: Prashanth 
    [mailto:prash454@xxxxxxxxxxxxxxxxx] Sent: Sunday, May 16, 2004 
    3:28 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: 
    [amibroker] how to? with script, download data from web
    
    Hi dingo,
     
    Thanks for the script. The reason I also asked 
    Jeff was because he also wanted to do the same thing and I thought that he 
    may have tried it out. But I did address it to you. The reason I couldnt 
    give the address is that I have to download the files from my office to my 
    home system and at the office I use a DSL connection hence the IP address is 
    temporary.
     
    Coming to your script, I have one basic 
    question - Suppose I want to import data of multiple tickers, all I have to 
    do is create a txt file and give all the ticker names. <<FONT 
    face="Courier New" color=#0000ff size=1>TickerFile = "Symbols.txt" 
    >.
     
    Thanks for your help
     
    Regards
    Prashanth
    <BLOCKQUOTE dir=ltr 
    >
      ----- Original Message ----- 
      <DIV 
      >From: 
      dingo 
      
      To: <A 
      title=amibroker@xxxxxxxxxxxxxxx 
      href="">amibroker@xxxxxxxxxxxxxxx 
      
      Sent: Monday, May 17, 2004 12:12 
      AM
      Subject: RE: [amibroker] how to? with 
      script, download data from web
      <FONT 
      face=Arial size=2>
      <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> 
      <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                                                  
      *//**************************************************************/
       
      <FONT face="Courier New" color=#0000ff 
      size=1>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 = "<A 
      href=""><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";
       
      <FONT face="Courier New" 
      size=1>// 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"
       
      <FONT face="Courier New" 
      size=1>// 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 
      );
       
      <FONT face="Courier New" color=#0000ff 
      size=1>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;}
       
      <FONT face="Courier New" color=#0000ff 
      size=1>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;}
       
      <FONT face="Courier New" color=#0000ff 
      size=1>function CheckFolder(){    if( ! 
      FileSys.FolderExists( DestDir ) )    
      {        FileSys.CreateFolder( 
      DestDir );    }}
       
      <FONT face="Courier New" color=#0000ff 
      size=1>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@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@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@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 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.