
Originally Posted by
aramz
Hey,
I have just purchased amibroker and am going through howard bandy's 'introduction to amibroker'. I am stuck with an issue in chapter 2 unfortunately. I downloaded data through amiquote and am trying to direct that specific data to a certain database in amibroker. I downloaded the nasdaq 100 and it went into my NYSE section. Does anyone know how I can direct data into a specific section?
cheers
You can also do it automatically.
For example using Finviz.com (it uses Morningstar Industry Classification system just like Yahoo)
For example to download
Nasdaq use this link http://finviz.com/export.ashx?v=111&f=exch_nasd
NYSE use this one http://finviz.com/export.ashx?v=111&f=exch_nyse
AMEX use this one http://finviz.com/export.ashx?v=111&f=exch_amex
There are some other finviz lists possible. Just use the filter options there on their website.
( Of course there are some other websites where you can get symbol lists from including category assignments like from here http://www.nasdaq.com/screening/company-list.aspx )
Move that downloaded Finviz files to C:\\. Name them AMEX.csv, NASDAQ.csv and NYSE.csv.
Then you could create format files for each of the three markets ( the format file codes below work in most recent AB 5.60 only!)
like
for Nasdaq
Code:
$FORMAT Skip,Ticker,FullName,SectorName,IndustryName,Country,Skip,Skip,Skip,Skip,Skip
$SKIPLINES 1
$SEPARATOR ,
$AUTOADD 1
$NOQUOTES 1
$OVERWRITE 1
$SORTSECTORS 1
$GROUP 1
$MARKET 1
for NYSE
Code:
$FORMAT Skip,Ticker,FullName,SectorName,IndustryName,Country,Skip,Skip,Skip,Skip,Skip
$SKIPLINES 1
$SEPARATOR ,
$AUTOADD 1
$NOQUOTES 1
$OVERWRITE 1
$SORTSECTORS 1
$GROUP 1
$MARKET 0
for AMEX
Code:
$FORMAT Skip,Ticker,FullName,SectorName,IndustryName,Country,Skip,Skip,Skip,Skip,Skip
$SKIPLINES 1
$SEPARATOR ,
$AUTOADD 1
$NOQUOTES 1
$OVERWRITE 1
$SORTSECTORS 1
$GROUP 1
$MARKET 2
Before importing the separately downloaded Finviz files the old sector and industry names (if there are any) better needs to be cleaned. The content of the format file that cleans the sectors after creating a data base or if using an already in use data base would be just one line
We call that format file e.g. CLEANSECTORS.format
So since we add three independent Finviz csv files we would need to create an empty dummy file named CleanSectors.csv. Otherwise we could add $CLEANSECTORS 1 to the symbols format file.
In regards to Ascii formats see here www.amibroker.com/guide/d_ascii.html
Then we create a jscript file that automates all that
Code:
var Amibroker, Mydatabase, Shell;
AmiBroker = new ActiveXObject("Broker.Application");
// save current Database before open the new one
AmiBroker.SaveDatabase();
// Amibroker database
//Mydatabase = "C:\\Program Files\\AmiBroker\\Data\\"; //your Amibroker database
// Open database
//AmiBroker.LoadDatabase(Mydatabase);
// Import
if (!AmiBroker.Import(0, "C:\\CLEANSECTORS.csv", "CLEANSECTORS.format"));
if (!AmiBroker.Import(0, "C:\\AMEX.csv", "FinVizAMEX.format"));
if (!AmiBroker.Import(0, "C:\\NYSE.csv", "FinVizNYSE.format"));
if (!AmiBroker.Import(0, "C:\\NASDAQ.csv", "FinVizNASDAQ.format"));
//if (!AmiBroker.Import(0, "C:\\SP500.csv", "FinVizSP500.format"));
//if (!AmiBroker.Import(0, "C:\\\DJ30.csv", "FinVizDJ30.format"));
//if (!AmiBroker.Import(0, "C:\\Other.csv", "FinVizOther.format"));
AmiBroker.RefreshAll();
AmiBroker.SaveDatabase();
//AmiBroker.Visible = true; // Opens Amibroker if is closed
//notify user when import is finished
Shell = new ActiveXObject("WScript.Shell");
Shell.Popup("Symbols Import Completed", 1.5);
I have uploaded all files to here http://www.datafilehost.com/download-552f71e0.html You just need to move the files to the according Amibroker folder on your PC.
Create a new data base. Then download the files of the three Finviz links. Download them to C:\\. Name them AMEX.csv, NASDAQ.csv and NYSE.csv. Then start Amibroker and excecute the jscript file of my uploaded zip archive.
I have made a comfortable AFL (it's not in the zip file) that does all that half-automatically without any manual user interference (except for clicking GFX buttons). See here http://www.youtube.com/watch?v=FDqnqN2z7I0&hd=1 The video is just supposed to show what you can do and what AB is capable of. So actually you can do anything that comes into your mind. That AFL of the video is an older version that I have recently updated to use the new ASCII capabilities provided in AB 5.60. See changes for 5.58 here http://www.amibroker.com/devlog/2012...e-candidate-1/
My AFL programmatically creates folders to download the files to. It uses Urlget to download the files from Finviz or any other website providing symbol lists with category assignments (you can additionally choose individual Markets to download via Parameters dialog). It moves the files to the created folders, of course. It creates names for categories and moves the imported symbols to market, group, sector, industry, watchlist
In regards to setting category names it's all there in AFL, e.g.
Code:
CategorySetName( "NYSE", categoryMarket, 0 );
CategorySetName( "Nasdaq", categoryMarket, 1 );
CategorySetName( "Amex", categoryMarket, 2 );
CategorySetName( "World Indices", categoryGroup, 0 );
CategorySetName( "US Stocks", categoryGroup, 1 );
CategorySetName( "European Stocks", categoryGroup, 2 );
CategorySetName( "DJ INDU 30", categoryWatchlist, 0 );
CategorySetName( "S&P 500", categoryWatchlist, 1 );
CategorySetName( "NASDAQ 100", categoryWatchlist, 2 );
CategorySetName( "Symbols not updated", categoryWatchlist, 62 );
CategorySetName( "Symbols probably dead", categoryWatchlist, 63 );
Bookmarks