> ## Documentation Index
> Fetch the complete documentation index at: https://docs.benzinga.com/llms.txt
> Use this file to discover all available pages before exploring further.

# アナリスト・インサイト・ストリーム

> 証券に関するアナリストインサイト、レーティング、目標株価をリアルタイムで配信します。

<div id="overview">
  ## 概要
</div>

リアルタイムのアナリストインサイトを購読し、アナリストレーティング、目標株価、詳細な推奨情報の更新を発生と同時に受け取ることができます。

<div id="key-features">
  ### 主な機能
</div>

* **リアルタイム更新**: アナリストが新しいインサイトを公開したり、既存のレーティングを更新したときに、即座に通知を受け取れます
* **銘柄によるフィルタリング**: 特定のティッカーまたは ISIN を購読して、関連するデータのみを受信できます
* **包括的なデータ**: アナリストの所属機関の詳細、レーティング、目標株価、詳細なインサイトを含みます
* **アクションの追跡**: インサイトが作成・更新・削除されたタイミングを監視できます

<div id="use-cases">
  ### ユースケース
</div>

* ポートフォリオ内の銘柄に対するアナリストのセンチメント変化を追跡する
* レーティングの格上げ・格下げに対するリアルタイムアラートを作成する
* 複数アナリストにわたる目標株価の変更を監視する
* 複数のアナリスト会社からのコンセンサス見解を集約する

<div id="quick-start">
  ## クイックスタート
</div>

上部のインタラクティブなウェブソケットテスターを使って、ストリームにリアルタイム接続し、動作をテストしてください。

<div id="connection-url">
  ### 接続URL
</div>

```
wss://api.benzinga.com/api/v1/analyst/insights/stream?token=YOUR_TOKEN
```

<div id="query-parameters">
  ### クエリパラメータ
</div>

| Parameter | Required | Description                                            |
| --------- | -------- | ------------------------------------------------------ |
| `token`   | Yes      | あなたの Benzinga WebSocket API トークン (bz.production\*\*\*) |
| `tickers` | No       | ティッカーシンボルのカンマ区切りリスト (例: `AAPL,MSFT`)                   |
| `isins`   | No       | 絞り込み用の ISIN（国際証券識別番号）のカンマ区切りリスト                        |

<div id="message-example">
  ## メッセージ例
</div>

```json theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "api_version": "websocket/v1",
  "kind": "stream_type",
  "data": {
    "action": "created",
    "id": "insight-id",
    "timestamp": "2024-10-08T10:00:00Z",
    "content": {
      "action": "Upgrades",
      "analyst_insights": "The analyst has upgraded the stock...",
      "firm": "Goldman Sachs",
      "pt": "150.00",
      "rating": "Buy",
      "security": {
        "symbol": "AAPL",
        "name": "Apple Inc.",
        "exchange": "NASDAQ"
      }
    }
  }
}
```

<div id="message-actions">
  ### メッセージアクション
</div>

| アクション                 | 説明                  |
| --------------------- | ------------------- |
| `created` / `Created` | 新しいアナリストインサイトが公開された |
| `updated` / `Updated` | 既存のアナリストインサイトが更新された |
| `deleted` / `Deleted` | アナリストインサイトが削除された    |

<div id="interactive-commands">
  ## 対話型コマンド
</div>

| Command  | 説明                           |
| -------- | ---------------------------- |
| `ping`   | 接続を維持します（`pong` を返します）       |
| `replay` | 直近最大100件のキャッシュ済みメッセージを再送信します |

<div id="best-practices">
  ## ベストプラクティス
</div>

* **重複排除**: `id` フィールドを使用して重複メッセージを処理しないようにする
* **ハートビート**: 接続を維持するために 30〜60 秒ごとに `ping` コマンドを送信する
* **エラーハンドリング**: 指数バックオフ付きの再接続ロジックを実装する
* **フィルタリング**: 帯域幅の使用量を抑えるために ticker/ISIN フィルタを使用する


