Modularity and Programmability
IntelliX provides a high degree of modularity and programmability, allowing oracle developers to customize their implementations at varying levels of complexity. Developers can choose between two approaches: a declarative method, which is easier to implement, and a programmatic method for more advanced use cases requiring greater control.
IntelliX offers flexibility in how data is fetched and processed. Below are two approaches for publishing a price feed.
Declarative Approach
In the declarative approach, developers can configure key parameters like data source URLs, update frequency, and aggregation rules using a simple configuration file. This method is ideal for handling standard data sources with minimal setup.
The sample configuration below fetches price data from four cryptocurrency exchanges (Binance, Coinbase, Kraken, Bitfinex), extracts price values using a JSONPath processor and publishes the resulting data on-chain every 60 seconds. The data is published on multiple blockchain networks, including Bitlayer, BSC, and Merlin, and validated using an average-median approach.
Programmatic Approach
For more complex use cases, IntelliX allows developers to programmatically define their fetching and aggregation logic, offering maximum flexibility for custom workflows, data transformations, and integrations.
In the example below, the developer manually defines how to fetch price data from multiple APIs and calculates the average price. This approach allows full customization of the data fetching and processing logic, making it ideal for more advanced or unique use cases.
The fetch()
function is responsible for retrieving the latest BTC/USDT price data from multiple cryptocurrency exchange APIs. It performs the following steps:
Fetch Data: Calls each API endpoint to retrieve the BTC/USDT price.
Extract Prices: Extracts the price data from each API response and converts them to floats for uniformity.
Return: Outputs an array of floats, where each float represents the BTC/USDT price from a specific exchange. This array is meant to be used by multiple fetchers in a distributed system setup to gather data from a range of sources.
The validate()
function aggregates the data collected by multiple fetchers, using a two-step approach:
Input: Takes an array of arrays as input, where each inner array is the result of a
fetch()
function call by a different fetcher.Median Calculation: Calculates the median of each inner array. This median represents a single fetcher’s perspective on the BTC/USDT price, helping reduce the influence of outliers within each source's collected data.
Average Calculation: Averages the medians from all fetchers, producing a final aggregated value that represents a robust consensus of the BTC/USDT price across sources and fetchers.
Last updated