Ruby: Stock Project - Database Design
Now that we have data files, we need to examine them and see what we will have for a database design.
| Fields | NYSE | AMEX | NASDQ |
| Name | Yes | Yes | Yes |
| Symbol | Yes | Yes | Yes |
| Market Value | Yes | Yes | Yes |
| Description | Yes | Yes | Yes |
| Security Type | No | No | Yes |
| Shares Outstanding | No | No | Yes |
Looking at the fields there are two tables we will need to have.
1. A table to hold the values for the different stock exchanges
2. A table to hold the values for the individual stocks
Name, Symbol, and description all exist in all 3 files. We'll use these plus add a stock_id field, and exchange_id to our stocks table.
Security type might be useful, but since it is only in the NASDQ we'll toss it for now. Market value is a basic calculation based on share and share price. It doesn't need to be stored, it is always changing and should not be on the mainly static information a the stocks table.
Shares outstanding is another dynamic amount that could change over time so it really doesn't belong in the stocks table. Since it is only in the NASDQ data file, we'll not include it here and see if we can gather this information someplace else. Shares outstanding will be needed when comparing trading volumes to total shares outstanding to get a volatility value on a stock.
With Decisions made it's now time to set up the Database.

0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home