Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Introduction to SourcePro C++
Rogue Wave web site:  Home Page  |  Main Documentation Page

5.2 Example Using Modules from SourcePro Core, SourcePro DB, and SourcePro Net

The following example transports stock quotes from a quote service, and persists them to a local database for analysis. Three SourcePro C++ products work together here: SourcePro Net, SourcePro DB, and SourcePro Core.

In the example, class Stock is written so that it can pull past stock closing values from the local database, or real-time quotes from Yahoo!TM. The Essential Networking Module and the Internet Protocols Module are the enabling technologies behind the connection to Yahoo!, whereas the DB Interface Module enables the local persistence of the historical data. You can understand how the different product groups are leveraged by looking at the two different constructors of Stock. When a Stock instance is constructed with a date, historical data is used from the RDBMS. If the date is omitted, the current value is used; if the market is closed, the closing value of the market is used.

The example performs a simple analysis through the Graph class. This analysis could range from calculating the P/E ratio or the book value/share, to generating recommendations based on the MACD, or any of the other common tasks in the financial industry. Alternatively, instead of stock information, the data could be real-time product pricing from a supplier to a retailer.


The following example was built and tested using Solaris 8 / Forte 6, update 2, 32-bits (both static and dynamic builds). Depending on your environment and the options chosen when you build your SourcePro libraries, minor syntactical changes may be needed to build this example.

Example 4: Using five modules

Below is the program output for a stock, here identified simply as"XYZ", over a four-day period. Each column in the graph represents the relative closing stock price on a particular day.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.