Common Classes

Stock Browser has, stored in a shared library, a few classes that are commonly used by its subsystems:

TStockDay is the basic unit of real stock data in Stock Browser. It contains a date, the high, low and closing price, and the volume of a particular stock traded on a particular date.

TLocalStockData is a concrete class derived from TStockData. It maintains a TCollectionOf<TStockDay> so that the actual stock data can be bundled up with the stock name into one object.

TStockException derives from TStandardException. Since TStockException is used by the Stock Server, Stock Picker and Stock Viewer subsystems it must be fairly general-purpose. TStockException provides two error codes to indicate the error generated: kCouldNotComplete and kDataInaccessible.

The Stock Viewer is unaware that a server exists, and the Stock Picker is barely aware (only the presenter class knows). The only thing that's important to either the Stock Viewer or the Stock Picker is that data is successfully or unsuccessfully retrieved. TStockException::kCouldNotComplete indicates the success or failure of a data-retrieval operation. This type of exception is thrown when data is irretrievable due to a problem in obtaining it. For example, when TRemoteStockData calls TStockCaller::CopyStockData this object catches all TRemoteCallException objects thrown by the caller. If it catches one, it throws a TStockException with the kCouldNotComplete error code.

TStockException::kDataInaccessible indicates that the data couldn't be located. For example, TStockServer::CreateOrOpenDiskDictionary throws this type of exception when the persistent store of stock data could not be opened.

TRangeOfDays is a way of specifying a range of days. This is useful in retrieving data from TStockData when a subset of stock data is needed.

You can specify a subset of the total data available for a stock. For example, to obtain the weekly closing prices of a specific stock between the months of July and September, you need to:

The collection is filled with stock information for the days between July 1, 1993 and September 30, 1993, inclusive. To obtain weekly information, you must iterate through the collection and group the data as appropriate.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker