A demonstration of a financial application where users can actively create and
manage a portfolio of stocks.
The use case is a financial application where users can actively create and manage a
portfolio of stocks. On the Cassandra OLTP (online transaction processing) side,
each portfolio contains a list of stocks, the number of shares purchased, and the
purchase price. The demo's pricer utility simulates real-time stock data where each
portfolio updates based on its overall value and the percentage of gain or loss
compared to the purchase price. This utility also generates 100 days of historical
market data (the end-of-day price) for each stock. On the DSE OLAP (online
analytical processing) side, a Hive MapReduce job calculates the greatest historical
10 day loss period for each portfolio, which is an indicator of the risk associated
with a portfolio. This information is then fed back into the real-time application
to allow customers to better gauge their potential losses.
Prerequisites
Before running the demo, make sure the following items have been completed:
- A single-node or multiple node instance of DataStax Enterprise is
installed.
- The cluster is configured and running.
Procedure
To run the demo:
-
Check which mode DataStax Enterprise is running in:
- Packaged installs:
$ nodetool status
- Tarball installs:
$ bin/nodetool status
-
If the data center is not Analytics, stop the
node:
-
Start DataStax Enterprise as an analytics node:
-
Go to the portfolio manager demo directory:
-
Test whether the dse-demos directory exists.
-
If the directory does not exist:
$ install_dir/bin/make-dse-demos.sh
The dse-demos directory is created in your
current directory.
- GUI/Text Services and package installations:
$
cd ~/dse-demos/portfolio_manager
- GUI/Text No Services and tarball installations:
$ cd
install_location/dse-demos/portfolio_manager
- Ran script to create directory
$ cd
dir-you-ran-script-in/dse-demos
-
Start the web service:
-
Open a browser and go
to http://localhost:8983/portfolio.
The real-time Portfolio Manager demo application is displayed.
-
Open another terminal.
-
Start Hive and run the MapReduce job for the demo in Hive.
- GUI/Text Services and package installations:
$ dse hive -f
/usr/share/dse-demos/portfolio_manager/10_day_loss.q
- GUI/Text No Services and tarball installations:
$
install_location/bin/dse hive -f
install_location/demos/portfolio_manager/10_day_loss.q
The MapReduce job takes several minutes to run.
-
To watch the progress in the job tracker, open the following URL in a
browser.
http://localhost:50030/jobtracker.jsp
-
After the job completes, refresh the Portfolio Manager web
page.
The results of the Largest Historical 10 day Loss for each portfolio are
displayed.