## AsyncAPI

````yaml asyncapi/analyst-insights-stream.yml analystInsights
id: analystInsights
title: Analyst insights
description: Send action commands; receive real-time analyst insights
servers:
  - id: production
    protocol: wss
    host: api.benzinga.com/api/v1/analyst/insights
    bindings: []
    variables: []
address: stream
parameters: []
bindings: []
operations:
  - &ref_2
    id: analystInsights.publish
    title: Analyst insights.publish
    description: Send commands to the server
    type: receive
    messages:
      - &ref_4
        id: publish
        contentType: text/plain
        payload:
          - type: string
            enum: &ref_0
              - ping
              - replay
            description: Send action commands (ping, replay)
            x-parser-schema-id: <anonymous-schema-1>
            name: publish
        headers: []
        jsonPayloadSchema:
          type: string
          enum: *ref_0
          description: Action to perform (ping for heartbeat, replay for message history)
          x-parser-schema-id: <anonymous-schema-1>
        title: Publish
        description: Send action commands (ping, replay)
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: publish
          - id: x-parser-message-name
            value: ActionRequest
    bindings: []
    extensions: &ref_1
      - id: x-parser-unique-object-id
        value: analystInsights
  - &ref_3
    id: analystInsights.subscribe
    title: Analyst insights.subscribe
    description: Receive real-time analyst insights
    type: send
    messages:
      - &ref_5
        id: subscribe
        contentType: application/json
        payload:
          - name: subscribe
            description: Analyst insight event
            type: object
            properties:
              - name: id
                type: string
                description: Unique UUID for the websocket response
                required: true
              - name: api_version
                type: string
                description: Websocket API version
                enumValues:
                  - websocket/v1
                required: true
              - name: kind
                type: string
                description: Websocket connection stream type
                required: true
              - name: data
                type: object
                required: true
                properties:
                  - name: action
                    type: string
                    description: Websocket data action
                    enumValues:
                      - created
                      - updated
                      - deleted
                      - Created
                      - Updated
                      - Deleted
                    required: true
                  - name: id
                    type: string
                    description: Data ID for the analyst insight
                    required: true
                  - name: timestamp
                    type: string
                    description: Timestamp of the data
                    required: true
                  - name: content
                    type: object
                    required: true
                    properties:
                      - name: action
                        type: string
                        description: >-
                          Analyst's action on the stock (e.g., Maintains,
                          Upgrades)
                        required: false
                      - name: analyst_insights
                        type: string
                        description: Detailed insights from the analyst
                        required: false
                      - name: date
                        type: string
                        description: Date of the analyst insight
                        required: false
                      - name: firm
                        type: string
                        description: Name of the firm providing the insight
                        required: false
                      - name: firm_id
                        type: string
                        description: Unique identifier for the firm
                        required: false
                      - name: id
                        type: string
                        description: Unique identifier for the analyst insight
                        required: false
                      - name: pt
                        type: string
                        description: Price target given by the analyst
                        required: false
                      - name: rating
                        type: string
                        description: Rating provided by the analyst
                        required: false
                      - name: rating_id
                        type: string
                        description: Unique identifier for the rating
                        required: false
                      - name: security
                        type: object
                        required: false
                        properties:
                          - name: cik
                            type: string
                            description: Central Index Key of the security
                            required: false
                          - name: exchange
                            type: string
                            description: Exchange where the security is listed
                            required: false
                          - name: isin
                            type: string
                            description: International Securities Identification Number
                            required: false
                          - name: name
                            type: string
                            description: Name of the security
                            required: false
                          - name: symbol
                            type: string
                            description: Ticker symbol of the security
                            required: false
                      - name: updated
                        type: integer
                        description: Timestamp of when the insight was last updated
                        required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - id
            - api_version
            - kind
            - data
          properties:
            id:
              type: string
              format: uuid
              description: Unique UUID for the websocket response
              x-parser-schema-id: <anonymous-schema-3>
            api_version:
              type: string
              enum:
                - websocket/v1
              description: Websocket API version
              x-parser-schema-id: <anonymous-schema-4>
            kind:
              type: string
              description: Websocket connection stream type
              x-parser-schema-id: <anonymous-schema-5>
            data:
              type: object
              required:
                - action
                - id
                - content
                - timestamp
              properties:
                action:
                  type: string
                  enum:
                    - created
                    - updated
                    - deleted
                    - Created
                    - Updated
                    - Deleted
                  description: Websocket data action
                  x-parser-schema-id: <anonymous-schema-7>
                id:
                  type: string
                  description: Data ID for the analyst insight
                  x-parser-schema-id: <anonymous-schema-8>
                timestamp:
                  type: string
                  format: date-time
                  description: Timestamp of the data
                  x-parser-schema-id: <anonymous-schema-9>
                content:
                  type: object
                  properties:
                    action:
                      type: string
                      description: >-
                        Analyst's action on the stock (e.g., Maintains,
                        Upgrades)
                      x-parser-schema-id: <anonymous-schema-11>
                    analyst_insights:
                      type: string
                      description: Detailed insights from the analyst
                      x-parser-schema-id: <anonymous-schema-12>
                    date:
                      type: string
                      format: date
                      description: Date of the analyst insight
                      x-parser-schema-id: <anonymous-schema-13>
                    firm:
                      type: string
                      description: Name of the firm providing the insight
                      x-parser-schema-id: <anonymous-schema-14>
                    firm_id:
                      type: string
                      description: Unique identifier for the firm
                      x-parser-schema-id: <anonymous-schema-15>
                    id:
                      type: string
                      format: uuid
                      description: Unique identifier for the analyst insight
                      x-parser-schema-id: <anonymous-schema-16>
                    pt:
                      type: string
                      description: Price target given by the analyst
                      x-parser-schema-id: <anonymous-schema-17>
                    rating:
                      type: string
                      description: Rating provided by the analyst
                      x-parser-schema-id: <anonymous-schema-18>
                    rating_id:
                      type: string
                      description: Unique identifier for the rating
                      x-parser-schema-id: <anonymous-schema-19>
                    security:
                      type: object
                      properties:
                        cik:
                          type: string
                          description: Central Index Key of the security
                          x-parser-schema-id: <anonymous-schema-21>
                        exchange:
                          type: string
                          description: Exchange where the security is listed
                          x-parser-schema-id: <anonymous-schema-22>
                        isin:
                          type: string
                          description: International Securities Identification Number
                          x-parser-schema-id: <anonymous-schema-23>
                        name:
                          type: string
                          description: Name of the security
                          x-parser-schema-id: <anonymous-schema-24>
                        symbol:
                          type: string
                          description: Ticker symbol of the security
                          x-parser-schema-id: <anonymous-schema-25>
                      x-parser-schema-id: <anonymous-schema-20>
                    updated:
                      type: integer
                      format: int64
                      description: Timestamp of when the insight was last updated
                      x-parser-schema-id: <anonymous-schema-26>
                  x-parser-schema-id: <anonymous-schema-10>
              x-parser-schema-id: <anonymous-schema-6>
          x-parser-schema-id: <anonymous-schema-2>
        title: Subscribe
        description: Analyst insight event
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribe
          - id: x-parser-message-name
            value: AnalystInsightMessage
    bindings: []
    extensions: *ref_1
sendOperations:
  - *ref_2
receiveOperations:
  - *ref_3
sendMessages:
  - *ref_4
receiveMessages:
  - *ref_5
extensions:
  - id: x-parser-unique-object-id
    value: analystInsights
securitySchemes:
  - id: tokenAuth
    name: token
    type: httpApiKey
    description: Benzinga WebSocket API token (bz.production***)
    in: query
    extensions: []

````