> For the complete documentation index, see [llms.txt](https://docs.chiliz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chiliz.com/th/phatthana/sung-khuen/on-chain-raka-feed.md).

# ดึงราคา On-Chain แบบ Feed

Chiliz Chain มีระบบ price feed แบบ on-chain ระดับสถาบัน ที่ส่งราคาสินทรัพย์ที่เชื่อถือได้และทนทานต่อการปลอมแปลงตรงไปยัง smart contract โดยตรง ระบบนี้รองรับ **Chainlink AggregatorV3Interface**: dApp ที่รวม Chainlink data feeds อยู่แล้วสามารถเชื่อมต่อได้ด้วยการเปลี่ยนแปลงเพียงเล็กน้อย

ข้อมูลราคาถูกดึงมาจากกระดานซื้อขายส่วนกลางหลายแห่ง รวมผ่าน VWAP (Volume Weighted Average Price) กรองค่าผิดปกติ และส่งขึ้น on-chain โดย signer ที่ได้รับอนุญาตในระบบอัตโนมัติความถี่สูงแบบเต็มรูปแบบ

## วิธีการทำงาน

ระบบ oracle ถูกสร้างเป็น pipeline แบบ off-chain สามขั้นตอนที่ส่งราคาที่ผ่านการตรวจสอบขึ้น on-chain อย่างต่อเนื่อง

```mermaid
flowchart LR
    subgraph pipeline["Off-chain Pipeline"]
        direction LR
        FETCHER --> AGGREGATOR --> SIGNER
    end
    SIGNER --> pricefeed["Chiliz Chain\nPriceFeed Contracts"]
```

**ขั้นตอนที่ 1: Fetcher**\
ดึงข้อมูลตลาดแบบเรียลไทม์จากกระดานซื้อขายส่วนกลางผ่าน WebSocket streams (Binance, Bybit, Bitget, Mexc, OKX, BingX) และ REST polling (Binance, Bybit, Bitget, Gate, Coinex) รวมถึง subgraph queries (FanX) ราคาทั้งหมดที่ดึงมาจะถูกเก็บไว้ใน cache ภายใน พร้อมสำหรับ Aggregator

**ขั้นตอนที่ 2: Aggregator**\
ใช้การคำนวณ VWAP เพื่อให้น้ำหนักมากขึ้นกับสถานที่ที่มีสภาพคล่องสูง จากนั้นกรองค่าผิดปกติ โดยตัดสินใจว่าจะส่งการอัปเดต on-chain หรือไม่ตามกฎสองข้อ:

* **Deviation threshold**: ส่งการอัปเดตหากราคารวมเคลื่อนไหวเกินเปอร์เซ็นต์ที่กำหนด (เช่น 0.5%) จากค่า on-chain ล่าสุด
* **Heartbeat**: แม้ว่าราคาจะไม่เคลื่อนไหวเกิน deviation threshold ก็จะบังคับส่งการอัปเดตเมื่อครบช่วงเวลาสูงสุด เพื่อรับประกันว่า feed จะไม่หยุดนิ่ง

**ขั้นตอนที่ 3: Signer**\
รับงานราคาที่ผ่านการตรวจสอบจาก Aggregator และส่งขึ้น on-chain ผ่าน Fireblocks ซึ่งเป็นโซลูชันการลงนามระดับสถาบัน Signer จะทำงานเฉพาะเมื่อ Aggregator บอกว่าราคาพร้อมแล้ว

## ระบบ Contract

| Contract                | บทบาท                                                                                                                                                  |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **PriceFeed**           | หนึ่ง contract ต่อหนึ่งคู่ซื้อขาย นี่คือ contract ที่ dApp ของคุณอ่านข้อมูล รองรับ Chainlink AggregatorV3Interface                                     |
| **OracleFactory**       | Registry และผู้จัดการ เก็บการ mapping ที่เชื่อถือได้จากสัญลักษณ์คู่ (เช่น `"PSG/USDT"`) ไปยัง oracle address                                           |
| **OracleFactoryReader** | Contract ความสะดวกแบบอ่านอย่างเดียว ดึง oracle address ที่ใช้งานได้ทั้งหมด แก้ไขหลายคู่พร้อมกัน หรือตรวจสอบสถานะสุขภาพทั่วทั้งระบบในการเรียกครั้งเดียว |

oracle contracts ได้รับการตรวจสอบโดย [Halborn](https://www.halborn.com/audits/chiliz/oracle-contracts-40e905) (มกราคม 2026)

## ที่อยู่ Contract

พารามิเตอร์ network สำหรับทั้ง Mainnet และ Testnet มีอยู่ใน [เชื่อมต่อโดยใช้ RPC](/th/phatthana/phuenthan/tho-chiliz-chain/tho-rpc.md)

{% tabs %}
{% tab title="Chiliz Chain Mainnet" %}

<table><thead><tr><th width="253">Contract</th><th>Address</th></tr></thead><tbody><tr><td>OracleFactory</td><td><code>Coming soon...</code></td></tr><tr><td>OracleFactoryReader</td><td><code>Coming soon...</code></td></tr></tbody></table>
{% endtab %}

{% tab title="Spicy Testnet" %}

<table><thead><tr><th width="253">Contract</th><th>Address</th></tr></thead><tbody><tr><td>OracleFactory</td><td><code>0x824A1C121DD4baeA7f074f829294Af7DD10D9723</code></td></tr><tr><td>OracleFactoryReader</td><td><code>0x8908cd1586e90b399Dbc160Be98396172ef2F378</code></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

[Price Oracle Tracker](https://price-oracle-tracker.vercel.app/?network=mainnet) แสดงคู่ทั้งหมดที่มีพร้อมราคาสด decimals พารามิเตอร์ heartbeat และที่อยู่ contract แต่ละรายการ


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.chiliz.com/th/phatthana/sung-khuen/on-chain-raka-feed.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
