Financial Analyst

Financial analysis requires making sense of vast amounts of data spread across earnings reports, financial statements, analyst reports and more. Manually combing through all this information to gain useful insights can be extremely tedious and time consuming. This is where AI techniques like document understanding and conversational interfaces can help. In this post, we'll explore how a financial analyst can integrate documentAI into their workflow to quickly build a chatbot assistant that can read and comprehend their collection of financial documents. By uploading reports and statements, an analyst can instantly start having natural conversations with the assistant to get answers, discover connections, and uncover insights faster.

Benefits of a chat interface

A chat interface for financial analysis has several advantages:

  • Quick access to documents - Analysts can ask questions and rapidly retrieve information from financial documents without having to manually locate and search through them.
  • Connecting insights - The assistant can identify relationships and connections between data points across multiple reports to uncover trends and patterns.
  • Summarization - Provides quick summaries of reports or earnings calls to get the key facts and highlights.
  • Forecasting assistance - Can help generate financial forecasts and projections based on historical data and trends identified across documents.
  • Competitive benchmarking - Enable comparative analysis against financials of peer companies to put performance in context.
  • Personalization - Can tailor examples and responses based on the analyst's company and sector context.
  • Multilingual - Supports interacting in the analyst's preferred language through machine translation.
  • 24/7 availability - Provides timely access to financial insights anytime without having to wait for human assistance.
  • Revealing blindspots - Identifies overlooked risks, changes or inconsistencies by comprehensively connecting data points.
  • Efficiency - Saves significant time by automating manual financial analysis tasks. Lets analysts focus on higher value work.

Get your API key

First get your API key from the console. Authenticate requests by passing this key in the X-API-KEY header. Learn more about authentication here.

Upload your reports

There are 2 options to ingest the reports, you can either download an external document or you can upload it directly.

Downloading

The easiest way to ingest reports is to download them. See documentation for details.

Download Report
curl -X POST https://api.documentai.dev/v1/collections/[COLLECTION ID]/document \
     -H 'X-API-KEY: [YOUR API KEY]' \
     -d '{"url": "[REPORT URL]"}'

Where:

Downloading is asynchronous, the response will contain a documentId, using which you can check status as per documentation.

Download Report response
{
  "collectionId": "[COLLECTION ID]",
  "documentId": "b0dd63b1-f78c-4989-94f9-f73768bb12dd",
  "status": {
    "date": "2023-09-03T12:22:36.291790Z",
    "status": "QUEUED"
  }
}

Uploading files

If you have your reports stored locally you can also upload them directly. To do this you can use the upload API, full reference here.

Upload reports
curl -X PUT https://api.documentai.dev/v1/collections/[COLLECTION ID]/upload \
     -H 'X-API-KEY: [YOUR API KEY]' \
     --form file=may_report.pdf \
     --form file=june_report.docx

Where:

  • COLLECTION ID - ID of the collection, reuse existing or specify new.
  • API KEY - the API key from the console.

You can upload multiple files if needed in a single request. The upload is asynchronous and you can monitor the status of your upload job using check upload API. The response will contain an uploadId.

Upload response
{
  "collectionId": "[COLLECTION ID]",
  "uploadId": "6f207f16-c30b-47ef-9a58-efea9df9ae73"
}

Integrate chatbot

After the download or upload is completed you can integrate with the chat API. Full reference is available here. The conversational interface provides a natural UX for analysts to ask questions about the content of their uploaded financial documents. The assistant can leverage its extensive business and finance knowledge to not just retrieve data but provide useful insights that connect the dots across reports. This helps the analyst quickly understand key points within documents, identify trends and relationships between them, and derive higher-level conclusions from their collection. The assistant augments the analyst's own expertise through the knowledge encoded in the language model to uncover non-obvious insights. Rather than simply searching for answers, it can provide strategic recommendations relevant to the analyst's specific context and objectives.

Send Message
curl -X POST https://api.documentai.dev/v1/collections/[COLLECTION ID]/chat/[CHAT ID] \
     -H 'X-API-KEY: [YOUR API KEY}' \
     -d '{"message": [YOUR MESSAGE]}'

Where:

  • COLLECTION ID - ID of the collection, reuse existing or specify new.
  • API KEY - the API key from the console.
  • CHAT ID - the id of the chat. You decide the id of the chat and do not need to explicitly create it. All previous messages in a chat will be evaluated by the LLM.
  • MESSAGE - the message you want to send.

