> ## 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>

| المعامل   | إلزامي | الوصف                                                                                    |
| --------- | ------ | ---------------------------------------------------------------------------------------- |
| `token`   | نعم    | رمز الوصول الخاص بك لواجهة برمجة تطبيقات ويب سوكيت من Benzinga (bz.production\*\*\*)     |
| `tickers` | لا     | قائمة من رموز التداول مفصولة بفواصل (مثلًا: `AAPL,MSFT`)                                 |
| `isins`   | لا     | قائمة من أرقام التعريف الدولية للأوراق المالية 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": "قام المحلل برفع تصنيف السهم...",
      "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  | Description                                     |
| -------- | ----------------------------------------------- |
| `ping`   | إبقاء الاتصال نشطًا (يستجيب بـ `pong`)          |
| `replay` | إعادة عرض ما يصل إلى آخر 100 رسالة مخزنة مؤقتًا |

<div id="best-practices">
  ## أفضل الممارسات
</div>

* **إزالة التكرارات**: استخدم حقل `id` لمنع معالجة الرسائل المكررة
* **نبضات الاتصال (Heartbeat)**: أرسل أوامر `ping` كل 30–60 ثانية للحفاظ على الاتصال
* **التعامل مع الأخطاء**: طبّق منطق إعادة الاتصال مع استراتيجية تراجع أسي
* **التصفية**: استخدم مرشحات رمز التداول/رقم التعريف الدولي للأوراق المالية 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: []

````