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

[amibroker] Re: Symbol information update in Amibroker



PureBytes Links

Trading Reference Links

another example that you can modify
/*
** AmiBroker/Win32 scripting Example
**
** File:	 Industries.js
** Created:  Tomasz Janeczko, November 26th, 2000
** Last updated: Tomasz Janeczko, December 17th, 2000
** Purpose:  Import industy assignments
** Language:	 JavaScript (Windows Scripting Host)
**
** The data is stored in lines with following format
** <ticker>,<full name>,<industry number>
**
*/

WScript.Echo( "Script Started" );

/* change this line according to your data file name */
ImportStocks("NasdaqIndexes.csv");

WScript.Echo( "Finished" );

function ImportStocks( filename )
{
	var fso, f, r;
	var ForReading = 1;
	var AmiBroker;
	var fields;
	var stock;


	/* Create AmiBroker app object */
	AmiBroker = new ActiveXObject( "Broker.Application" );

	/* ... and file system object */
	fso = new ActiveXObject( "Scripting.FileSystemObject" );

	/* open ASCII file */
	f = fso.OpenTextFile( filename, ForReading);

	i = 1;
	/* read the file line by line */
	while ( !f.AtEndOfStream )
	{
		r =  f.ReadLine();
		
		/* split the lines using comma as a separator */
		fields = r.split(","); 
		
		try
		{
			
			/* add a ticker - this is safe operation, in case that	 */
			/* ticker already exists, AmiBroker returns existing one */
			stock = AmiBroker.Stocks.Add( fields[ 0 ] ); 
				
			stock.FullName = fields[ 1 ];
stock.MarketID = fields[ 2 ];
			stock.IndustryID = parseInt( fields[ 3 ] );
			stock.GroupID = parseInt( fields[ 4 ] );
			stock.Index=true;
		}
		catch( e )
		{
				WScript.echo( "There is a problem in line no." + i + ".\nThe line looks as follows:\n'" + r + "'\nIt will be skipped and next lines will be processed as normal" );
		}
					
		i++;	
	}

	/* refresh ticker list and windows */
	AmiBroker.RefreshAll();

}



--- In amibroker@xxxxxxxxxxxxxxx, "Habibur Md. Rahman  Planning Networks" <habib@xxx> wrote:
>
> Hi all Seniors and Experts
> 
> I am pretty new to AB. 'Symbol Information' update manually is cumbersome, I am searching for some process to update it from a text file that contains the required information.
> 
> Does anybody have the process already developed, Can you please share it? Or can some body please develop a process for this?
> 
> Regards
> Habib
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/