Chat response
{
  "sender": "ASSISTANT",
  "message": {
    "id": "553beb15-9f2b-4c97-857f-94963bbce84f",
    "date": "2023-09-03T12:24:09.026440Z",
    "content": "According to the document, Apple Inc. sold 39,669 iPhones in the most recent reporting period.",
    "context": [
      {
        "collectionId": "[COLLECTION ID]",
        "documentId": "b0dd63b1-f78c-4989-94f9-f73768bb12dd",
        "chunkId": "348a8973-4fc6-42ba-a557-0d89ea8aef54",
        "content": "Rest of Asia Pacific  5,630    6,150    23,284    23,002  \nTotal net sales ! 81,797   ! 82,959  ! 293,787   ! 304,182  \n        \n(1) Net sales by category:        \niPhone ! 39,669  ! 40,665  ! 156,778   ! 162,863  \nMac  6,840   7,382    21,743    28,669 \niPad  5,791    7,224    21,857    22,118  \nWearables, Home and Accessories  8,284    8,084    30,523    31,591  \nServices  21,213    19,604    62,886   58,941  \nTotal net sales ! 81,797   ! 82,959  ! 293,787   ! 304,182  \n \n \n \n \nApple Inc. \nCONDENSED CONSOLIDATED BALANCE SHEETS (Unaudited) \n(In millions, except number of shares which are reflected in thousands and par value) \n \n July 1, \n2023  September 24, \n2022 \nASSETS: \nCurrent assets:    \nCash and cash equivalents ! 28,408  ! 23,646 \nMarketable securities  34,074    24,658  \nAccounts receivable, net  19,549    28,184  \nInventories  7,351    4,946 \nVendor non-trade receivables  19,637    32,748  \nOther current assets  13,640    21,223  \nTotal current assets  122,659    135,405",
        "metadata": {}
      },
      {
        "collectionId": "[COLLECTION ID]",
        "documentId": "b0dd63b1-f78c-4989-94f9-f73768bb12dd",
        "chunkId": "bf3d056f-073b-46e2-b08b-7914fc511ba8",
        "content": "Apple Inc. \nCONDENSED CONSOLIDATED STATEMENTS OF OPERATIONS (Unaudited) \n(In millions, except number of shares which are reflected in thousands and per share amounts) \n Three Months Ended  Nine Months Ended \n July 1, \n2023  June 25, \n2022  July 1, \n2023  June 25, \n2022 \nNet sales:        \n   Products ! 60,584  ! 63,355  ! 230,901   ! 245,241  \n   Services  21,213    19,604    62,886   58,941  \nTotal net sales (1)  81,797    82,959   293,787    304,182  \nCost of sales:        \n   Products  39,136    41,485    146,696    155,084  \n   Services  6,248    5,589    18,370    16,411  \nTotal cost of sales  45,384   47,074    165,066    171,495  \nGross margin  36,413    35,885   128,721    132,687  \n        \nOperating expenses:        \nResearch and development  7,442    6,797    22,608   19,490  \nSelling, general and administrative  5,973    6,012    18,781    18,654  \nTotal operating expenses  13,415    12,809    41,389    38,144",
        "metadata": {}
      },
      {
        "collectionId": "[COLLECTION ID]",
        "documentId": "b0dd63b1-f78c-4989-94f9-f73768bb12dd",
        "chunkId": "858ec3d6-770f-40ac-a203-5dd219c1482d",
        "content": "Common stock and additional paid-in capital, !0.00001 par value: 50,400,000 shares \nauthorized; 15,647,868 and 15,943,425 shares issued and outstanding, respectively  70,667    64,849 \nRetained earnings/(Accumulated deficit)  1,408    (3,068) \nAccumulated other comprehensive income/(loss)  (11,801)   (11,109) \nTotal shareholders’ equity  60,274    50,672  \nTotal liabilities and shareholders’ equity ! 335,038  ! 352,755  \n \n \n \n \nApple Inc. \nCONDENSED CONSOLIDATED STATEMENTS OF CASH FLOWS (Unaudited) \n(In millions) \n \n Nine Months Ended \n July 1, \n2023  June 25, \n2022 \nCash, cash equivalents and restricted cash, beginning balances ! 24,977  ! 35,929 \n    \nOperating activities:    \nNet income  74,039    79,082  \nAdjustments to reconcile net income to cash generated by operating activities:    \nDepreciation and amortization  8,866   8,239  \nShare-based compensation expense  8,208    6,760  \nOther  (1,651)   2,695  \nChanges in operating assets and liabilities:",
        "metadata": {}
      }
    ]
  }
}

You can also retrive the whole conversation using get chat API.

Get Chat
curl -X GET https://api.documentai.dev/v1/collections/[COLLECTION ID]/chat/[CHAT ID] \
     -H 'X-API-KEY: [YOUR API KEY}'

Where:

  • COLLECTION ID - ID of the collection, reuse existing or specify new.
  • API KEY - the API key from the console.
  • CHAT ID - the id of the chat. You decide the id of the chat and do not need to explicitly create it. All previous messages in a chat will be evaluated by the LLM.

The response will include both your messages and assistant's messages with the relevant context so you can link back to the source.

