Get Stocks Data

Use this recipe to get the stock-related data of a company from an external source and send the details to the caller as a response.

Note:

This recipe is available as Oracle REST Stock Service in the Integration Store. Oracle provides this recipe as a sample only. The recipe is meant only for guidance, and is not warranted to be error-free. No support is provided for this recipe.

Overview

This recipe demonstrates how to get the stock-related data of a particular company on a certain date from an external source and send the stock details to the caller as a response.

To use the recipe, you must configure the Oracle REST Get Stock Quote Connection by specifying the connection URL of a stocks application (for example, https://api.polygon.io/v1/open-close). Subsequently, you can trigger the first REST Adapter of the recipe by specifying a company symbol, date, and the API key for the connection URL. The second REST Adapter (which uses the REST connection you configured) is then invoked in the integration, and it fetches the stock details from the specified connection URL. The response containing the stock-related data is returned to you.

A logging message is created and logged to the activity stream for viewing.

You can also track the integration and monitor the message status.

You can invoke the REST API using the following command to get the stock-related data through the recipe:
GET: https://host:port/ic/api/integration/v1/flows/rest/ORCL-R-REST_STOCK_SERVICE/1.0/v1/open-close?symbol={company_symbol}&date={date}&apiKey={api_key}
Example Response Payload:
{
    "status": "OK",
    "from": "2020-09-09",
    "symbol": "IBM",
    "open": 122.13,
    "high": 123.7,
    "low": 121.29,
    "close": 122.26,
    "volume": 3875357,
    "afterHours": 122.7,
    "preMarket": 121.95
}

System and Access Requirements

  • Oracle Integration

  • A stocks application's connection URL and API key

Install, Configure, and Run the Recipe

For more information and steps to install, configure, and run recipes, see Get Started with Integration Accelerators and Recipes.

To use this recipe, you must configure the Oracle REST Get Stock Quote Connection. You must supply the following information when you configure this connection.

Connection Name Parameters

Oracle REST Get Stock Quote Connection

Connection Properties

  • Connection Type: REST API Base URL.
  • Connection URL: The connection URL of a stocks application (for example, https://api.polygon.io/v1/open-close).

Security

  • Security Policy: API Key Based Authentication.
  • API Key: The API key for the connection URL.

For more details, see Create a REST Adapter Connection.