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

# تدفق الأخبار

> مقالات إخبارية وتحديثات لحظية من Benzinga.

<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/news/stream?token=YOUR_TOKEN
```

<div id="query-parameters">
  ### معلمات الاستعلام
</div>

| المعلمة    | إلزامي | الوصف                                                                                 |
| ---------- | ------ | ------------------------------------------------------------------------------------- |
| `token`    | Yes    | رمز الوصول لواجهة برمجة تطبيقات ويب سوكيت من Benzinga الخاصة بك (bz.production\*\*\*) |
| `tickers`  | No     | قائمة من رموز التداول مفصولة بفواصل (مثلًا: `AAPL,MSFT`)                              |
| `channels` | No     | قائمة من قنوات الأخبار مفصولة بفواصل للتصفية                                          |

<div id="message-example">
  ## مثال لرسالة
</div>

```json theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "api_version": "websocket/v1",
  "kind": "news",
  "data": {
    "action": "created",
    "id": 36444586,
    "timestamp": "2024-01-01T13:35:14Z",
    "content": {
      "id": 36444586,
      "author": "Benzinga Insights",
      "created": "Mon, 01 Jan 2024 13:35:14 -0400",
      "updated": "Mon, 01 Jan 2024 13:35:15 -0400",
      "title": "10 Information Technology Stocks With Whale Alerts In Today's Session",
      "teaser": "",
      "body": "Full article content...",
      "url": "https://www.benzinga.com/markets/options/24/01/36444586/...",
      "image": [
        {
          "size": "thumb",
          "url": "https://cdn.benzinga.com/files/imagecache/250x187xUP/..."
        }
      ],
      "channels": [
        {
          "name": "Options"
        }
      ],
      "stocks": [
        {
          "name": "AAPL",
          "cusip": "037833100",
          "isin": "US0378331005",
          "exchange": "NASDAQ"
        }
      ],
      "tags": [
        {
          "name": "BZI-AUOA"
        }
      ]
    }
  }
}
```

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


## AsyncAPI

````yaml asyncapi/news-stream.yml news
id: news
title: News
description: Send action commands; receive real-time news updates
servers:
  - id: production
    protocol: wss
    host: api.benzinga.com/api/v1/news
    bindings: []
    variables: []
address: stream
parameters: []
bindings: []
operations:
  - &ref_2
    id: news.publish
    title: News.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: news
  - &ref_3
    id: news.subscribe
    title: News.subscribe
    description: Receive real-time news updates
    type: send
    messages:
      - &ref_5
        id: subscribe
        contentType: application/json
        payload:
          - name: News Update
            description: A news article or update message
            type: object
            properties:
              - name: id
                type: string
                description: Unique message identifier
                required: false
              - name: api_version
                type: string
                description: API version
                required: false
              - name: kind
                type: string
                description: Message type
                required: false
              - name: data
                type: object
                required: false
                properties:
                  - name: action
                    type: string
                    description: Action type
                    enumValues:
                      - created
                      - updated
                      - deleted
                    required: false
                  - name: id
                    type: integer
                    description: News article ID
                    required: false
                  - name: timestamp
                    type: string
                    description: Message timestamp
                    required: false
                  - name: content
                    type: object
                    required: false
                    properties:
                      - name: id
                        type: integer
                        description: Article ID
                        required: false
                      - name: author
                        type: string
                        description: Article author
                        required: false
                      - name: created
                        type: string
                        description: Article creation timestamp
                        required: false
                      - name: updated
                        type: string
                        description: Article update timestamp
                        required: false
                      - name: title
                        type: string
                        description: Article headline
                        required: false
                      - name: teaser
                        type: string
                        description: Article teaser text
                        required: false
                      - name: body
                        type: string
                        description: Full article body
                        required: false
                      - name: url
                        type: string
                        description: Article URL
                        required: false
                      - name: image
                        type: array
                        required: false
                        properties:
                          - name: size
                            type: string
                            required: false
                          - name: url
                            type: string
                            required: false
                      - name: channels
                        type: array
                        required: false
                        properties:
                          - name: name
                            type: string
                            required: false
                      - name: stocks
                        type: array
                        required: false
                        properties:
                          - name: name
                            type: string
                            required: false
                          - name: cusip
                            type: string
                            required: false
                          - name: isin
                            type: string
                            required: false
                          - name: exchange
                            type: string
                            required: false
                      - name: tags
                        type: array
                        required: false
                        properties:
                          - name: name
                            type: string
                            required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            id:
              type: string
              description: Unique message identifier
              x-parser-schema-id: <anonymous-schema-3>
            api_version:
              type: string
              description: API version
              example: websocket/v1
              x-parser-schema-id: <anonymous-schema-4>
            kind:
              type: string
              description: Message type
              example: news
              x-parser-schema-id: <anonymous-schema-5>
            data:
              type: object
              properties:
                action:
                  type: string
                  description: Action type
                  enum:
                    - created
                    - updated
                    - deleted
                  x-parser-schema-id: <anonymous-schema-7>
                id:
                  type: integer
                  description: News article ID
                  x-parser-schema-id: <anonymous-schema-8>
                timestamp:
                  type: string
                  format: date-time
                  description: Message timestamp
                  x-parser-schema-id: <anonymous-schema-9>
                content:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: Article ID
                      x-parser-schema-id: <anonymous-schema-11>
                    author:
                      type: string
                      description: Article author
                      x-parser-schema-id: <anonymous-schema-12>
                    created:
                      type: string
                      description: Article creation timestamp
                      x-parser-schema-id: <anonymous-schema-13>
                    updated:
                      type: string
                      description: Article update timestamp
                      x-parser-schema-id: <anonymous-schema-14>
                    title:
                      type: string
                      description: Article headline
                      x-parser-schema-id: <anonymous-schema-15>
                    teaser:
                      type: string
                      description: Article teaser text
                      x-parser-schema-id: <anonymous-schema-16>
                    body:
                      type: string
                      description: Full article body
                      x-parser-schema-id: <anonymous-schema-17>
                    url:
                      type: string
                      description: Article URL
                      x-parser-schema-id: <anonymous-schema-18>
                    image:
                      type: array
                      items:
                        type: object
                        properties:
                          size:
                            type: string
                            x-parser-schema-id: <anonymous-schema-21>
                          url:
                            type: string
                            x-parser-schema-id: <anonymous-schema-22>
                        x-parser-schema-id: <anonymous-schema-20>
                      x-parser-schema-id: <anonymous-schema-19>
                    channels:
                      type: array
                      items:
                        type: object
                        properties:
                          name:
                            type: string
                            x-parser-schema-id: <anonymous-schema-25>
                        x-parser-schema-id: <anonymous-schema-24>
                      x-parser-schema-id: <anonymous-schema-23>
                    stocks:
                      type: array
                      items:
                        type: object
                        properties:
                          name:
                            type: string
                            x-parser-schema-id: <anonymous-schema-28>
                          cusip:
                            type: string
                            x-parser-schema-id: <anonymous-schema-29>
                          isin:
                            type: string
                            x-parser-schema-id: <anonymous-schema-30>
                          exchange:
                            type: string
                            x-parser-schema-id: <anonymous-schema-31>
                        x-parser-schema-id: <anonymous-schema-27>
                      x-parser-schema-id: <anonymous-schema-26>
                    tags:
                      type: array
                      items:
                        type: object
                        properties:
                          name:
                            type: string
                            x-parser-schema-id: <anonymous-schema-34>
                        x-parser-schema-id: <anonymous-schema-33>
                      x-parser-schema-id: <anonymous-schema-32>
                  x-parser-schema-id: <anonymous-schema-10>
              x-parser-schema-id: <anonymous-schema-6>
          x-parser-schema-id: <anonymous-schema-2>
        title: News Update
        description: A news article or update message
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribe
    bindings: []
    extensions: *ref_1
sendOperations:
  - *ref_2
receiveOperations:
  - *ref_3
sendMessages:
  - *ref_4
receiveMessages:
  - *ref_5
extensions:
  - id: x-parser-unique-object-id
    value: news
securitySchemes:
  - id: tokenAuth
    name: token
    type: httpApiKey
    description: Benzinga WebSocket API token (bz.production***)
    in: query
    extensions: []

````