AmiBroker has an ability to assign symbols to different categories allowing you (when properly set up) to narrow your analysis searches to the symbols meeting certain selection criteria (thanks to Filter feature available in Quick Review and Automatic Analysis windows). The initial set up of categories may be a little bit complicated especially when you want to track several thousands symbols.
Categories show up in Symbols window. First and foremost thing to remember is categories do NOT work like folders and Workspace window does NOT work like Windows Explorer.
The difference is fundamental. In the Windows Explorer file appears
(usually) only once in the given tree leaf.
Symbols window is divided into three parts:
The search box allows to perform full text searches (including wildcard matching) against symbol and full name within selected category. So for example if you select "Technology" sector and type A* (letter 'A' and wildcard character *) the symbol list will show all symbols belonging to Technology sector with symbol or full name beginning with letter 'A'. Another example would be tping *-A0-FX - this will return all forex symbols on eSignal database (those ending with -A0-FX substring).
The category tree (see the picture) shows different
kind of categories.
Single symbol belongs to MANY categories at the same time. For example AAPL (Apple Inc.) will belong to:
and may also belong to several watch lists and favorites category. All at the same time. That's why one symbol will appear in many leaves of the workspace symbol tree. Now if you delete the SYMBOL it will of course disappear from ALL categories because you have deleted the symbol itself, not its assignment to category.
There are two types of categories:
There is also one special category called "ALL" that shows up in the workspace symbol tree. It simply lists ALL symbols present in the database.
Basics - predefined sectors and industries
Now we will focus on setting up sectors and industries and assigning the symbols to them. First let me discuss some basic ideas.
AmiBroker comes with an example Dow Jones Industrials database holding all 30 components of this world's most famous market average. They are assigned to predefined sectors and industries. These sectors and industries are exactly the same as used on Yahoo finance site and here is a table which shows them all:
|Basic Materials (0)||Chemical Manufacturing|
|Chemicals - Plastics & Rubber|
|Containers & Packaging|
|Fabricated Plastic & Rubber|
|Forestry & Wood Products|
|Gold & Silver|
|Iron & Steel|
|Misc. Fabricated Products|
|Paper & Paper Products|
|Capital Goods (1)||Aerospace & Defense|
|Constr. - Supplies & Fixtures|
|Constr. & Agric. Machinery|
|Construction - Raw Materials|
|Misc. Capital Goods|
|Mobile Homes & RVs|
|Consumer Cyclical (3)||Apparel/Accessories|
|Appliance & Tool|
|Audio & Video Equipment|
|Auto & Truck Manufacturers|
|Auto & Truck Parts|
|Furniture & Fixtures|
|Jewelry & Silverware|
|Textiles - Non Apparel|
|Consumer/Non-Cyclical (4)||Beverages (Alcoholic)|
|Personal & Household Prods.|
|Oil & Gas - Integrated|
|Oil & Gas Operations|
|Oil Well Services & Equipment|
|Financial (6)||Consumer Financial Services|
|Insurance (Accident & Health)|
|Insurance (Prop. & Casualty)|
|Misc. Financial Services|
|Money Center Banks|
|Healthcare (7)||Biotechnology & Drugs|
|Medical Equipment & Supplies|
|Broadcasting & Cable TV|
|Casinos & Gaming|
|Hotels & Motels|
|Printing & Publishing|
|Real Estate Operations|
|Rental & Leasing|
|Retail (Catalog & Mail Order)|
|Retail (Department & Discount)|
|Retail (Home Improvement)|
|Security Systems & Services|
|Waste Management Services|
|Technology (9)||Communications Equipment|
|Computer Storage Devices|
|Electronic Instruments & Controls|
|Scientific & Technical Instr.|
|Software & Programming|
|Transportation (10)||Air Courier|
|Utilities (11)||Electric Utilities|
|Natural Gas Utilities|
It is important to understand the difference between a sector and an industry: industries "belong" to sectors, for example: "Air Courier", "Airline", "Railroads", "Trucking" industries belong to "Transportation" sector. So if a symbol is assigned to given industry, it is "automatically" assigned also to the corresponding sector.
In the example DJIA database each stock is assigned to specific industry, for example GM (General Motors) is assigned to "Auto & Truck Manufacturers" industry, and this implicates that GM belongs to "Consumer/Cyclical" sector.
AmiBroker can handle up to 32 sectors and up to 256 industries.
How to assign symbol to the industry?
You can change the industry to which given symbol is assigned by using Window->Information dialog (Industry combo box)
or using Symbol->Organize Assignments.
The first method is fine if you want to change single symbol settings. The latter is better if you want to move multiple symbols from one category to another.
How to define your own sectors and industries
Please go to Symbol->Categories dialog, the last two tabs are "Sectors" and "Industries". First, switch to the "Sectors" tab and you will see the list of 32 sector names. You can now select the sector by clicking once on its name and edit the sector name by pressing ENTER or clicking "Edit name" button. Hit ENTER again to accept the name change.
After you renamed the sectors you can switch to the "Industries" tab. Similarly to the previous tab you can select the industry in the list and edit its name in the same manner. Here you can also assign the industry to the sector using "Sector" combo. Just select the sector to which you want to assign currently selected industry.
Where sector and industry information is stored?
Generally speaking this information is stored in AmiBroker database. The sector and industry names and settings are stored in the broker.workspace file (in the workspace folder), symbol data files hold only the information about the assignment of the symbol to given industry (IndustryID).
When you create a new workspace (a database) AmiBroker sets up your industries and sectors according to the templates stored in the "broker.sectors" and "broker.industries" files. These are simple text files that could be edited with plain text editor (such as Notepad). These files could be also used for quick, automatic setup of the sectors and industries. AmiBroker comes with predefined broker.sectors and broker.industries that follow described above convention (see the table). You can rewrite broker.sectors and broker.industries files to define your own default scheme. So, "broker.sectors" and "broker.industries" files are used as a template when creating new workspace. Once workspace is created these files are not taken into consideration. In this way you may have different categories in each workspace. If you want AmiBroker to load them into already existing workspace please delete broker.workspace file before opening the workspace. If you then open the workspace AmiBroker will read broker.sectors and broker.industries.
The layout of broker.sectors file is very simple: it is plain text file holding
sector names written line by line as shown below:
The layout of broker.industries is similar, but in addition to industry names there is a number at the beginning of each line:
1 Aerospace & Defense
10 Air Courier
3 Appliance & Tool
3 Audio & Video Equipment
3 Auto & Truck Manufacturers
3 Auto & Truck Parts
4 Beverages (Alcoholic)
4 Beverages (Non-Alcoholic)
7 Biotechnology & Drugs
8 Broadcasting & Cable TV
8 Business Services
8 Casinos & Gaming
0 Chemical Manufacturing
0 Chemicals - Plastics & Rubber
9 Communications Equipment
The numbers at front of industry names are "Sector IDs". Those numbers decide to which sector given industry belongs to. Because several industries may belong to one sector - you may need to put the same number for sector Id. Sector IDs are zero based, which means that 0 refers to the first line (sector name) of "broker.sectors" file, while 7 refers to the eighth line of this file. In the example above: "Advertising" industry belongs to "Services" sector, while "Aerospace & Defence" industry belongs to "Capital Goods" sector.
If you don't want to setup detailed industry information and want assign symbols only to sectors you can define one-to-one relationship between first 32 industries so they will be equivalent to sectors. Using the broker.sectors as show earlier in this article 1-1 broker.industries file would look like:
0 Basic Materials
1 Capital Goods
3 Consumer Cyclical
Note that this file is essentially the same as broker.sectors with the only difference that we have consecutive numbers prepended to each line. Using this kind of setup setting the industry will be equivalent to setting the sector.
Making it automatic
As described above symbol and industries names and relationship can be easily set up quickly using "broker.sectors" and "broker.industries" files. It will save some work needed otherwise to enter this information in Symbol->Categories window.
Unfortunately a lot more work is needed to assign all symbols to the industries even using Symbol->Organize Assignments dialog.
Fortunatelly there is a way to setup and update the database automatically.
In pre-5.60 version it still required scripting and lots of work (see 4th issue of AmiBroker Tips newsletter) but version 5.60 brings completely new ways to setup the database automatically.
The improved ASCII importer in v5.60 allows to import symbols, sectors and industry names and build complete database in just one step.
Let us say that we have CSV file that looks as follows:
"DDD","3D Systems Corporation","Technology","Computer Software: Prepackaged Software"
"MMM","3M Company","Health Care","Medical/Dental Instruments"
"SVN","7 Days Group Holdings Limited","Consumer Services","Hotels/Resorts"
"AHC","A.H. Belo Corporation","Consumer Services","Newspapers/Magazines"
"AIR","AAR Corp.","Capital Goods","Aerospace"
"AAN","Aaron's, Inc.","Technology","Diversified Commercial Services"
Now we can import it into AmiBroker and automatically setup all sectors and industries using this format definition
$FORMAT Ticker, FullName,SectorName,IndustryName
The last two commands ($CLEANSECTORS and $SORTSECTORS) instruct AmiBroker to clean (wipe) existing sector/industry names before importing and sort newly imported sectors after importing so they appear alphabetically
AmiBroker will read such ASCII file one-by one, then it will check whenever given sector name/industry name already exists, if not - it will create new sector/industry. Then it will assign given symbol to specified sector/industry.
The result will be a database with new sector/industry structure being set up and symbols assigned to proper sectors and industries.
Described functionality is used to implement Tools->Update US symbol list and categories tool.
One-click "Update US symbol list and categories"
Automatic setup and update of US stock database is available from Tools->Update US symbol list and categories menu. This is implemented using new #import command and new ASCII importer commands described above.
The command downloads symbol, sector and industry list from amibroker.com web site and create or update current database with stocks listed on NYSE, Nasdaq and AMEX. It also creates sector and industry structure and assigns stocks to proper industries.
CAVEAT: Be aware that using this tool will WIPE (delete) any existing sectors/industries and replace them with the ones imported automatically.
Note about GICS
GICS stands for Global Industry Classification Standard (http://en.wikipedia.org/wiki/Global_Industry_Classification_Standard).
AmiBroker allows also GICS 4-level classification system, but demo database does not have symbols classified according to that standard. You can find GICS classification codes in GICS.txt file inside AmiBroker folder.
Note about ICB
ICB stands for Industry Classification Benchmark (http://en.wikipedia.org/wiki/Industry_Classification_Benchmark).
AmiBroker allows also ICB 4-level classification system, but demo database does not have symbols classified according to that standard. You can find ICB classification codes in ICB.txt file inside AmiBroker folder.