# 🌎 Build Dappier Stock & Financial News Analyst using OpenAI's Custom GPT
Source: https://docs.dappier.com/cookbook/recipes/open-ai-dappier-stock-analyst



## Introduction

This guide walks you through setting up **Dappier Stock & Financial News Analyst**, a custom OpenAI GPT model that integrates with Dappier's [Real-Time Data API](https://docs.dappier.com/api-reference/endpoint/real-time-search) to deliver structured stock trend analysis and financial insights. This GPT helps users analyze stock movements, market trends, and investment insights while ensuring accurate and actionable responses.

## Watch the Video Guide

If you prefer a visual walkthrough, check out the accompanying video guide below:

<iframe width="560" height="315" src="https://www.youtube.com/embed/PQW3RB2cobU?si=YFNLQfmMKtrONXfQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen />

## Prerequisites

Before you begin, ensure you have:

* An OpenAI account
* API access to create and configure custom GPTs
* A **Dappier API Key** (Get it from [Dappier API Keys](https://platform.dappier.com/profile/api-keys))

***

## Step 1: Access the GPT Builder

1. Navigate to OpenAI’s [Custom GPT Page](https://chat.openai.com/gpts/editor)
2. Log in to your OpenAI account
3. Click on **"Create a GPT"** to begin customization

***

## Step 2: Define GPT Characteristics

### Name

Set the GPT’s name to **Dappier Stock & Financial News Analyst**

### Description

Use the following description:

> Delivers stock trend analysis and financial insights with ticker-specific investment context.

### Instructions

This GPT provides **structured financial insights** by analyzing:

* **Market trends**
* **Stock prices**
* **Financial news**

When answering financial queries, it:

* **Reformulates prompts** to ensure comprehensive investment insights before calling the Dappier API.
* **Ensures all queries contain a stock ticker symbol** (required by the Dappier API).
* **Requests all relevant market trends and financial data** before providing insights.
* **Prioritizes concise, actionable insights** rather than generic news updates.
* **Avoids making direct investment recommendations** but helps users interpret data effectively.

The GPT will not process API queries unless the **required ticker information** is included.

***

## Step 3: Configure API Integration

### API Endpoint

Your GPT will communicate with the **Dappier Stock & Financial Data API** at:

```
https://api.dappier.com/app/aimodel/am_01j749h8pbf7ns8r1bq9s2evrh
```

### Authentication

Use **Bearer Token** authentication. Include the API key in the `Authorization` header:

```
Authorization: Bearer <your_api_key>
```

### Request Body Format

Send queries in JSON format:

```json  theme={null}
{
  "query": "Analyze stock trends of AAPL and TSLA with the latest market insights."
}
```

### Example API Request (cURL)

```sh  theme={null}
curl -X POST "https://api.dappier.com/app/aimodel/am_01j749h8pbf7ns8r1bq9s2evrh" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "Analyze stock trends of AAPL and TSLA with the latest market insights."}'
```

***

## Step 4: Configure Capabilities

### Sample Conversation Starters

* **Create an investment strategy by analyzing stock trends of the Big 7 and financial news (TSLA, AAPL, NVDA, etc.).**
* **What are the latest market trends impacting major stocks like AAPL and MSFT?**
* **How should I adjust my portfolio based on current financial news for TSLA and NVDA?**
* **Analyze today's financial news and suggest key insights for AMZN and META.**
* **How are the Big 7 stocks (AAPL, MSFT, GOOGL, AMZN, NVDA, TSLA, META) performing this week?**
* **What sectors are showing strong momentum based on recent stock trends, including SPY and QQQ?**
* **Can you summarize key takeaways from today's market movement for TSLA and AMZN?**
* **Which stocks (AAPL, NVDA, TSLA) are gaining the most from recent economic policy changes?**

***

## Step 5: Import API Schema

To ensure proper interaction, import the **OpenAPI schema**:

```json  theme={null}
{
  "openapi": "3.1.0",
  "info": {
    "title": "Dappier Real-Time Stock & Financial News Analyst",
    "description": "Fetch real-time AI stock and financial insights with web search integration using Dappier's API. AI generates quick investment insights based on trending financial news and analysis.",
    "version": "v1.0.0"
  },
  "servers": [
    {
      "url": "https://api.dappier.com"
    }
  ],
  "paths": {
    "/app/aimodel/am_01j749h8pbf7ns8r1bq9s2evrh": {
      "post": {
        "description": "Query real-time stock and financial news data from Dappier, including market trends, financial news, and investment insights.",
        "operationId": "getRealTimeFinancialData",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response with real-time financial insights",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyBearer": []
          }
        ]
      }
    }
  }
}
```

***

## Step 6: Test and Iterate

1. Use the OpenAI GPT interface to test queries like:
   * "Analyze stock trends of AAPL and TSLA with the latest financial news."
   * "What are the top investment insights from today’s market trends?"
2. Ensure responses are **accurate and formatted correctly**.
3. Refine GPT behavior by adjusting **instructions** as needed.

***

## Step 7: Deploy and Share

Once finalized, you can:

* **Share your GPT** publicly or privately
* **Embed it in financial applications**
* **Continuously refine it** based on feedback

**Sharing Options:**

* **Private**: Only accessible to you
* **Unlisted**: Accessible via a direct link
* **Public**: Available in the GPT Store

***

## Privacy & Security

* All API interactions must comply with **OpenAI and Dappier’s terms**.
* Keep your API key **secure** and do not expose it publicly.
* Review Dappier’s [Privacy Policy](https://dappier.com/privacy-policy/) for more details.

***

## Conclusion

You have now successfully created a **Dappier Stock & Financial News Analyst GPT**, integrating real-time financial data for actionable insights. Keep refining it to enhance user experience!