Home | Assignments | Journal | Progress | Proposal | Techlab

Iteration V

10 December 2002

Plan

I intend to continue my work in PHP, building on the progress made in Iteration IV, by obtaining data from Yahoo! Finance regarding listings (i.e., companies and corporations) on the major American indices through a form. The data displayed will be current price (in dollars) and its change from the start of the current session (both in dollars amd in percent) relative to the closing price from the previous session. Also slated for display are the exchange on which the listing is traded and a variety of technical data—P/E Ratio (Price / Earnings), PEG (P/E Ratio / Growth), Earnings (in dollars), Market Capitalization (in dollars), Volume for the current session (in shares), and Average Volume for a single session. The home page for this project, index.php, will be expanded and formatted to display these data in result.php, the action page required for processing a form. This iteration will complete the promise of Iteration IV to display information pertaining to user-selected quotes in the American markets. As in the previous iteraton, some form of the code produced in this iteration will be incorporated into the user interface.

Design

This iteration will use three PHP pages to accomplish the abovementioned goals. The form will be placed on index.php, leading to result.php after processing by fn.php. The results page will include all information contained in the preceding index.html, in addition to data provided by a new function, techdata, in fn.php. The process of obtaining data is described in detail in the report for the previous iteration. Considerations in this phase include else statements to handle the distinct possiblity of a particular datum being unavailable at Yahoo! Finance and formatting deviations between Yahoo! Finance and my intended design. I will continue to use echo statements to properly construct the display table and display the data in the desired format. To accomplish the latter objective, I will modify the strings obtain through the function preg_match with the function substr, which allows programmers to designate the number and position of characters desired in the source string. Unlike the function retrieve, techdata will contain the entirety of the code for the output table because having all additions from the original page to the result page occur in through the functions page will facilitate the transition from index.php and result.php.

Code

In the above statements, I indicated that coding will occur in PHP in the three pages with .php extensions. Using echo statements allows for HTML code to be embedded in the PHP pages, providing appropriate results on the final page. The ability to display results in the language used for programming will allow the code to validate itself by displaying the desired results. The use of a form, explored in Quarter I through php.net will be the mechanism that triggers the transition from index.php to result.php. The form will not be included on the resulting page. In fulfilling the general requirements for Quarter II, I will comment all code clearly and abundantly.

The result of the code is index.php. The following link provides the code, as a text file, for fn.php.

Testing

I accomplished the objectives declared in the above plan, completing the iteration as intended. The results for this iteration are displayed on the homepage of this project's website, as will other improvements and additions until the interface becomes available. Output can be verified through a variety of financial sites. The problem of excessive delay in the loading of the results as described in Iteration IV did not materialize to the extent described when using computers in the Computer Systems Lab. Therefore, until the phase of optimization, currently slated for late in Quarter III, I will maintain the current system of "opening" and "closing" Yahoo! Finance several times, in order to focus on pursuits more closely related to Nick's endeavors. I intend to retrieve historical prices for selected quotes, using methods similar to those in this iteration.

Progress

Home