The Portfolio Manager demo runs an application that is based on a financial use case.
You run scripts that create a portfolio of stocks.
The Portfolio Manager demo runs an application that is based on a financial use case.
You run scripts that create 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. Each portfolio gets updated based on its overall value and the
percentage of gain or loss compared to the purchase price. The 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 Spark Scala 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.
Procedure
To run the demo:
Note: DataStax Demos do not work with either
LDAP or internal authorization (username/password) enabled.
-
Install a single Demo node using the DataStax Installer in GUI or Text mode with the following
settings:
- Install Options page - Default
Interface: 127.0.0.1 (You must use this IP for the
demo.)
- Node Setup page - Node Type:
Analytics
- Analytic Node Setup page - Analytics
Type: Spark + Integrated Hadoop
-
Start DataStax Enterprise if you haven't already:
-
Go to the Portfolio Manager demo directory.
The default location of the Portfolio Manager demo
depends on the type of installation:
Installer-Services and Package
installations |
/usr/share/dse/demos/portfolio_manager |
Installer-No Services and Tarball
installations |
install_location/demos/portfolio_manager |
-
Run the bin/pricer utility to generate stock data for the application:
The pricer utility takes several minutes to run.
-
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 Spark by running the
10-day-loss.sh
script.
- Installer-Services:
$ cd /usr/share/dse/demos/spark;
./10-day-loss.sh
- Package installations:
$ cd /usr/share/dse-demos/spark;
./10-day-loss.sh
- Installer-No Services and Tarball installations:
$
install_location/demos/spark/10-day-loss.sh
The Spark application takes several minutes to run.
-
After the job completes, refresh the Portfolio Manager web
page.
The results of the Largest Historical 10 day Loss for each portfolio are
displayed.