GET Chat response
{
  "messages": [
    {
      "sender": "USER",
      "id": "d595de0e-4664-43a6-b03b-396bb05933a4",
      "date": "2023-09-03T11:24:09.026440Z",
      "content": "How many iPhones did they sell?",
      "context": []
    },
    {
      "sender": "ASSISTANT",
      "message": {
        "id": "553beb15-9f2b-4c97-857f-94963bbce84f",
        "date": "2023-09-03T12:24:09.026440Z",
        "content": "According to the document, Apple Inc. sold 39,669 iPhones in the most recent reporting period.",
        "context": [
          {
            "collectionId": "[COLLECTION ID]",
            "documentId": "b0dd63b1-f78c-4989-94f9-f73768bb12dd",
            "chunkId": "348a8973-4fc6-42ba-a557-0d89ea8aef54",
            "content": "Rest of Asia Pacific  5,630    6,150    23,284    23,002  \nTotal net sales ! 81,797   ! 82,959  ! 293,787   ! 304,182  \n        \n(1) Net sales by category:        \niPhone ! 39,669  ! 40,665  ! 156,778   ! 162,863  \nMac  6,840   7,382    21,743    28,669 \niPad  5,791    7,224    21,857    22,118  \nWearables, Home and Accessories  8,284    8,084    30,523    31,591  \nServices  21,213    19,604    62,886   58,941  \nTotal net sales ! 81,797   ! 82,959  ! 293,787   ! 304,182  \n \n \n \n \nApple Inc. \nCONDENSED CONSOLIDATED BALANCE SHEETS (Unaudited) \n(In millions, except number of shares which are reflected in thousands and par value) \n \n July 1, \n2023  September 24, \n2022 \nASSETS: \nCurrent assets:    \nCash and cash equivalents ! 28,408  ! 23,646 \nMarketable securities  34,074    24,658  \nAccounts receivable, net  19,549    28,184  \nInventories  7,351    4,946 \nVendor non-trade receivables  19,637    32,748  \nOther current assets  13,640    21,223  \nTotal current assets  122,659    135,405",
            "metadata": {}
          },
          {
            "collectionId": "[COLLECTION ID]",
            "documentId": "b0dd63b1-f78c-4989-94f9-f73768bb12dd",
            "chunkId": "bf3d056f-073b-46e2-b08b-7914fc511ba8",
            "content": "Apple Inc. \nCONDENSED CONSOLIDATED STATEMENTS OF OPERATIONS (Unaudited) \n(In millions, except number of shares which are reflected in thousands and per share amounts) \n Three Months Ended  Nine Months Ended \n July 1, \n2023  June 25, \n2022  July 1, \n2023  June 25, \n2022 \nNet sales:        \n   Products ! 60,584  ! 63,355  ! 230,901   ! 245,241  \n   Services  21,213    19,604    62,886   58,941  \nTotal net sales (1)  81,797    82,959   293,787    304,182  \nCost of sales:        \n   Products  39,136    41,485    146,696    155,084  \n   Services  6,248    5,589    18,370    16,411  \nTotal cost of sales  45,384   47,074    165,066    171,495  \nGross margin  36,413    35,885   128,721    132,687  \n        \nOperating expenses:        \nResearch and development  7,442    6,797    22,608   19,490  \nSelling, general and administrative  5,973    6,012    18,781    18,654  \nTotal operating expenses  13,415    12,809    41,389    38,144",
            "metadata": {}
          },
          {
            "collectionId": "[COLLECTION ID]",
            "documentId": "b0dd63b1-f78c-4989-94f9-f73768bb12dd",
            "chunkId": "858ec3d6-770f-40ac-a203-5dd219c1482d",
            "content": "Common stock and additional paid-in capital, !0.00001 par value: 50,400,000 shares \nauthorized; 15,647,868 and 15,943,425 shares issued and outstanding, respectively  70,667    64,849 \nRetained earnings/(Accumulated deficit)  1,408    (3,068) \nAccumulated other comprehensive income/(loss)  (11,801)   (11,109) \nTotal shareholders’ equity  60,274    50,672  \nTotal liabilities and shareholders’ equity ! 335,038  ! 352,755  \n \n \n \n \nApple Inc. \nCONDENSED CONSOLIDATED STATEMENTS OF CASH FLOWS (Unaudited) \n(In millions) \n \n Nine Months Ended \n July 1, \n2023  June 25, \n2022 \nCash, cash equivalents and restricted cash, beginning balances ! 24,977  ! 35,929 \n    \nOperating activities:    \nNet income  74,039    79,082  \nAdjustments to reconcile net income to cash generated by operating activities:    \nDepreciation and amortization  8,866   8,239  \nShare-based compensation expense  8,208    6,760  \nOther  (1,651)   2,695  \nChanges in operating assets and liabilities:",
            "metadata": {}
          }
        ]
      }
    }
  ]
}

Summary

Hopefully this post has demonstrated the benefits of using AI techniques like document understanding and conversational interfaces to create a knowledgeable assistant for financial analysis. By integrating these capabilities with your collection of financial documents, you can have an assistant ready to enhance your productivity and uncover valuable insights through natural conversational queries. With just a few API calls to documentAI, you can upload reports, statements and more to start conversing with your assistant. It can help you rapidly discover connections, derive strategic insights, and enhance your understanding of the financial landscape relevant to your specific context. Rather than hunting through spreadsheets, you can simply ask questions conversationally and accelerate your analysis.