Issue 7/2000 |
AmiBroker Tips weekly newsletter. Issue 7/2000. Copyright (C)2000 Tomasz Janeczko. All back issues available from: http://www.amibroker.com/newsletter/ |
Welcome to the 7th issue of AmiBroker Tips newsletter. This issue features
an article that (hopefully) will help you understand how sectors and industries
work in AmiBroker.
By the way: Do you find this newsletter useful? Have any comments/suggestions or article ideas. Please don't hesitate to drop a line to newsletter@amibroker.com
A new version (3.42) is available now for download from AmiBroker web site. Version 3.42 introduces very important bug fixes to previous versions. A bug was found in automation interface that affected Sharenet downloads when ticker name changes occurred. This version is the first one that handles changing ticker from the script correctly. Also a new setup now includes a new script for Sharenet downloader that displays now a list of erroneous lines found in the data. It is installed by default along with proper Custom Tools item setup so problems with previous version should finally disappear.
3 Tip of the week: Understanding sectors and industries
AmiBroker has an ability to assign stocks to different categories allowing you (when properly set up) to narrow your analysis searches to the stocks 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 stocks. This article will focus on setting up sectors and industries and assigning the stocks to them. First let me discuss some basic ideas.
3.1 Basics - predefined sectors and industries
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:
Sector | Industry |
---|---|
Basic Materials (0) | Chemical Manufacturing |
Chemicals - Plastics & Rubber | |
Containers & Packaging | |
Fabricated Plastic & Rubber | |
Forestry & Wood Products | |
Gold & Silver | |
Iron & Steel | |
Metal Mining | |
Misc. Fabricated Products | |
Non-Metallic Mining | |
Paper & Paper Products | |
Capital Goods (1) | Aerospace & Defense |
Constr. - Supplies & Fixtures | |
Constr. & Agric. Machinery | |
Construction - Raw Materials | |
Construction Services | |
Misc. Capital Goods | |
Mobile Homes & RVs | |
Conglomerates (2) | Conglomerates |
Consumer Cyclical (3) | Apparel/Accessories |
Appliance & Tool | |
Audio & Video Equipment | |
Auto & Truck Manufacturers | |
Auto & Truck Parts | |
Footwear | |
Furniture & Fixtures | |
Jewelry & Silverware | |
Photography | |
Recreational Products | |
Textiles - Non Apparel | |
Tires | |
Consumer/Non-Cyclical (4) | Beverages (Alcoholic) |
Beverages (Non-Alcoholic) | |
Crops | |
Fish/Livestock | |
Food Processing | |
Office Supplies | |
Personal & Household Prods. | |
Tobacco | |
Energy (5) | Coal |
Oil & Gas - Integrated | |
Oil & Gas Operations | |
Oil Well Services & Equipment | |
Financial (6) | Consumer Financial Services |
Insurance (Accident & Health) | |
Insurance (Life) | |
Insurance (Miscellaneous) | |
Insurance (Prop. & Casualty) | |
Investment Services | |
Misc. Financial Services | |
Money Center Banks | |
Regional Banks | |
S&Ls/Savings Banks | |
Healthcare (7) | Biotechnology & Drugs |
Healthcare Facilities | |
Major Drugs | |
Medical Equipment & Supplies | |
Services (8) | Advertising |
Broadcasting & Cable TV | |
Business Services | |
Casinos & Gaming | |
Communications Services | |
Hotels & Motels | |
Motion Pictures | |
Personal Services | |
Printing & Publishing | |
Printing Services | |
Real Estate Operations | |
Recreational Activities | |
Rental & Leasing | |
Restaurants | |
Retail (Apparel) | |
Retail (Catalog & Mail Order) | |
Retail (Department & Discount) | |
Retail (Drugs) | |
Retail (Grocery) | |
Retail (Home Improvement) | |
Retail (Specialty) | |
Retail (Technology) | |
Schools | |
Security Systems & Services | |
Waste Management Services | |
Technology (9) | Communications Equipment |
Computer Hardware | |
Computer Networks | |
Computer Peripherals | |
Computer Services | |
Computer Storage Devices | |
Electronic Instruments & Controls | |
Office Equipment | |
Scientific & Technical Instr. | |
Semiconductors | |
Software & Programming | |
Transportation (10) | Air Courier |
Airline | |
Misc. Transportation | |
Railroads | |
Trucking | |
Water Transportation | |
Utilities (11) | Electric Utilities |
Natural Gas Utilities | |
Water 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 stock 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.
3.2 How to assign stock to the industry?
You can change the industry to which given stock is assigned by using Stock->Information dialog (Industry combo box)
or using Stock->Organize Assignments.
The first method is fine if you want to change single stock settings. The latter is better if you want to move multiple stocks from one category to another.
3.3 How to define your own sectors and industries
Please go to Stock->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.
3.4 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), stock data files hold only the information about the assignment of the stock 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:
Basic Materials
Capital Goods
Conglomerates
Consumer Cyclical
Consumer/Non-Cyclical
Energy
Financial
Healthcare
Services
Technology
Transportation
Utilities
The layout of broker.industries is similar, but in addition to industry names there is a number at the beginning of each line:
8 Advertising
1 Aerospace & Defense
10 Air Courier
10 Airline
3 Apparel/Accessories
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
5 Coal
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 stocks 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
2 Conglomerates
3 Consumer Cyclical
4 Consumer/Non-Cyclical
5 Energy
6 Financial
7 Healthcare
8 Services
9 Technology
10 Transportation
11 Utilities
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.
3.5 Making it automatic
As described above stock 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 Stock->Categories window.
Unfortunately a lot more work is needed to assign all stocks to the industries even using Stock->Organize Assignments dialog. Fortunately there is a way to save a lot of work using AmiBroker automation interface and scripting. The detailed description of how to accomplish this task and ready-to-use script is presented in the 4th issue of AmiBroker Tips newsletter.
.... and that's all for this week - hope you enjoyed reading
AmiBroker Tips weekly newsletter. Issue 7/2000. Copyright (C)2000 Tomasz Janeczko. All back issues available from: http://www.amibroker.com/newsletter/