Example integration - Yahoo stocks

Performance Analytics includes an optional example integration that demonstrates how to fetch data from the Yahoo stocks service and display it on a Performance Analytics dashboard.

The integration allows you to regularly query stock information for various stock symbols from the Yahoo service, and display that stock information over time using Performance Analytics.

The integration uses outbound REST to query the Yahoo API. You can customize this query in the StockQuotesCollector script include. All stock information is stored on the u_pa_stock_symbols table.

To use the Yahoo stocks integration you must activate the Performance Analytics - Example - Stocks Quotes plugin. Activating this plugin also adds the 50d running AVG, 100d running AVG, and 200d running AVG time series.

Configure Yahoo stocks integration

Configure the Yahoo stocks integration to display stock quote information in Performance Analytics.

Before you begin

Role required:

pa_stock_quotes_user, pa_stock_symbols_user, and pa_admin

Procedure

  1. Navigate to Stock Quotes > Symbols.
  2. Define which stocks you want to track by adding a new record for each stock symbol, such as NOW.
  3. Navigate to Stock Quotes > Stock Quotes Collector.
  4. Schedule this job to run at least once.
    The initial data collection job runs. Wait for this job to complete before moving on.
  5. Navigate to Stock Quotes > PA Data Collector Job.
  6. Schedule this job to run at least once.

What to do next

After collecting the stock information, navigate to Stock Quotes > Dashboard to view the collected information.

Visualizing Yahoo stock data

You can display Yahoo stock information in a widget.

The UI macro pa_stock_quote_widget allows you to visualize stock quote information for a specific stock symbol. This widget displays real time data based on the u_pa_stock_quotes table.

This example shows a dynamic content block displaying stock data for the NOW symbol.

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:macro_invoke macro="pa_stock_quote_widget" symbol="NOW"/>
</j:jelly>