From bbfc05b1e67b3a22bc3f989da2e4db0f7867d2b0 Mon Sep 17 00:00:00 2001 From: nidhi-singh02 Date: Wed, 24 Sep 2025 11:11:19 +0530 Subject: [PATCH 1/8] redirect from subscribe updates page --- pages/lazer/_meta.json | 1 + pages/lazer/payload-reference.mdx | 307 ++++++++++++++++++++++++ pages/lazer/subscribe-price-updates.mdx | 6 + 3 files changed, 314 insertions(+) create mode 100644 pages/lazer/payload-reference.mdx diff --git a/pages/lazer/_meta.json b/pages/lazer/_meta.json index 15bf7d81..b77c9dc2 100644 --- a/pages/lazer/_meta.json +++ b/pages/lazer/_meta.json @@ -25,6 +25,7 @@ "title": "Reference Material", "type": "separator" }, + "payload-reference": "Payload Reference", "price-feed-ids": "Price Feed IDs", "websocket-api-reference": { diff --git a/pages/lazer/payload-reference.mdx b/pages/lazer/payload-reference.mdx new file mode 100644 index 00000000..d0a7bc3b --- /dev/null +++ b/pages/lazer/payload-reference.mdx @@ -0,0 +1,307 @@ +import { Callout, Steps } from "nextra/components"; + +# Lazer Payload Reference + +This page provides a comprehensive reference for understanding Pyth Lazer payload structure, field specifications, and available data formats. This information is essential for integrating with Lazer as a consumer and understanding the data you receive. + + + This reference is designed for both technical and non-technical stakeholders + to understand Pyth Lazer's data offering. For implementation details, see our + [integration guides](/lazer/integrate-as-consumer). + + +## What is a Lazer Payload? + +A Lazer payload is a real-time data update containing financial market information with cryptographic signatures for verification. When you subscribe to Lazer price feeds, you receive `StreamUpdated` messages containing this structured data. + +## Stream Response Structure + +When you receive a `StreamUpdated` message from Lazer, it contains the following structure: + +### Top-Level Response Fields + +| Field | Type | Description | +| ---------------- | --------------- | ------------------------------------------------------ | +| `type` | `string` | Always `"streamUpdated"` for price updates | +| `subscriptionId` | `number` | Your subscription identifier | +| `parsed` | `ParsedPayload` | Human-readable price data (when `parsed: true`) | +| `evm` | `BinaryData` | EVM-compatible binary payload (when requested) | +| `solana` | `BinaryData` | Solana-compatible binary payload (when requested) | +| `leEcdsa` | `BinaryData` | Little-endian ECDSA binary payload (when requested) | +| `leUnsigned` | `BinaryData` | Little-endian unsigned binary payload (when requested) | + +### Parsed Payload Structure + +The `parsed` object contains human-readable price data: + +| Field | Type | Description | +| ------------- | ------------------ | ---------------------------------------------------------- | +| `timestampUs` | `string` | Unix timestamp in microseconds when the data was generated | +| `priceFeeds` | `Array` | Array of price feed data objects | + +## How Does a Price Feed Look? + +Each price feed in the `priceFeeds` array represents real-time market data for a specific trading pair (e.g., BTC/USD, ETH/USD). Think of a price feed as a comprehensive snapshot of market conditions for that asset. + +### Example Price Feed Response + +Here's what a typical price feed looks like in a Lazer response: + +```json +{ + "type": "streamUpdated", + "subscriptionId": 1, + "parsed": { + "timestampUs": "1758690761750000", + "priceFeeds": [ + { + "priceFeedId": 1, + "price": "11223872331053", + "bestBidPrice": "11222498842767", + "bestAskPrice": "11224513591935", + "publisherCount": 9, + "exponent": -8, + "confidence": 1373488286 + } + ] + }, + "evm": { + "encoding": "base64", + "data": "..." + } +} +``` + +### Price Feed Structure + +Each price feed object contains the following fields: + +| Field | Type | Description | Example | +| --------------------- | -------- | ------------------------------------------- | -------------------- | +| `priceFeedId` | `number` | Unique identifier for the price feed | `1` (BTC/USD) | +| `price` | `string` | Main aggregate price (mantissa format) | `"1006900000000"` | +| `exponent` | `string` | Decimal exponent for price conversion | `"-8"` | +| `confidence` | `string` | Price confidence interval (mantissa format) | `"5000000"` | +| `publisherCount` | `string` | Number of data publishers contributing | `"15"` | +| `bestBidPrice` | `string` | Highest bid price across all publishers | `"1006800000000"` | +| `bestAskPrice` | `string` | Lowest ask price across all publishers | `"1007000000000"` | +| `fundingRate` | `string` | Current funding rate for perpetual futures | `"125000"` | +| `fundingTimestamp` | `string` | Timestamp of last funding rate update | `"1730986152000000"` | +| `fundingRateInterval` | `string` | Funding rate update interval (microseconds) | `"28800000000"` | + + + **Important**: Price values are in mantissa format. To get the actual price, + use: `actual_price = mantissa × 10^exponent`. For example: `1006900000000 × + 10^(-8) = $10,069.00` + + +## Property Specifications + +Based on the protocol specification, here are the technical details for each property in a price feed: + +### Feed Structure + +- **Feed ID**: `u32` - Unique identifier for the price feed +- **Properties**: Fields included based on your subscription request parameters + +### Core Price Properties + +#### Aggregate Market Price - `price` + +Main aggregate price calculated from all contributing publishers + +- **Type**: `optional non-zero i64` (mantissa representation) +- **Availability**: Only included if requested in subscription properties +- **Algorithm**: Robust statistical aggregation using median-based methods with outlier detection +- **Invariants**: Non-zero when present (null values filtered out) +- **Usage**: Primary price for trading decisions and portfolio valuation + +#### Data Publisher Count - `publisher_count` + +Number of data publishers contributing to this price feed + +- **Type**: `u16` +- **Availability**: Always included when any price properties are present +- **Algorithm**: Count of publishers whose data passed validation and quality checks +- **Invariants**: Always positive for valid price feeds +- **Business Value**: Higher count indicates more robust price discovery and reduced manipulation risk + +#### Price Confidence Interval - `confidence` + +Confidence interval representing price uncertainty + +- **Type**: `optional i64` (mantissa representation) +- **Availability**: Only included if requested in subscription properties +- **Algorithm**: Statistical measure derived from publisher price variance and market volatility +- **Invariants**: Positive when present +- **Usage**: Risk management and price quality assessment + +### Market Depth Properties + +#### Highest Market Bid - `best_bid_price` + +Highest bid price across all contributing publishers + +- **Type**: `optional non-zero i64` (mantissa representation) +- **Availability**: Only included if requested in subscription properties +- **Algorithm**: Maximum bid price from all publishers with active order book data +- **Invariants**: Non-zero when present, typically ≤ current price +- **Business Value**: Essential for market makers and algorithmic trading strategies + +#### Lowest Market Ask - `best_ask_price` + +Lowest ask price across all contributing publishers + +- **Type**: `optional non-zero i64` (mantissa representation) +- **Availability**: Only included if requested in subscription properties +- **Algorithm**: Minimum ask price from all publishers with active order book data +- **Invariants**: Non-zero when present, typically ≥ current price +- **Business Value**: Critical for understanding market liquidity and bid-ask spreads + +### Derivatives Properties (FundingRate Feed Type Only) + +#### Perpetual Futures Funding Rate - `funding_rate` + +Current funding rate for perpetual futures contracts + +- **Type**: `optional i64` (mantissa representation) +- **Availability**: Only for FeedKind::FundingRate feeds, only if requested in subscription +- **Algorithm**: Interest rate differential: `(PerpetualsPrice - IndexPrice) / IndexPrice` +- **Invariants**: Can be positive (longs pay shorts) or negative (shorts pay longs) +- **Business Value**: Essential for perpetual futures trading and funding arbitrage + +#### Funding Payment Timestamp - `funding_timestamp` + +Timestamp when funding rate was last calculated or applied + +- **Type**: `optional u64` (microseconds) +- **Availability**: Only for FeedKind::FundingRate feeds, only if requested in subscription +- **Invariants**: Valid Unix timestamp in microseconds when present +- **Business Value**: Critical for funding payment timing and schedule management + +#### Funding Update Interval - `funding_interval` + +Duration between consecutive funding rate calculations + +- **Type**: `optional u64` (microseconds) +- **Availability**: Only for FeedKind::FundingRate feeds, only if requested in subscription +- **Invariants**: Positive value when present +- **Typical Values**: 28,800,000,000 microseconds (8 hours) for major exchanges +- **Business Value**: Used for funding cost calculations and payment scheduling + +## Available Properties by Use Case + +Based on the [API documentation](https://pyth-lazer.dourolabs.app/docs), you can request specific properties when subscribing: + +### Common Properties (All Feed Types) + +- `publisherCount` - Number of contributing data publishers +- `exponent` - Decimal exponent for proper price representation + +### Spot Trading Properties + +- `price` - Primary aggregate price for the asset +- `confidence` - Price confidence interval for risk assessment +- `bestBidPrice` - Highest bid across all publishers (market depth) +- `bestAskPrice` - Lowest ask across all publishers (market depth) + +### Derivatives Properties + +- `fundingRate` - Current funding rate for perpetual futures +- `fundingTimestamp` - Most recent funding rate timestamp +- `fundingRateInterval` - Duration between funding updates + + + **Subscription Flexibility**: You only receive the properties you request in + your subscription, optimizing bandwidth and processing. + + +## Subscription Channels + +Lazer offers multiple delivery channels to match your latency and frequency requirements: + +| Channel | Description | Use Cases | +| ------------------ | --------------------------------------- | ------------------------------------------- | +| `real_time` | Updates sent immediately when available | High-frequency trading, real-time analytics | +| `fixed_rate@1ms` | Updates every 1 millisecond | Ultra-low latency applications | +| `fixed_rate@50ms` | Updates every 50 milliseconds | Low-latency trading systems | +| `fixed_rate@200ms` | Updates every 200 milliseconds | Standard trading applications | + + + **Channel Selection**: Most production applications use `real_time` for + maximum freshness. Fixed-rate channels provide predictable update timing for + applications requiring consistent intervals. + + +## Signature Schemes and Binary Formats + +Lazer provides multiple cryptographic formats to support different blockchain ecosystems. When you subscribe, you can request specific binary formats in the `chains` parameter: + +### Available Formats + +| Format | Algorithm | Use Cases | Blockchains | +| ------------ | ---------------------------- | -------------------------- | --------------------------------- | +| `evm` | secp256k1 ECDSA + Keccak-256 | Smart contract integration | Ethereum, BSC, Polygon, Avalanche | +| `solana` | Ed25519 EdDSA | Solana program integration | Solana | +| `leEcdsa` | Little-endian ECDSA | Specialized applications | Custom implementations | +| `leUnsigned` | No signature (testing only) | Off-chain analytics | Testing, development | + +### Technical Specifications + +
+ +
+ #### EVM Format (`evm`) + +- **Algorithm**: secp256k1 ECDSA +- **Hash Function**: Keccak-256 +- **Signature Size**: 65 bytes +- **Verification**: Recoverable ECDSA with Ethereum address derivation + +**Perfect for**: Ethereum smart contracts, DeFi protocols, multi-chain applications + +
+ +
+ #### Solana Format (`solana`) + +- **Algorithm**: Ed25519 EdDSA +- **Signature Size**: 64 bytes +- **Public Key Size**: 32 bytes +- **Verification**: Direct Ed25519 signature verification + +**Perfect for**: Solana programs, high-performance applications + +
+ +
+ #### Little-Endian ECDSA (`leEcdsa`) + +- **Algorithm**: secp256k1 ECDSA (little-endian) +- **Hash Function**: Keccak-256 +- **Byte Order**: Little-endian encoding + +**Perfect for**: Custom implementations requiring specific byte ordering + +
+ +
+ #### Unsigned Format (`leUnsigned`) + +- **Signature**: None (raw payload) +- **Use Cases**: Testing, development, trusted environments + + + **Security Warning**: Never use in production + + + +
+ +
+ + + **How to Choose**: Use `evm` for Ethereum-compatible chains, `solana` for + Solana, `leEcdsa` for custom implementations, and `leUnsigned` only for + testing. + diff --git a/pages/lazer/subscribe-price-updates.mdx b/pages/lazer/subscribe-price-updates.mdx index 06ecb029..2af3c2cc 100644 --- a/pages/lazer/subscribe-price-updates.mdx +++ b/pages/lazer/subscribe-price-updates.mdx @@ -51,6 +51,12 @@ Determine the most suitable values for your application -- they will be used in ### 3. Subscribe to the price updates + + **Complete Payload Reference**: For understanding all fields and data types of + Lazer payloads, see our [**Payload Reference**](/lazer/payload-reference) + page. + + To subscribe to the price updates, send a request to the websocket server. The server will respond with a signed price update. 1. Pyth Lazer provides an [SDK](https://github.com/pyth-network/pyth-crosschain/tree/main/lazer/sdk/js) to seamlessly integrate the websocket API into your application. From d8233330a2152653421f40e25fa54a0da62349b9 Mon Sep 17 00:00:00 2001 From: nidhi-singh02 Date: Wed, 24 Sep 2025 11:35:24 +0530 Subject: [PATCH 2/8] add exponent in the properties --- pages/lazer/payload-reference.mdx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pages/lazer/payload-reference.mdx b/pages/lazer/payload-reference.mdx index d0a7bc3b..33e1f2a5 100644 --- a/pages/lazer/payload-reference.mdx +++ b/pages/lazer/payload-reference.mdx @@ -114,7 +114,6 @@ Main aggregate price calculated from all contributing publishers - **Availability**: Only included if requested in subscription properties - **Algorithm**: Robust statistical aggregation using median-based methods with outlier detection - **Invariants**: Non-zero when present (null values filtered out) -- **Usage**: Primary price for trading decisions and portfolio valuation #### Data Publisher Count - `publisher_count` @@ -126,6 +125,17 @@ Number of data publishers contributing to this price feed - **Invariants**: Always positive for valid price feeds - **Business Value**: Higher count indicates more robust price discovery and reduced manipulation risk +#### Decimal Exponent - `exponent` + +Power of 10 to apply for decimal representation + +- **Type**: `i16` +- **Availability**: Always included when price properties are present +- **Algorithm**: Determines decimal placement for all price values in the feed +- **Invariants**: Typically negative (e.g., -8 for USD prices, -18 for token prices) +- **Usage**: Convert mantissa to actual price: `actual_price = mantissa × 10^exponent` +- **Example**: With exponent `-8`, mantissa `1006900000000` becomes `$10,069.00` + #### Price Confidence Interval - `confidence` Confidence interval representing price uncertainty @@ -296,7 +306,7 @@ Lazer provides multiple cryptographic formats to support different blockchain ec - + From 4be211e82e282ee51908c68f08d818fd35e1bbda Mon Sep 17 00:00:00 2001 From: nidhi-singh02 Date: Wed, 24 Sep 2025 15:41:29 +0530 Subject: [PATCH 3/8] cleanup --- pages/lazer/payload-reference.mdx | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/pages/lazer/payload-reference.mdx b/pages/lazer/payload-reference.mdx index 33e1f2a5..9e501a64 100644 --- a/pages/lazer/payload-reference.mdx +++ b/pages/lazer/payload-reference.mdx @@ -80,9 +80,9 @@ Each price feed object contains the following fields: | --------------------- | -------- | ------------------------------------------- | -------------------- | | `priceFeedId` | `number` | Unique identifier for the price feed | `1` (BTC/USD) | | `price` | `string` | Main aggregate price (mantissa format) | `"1006900000000"` | -| `exponent` | `string` | Decimal exponent for price conversion | `"-8"` | +| `exponent` | `string` | Decimal exponent for price conversion | `-8` | | `confidence` | `string` | Price confidence interval (mantissa format) | `"5000000"` | -| `publisherCount` | `string` | Number of data publishers contributing | `"15"` | +| `publisherCount` | `string` | Number of data publishers contributing | `9` | | `bestBidPrice` | `string` | Highest bid price across all publishers | `"1006800000000"` | | `bestAskPrice` | `string` | Lowest ask price across all publishers | `"1007000000000"` | | `fundingRate` | `string` | Current funding rate for perpetual futures | `"125000"` | @@ -247,17 +247,6 @@ Lazer offers multiple delivery channels to match your latency and frequency requ Lazer provides multiple cryptographic formats to support different blockchain ecosystems. When you subscribe, you can request specific binary formats in the `chains` parameter: -### Available Formats - -| Format | Algorithm | Use Cases | Blockchains | -| ------------ | ---------------------------- | -------------------------- | --------------------------------- | -| `evm` | secp256k1 ECDSA + Keccak-256 | Smart contract integration | Ethereum, BSC, Polygon, Avalanche | -| `solana` | Ed25519 EdDSA | Solana program integration | Solana | -| `leEcdsa` | Little-endian ECDSA | Specialized applications | Custom implementations | -| `leUnsigned` | No signature (testing only) | Off-chain analytics | Testing, development | - -### Technical Specifications -
@@ -268,8 +257,6 @@ Lazer provides multiple cryptographic formats to support different blockchain ec - **Signature Size**: 65 bytes - **Verification**: Recoverable ECDSA with Ethereum address derivation -**Perfect for**: Ethereum smart contracts, DeFi protocols, multi-chain applications -
@@ -280,8 +267,6 @@ Lazer provides multiple cryptographic formats to support different blockchain ec - **Public Key Size**: 32 bytes - **Verification**: Direct Ed25519 signature verification -**Perfect for**: Solana programs, high-performance applications -
@@ -302,7 +287,7 @@ Lazer provides multiple cryptographic formats to support different blockchain ec - **Use Cases**: Testing, development, trusted environments - **Security Warning**: Never use in production + **Security**: Never use in production From 719e43cb6ad75e9fcc18bba2e7377783bf27d73d Mon Sep 17 00:00:00 2001 From: nidhi-singh02 Date: Wed, 24 Sep 2025 16:14:59 +0530 Subject: [PATCH 4/8] do not require price feed structure --- pages/lazer/payload-reference.mdx | 35 ++----------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/pages/lazer/payload-reference.mdx b/pages/lazer/payload-reference.mdx index 9e501a64..873ba8e0 100644 --- a/pages/lazer/payload-reference.mdx +++ b/pages/lazer/payload-reference.mdx @@ -43,8 +43,6 @@ The `parsed` object contains human-readable price data: Each price feed in the `priceFeeds` array represents real-time market data for a specific trading pair (e.g., BTC/USD, ETH/USD). Think of a price feed as a comprehensive snapshot of market conditions for that asset. -### Example Price Feed Response - Here's what a typical price feed looks like in a Lazer response: ```json @@ -72,23 +70,6 @@ Here's what a typical price feed looks like in a Lazer response: } ``` -### Price Feed Structure - -Each price feed object contains the following fields: - -| Field | Type | Description | Example | -| --------------------- | -------- | ------------------------------------------- | -------------------- | -| `priceFeedId` | `number` | Unique identifier for the price feed | `1` (BTC/USD) | -| `price` | `string` | Main aggregate price (mantissa format) | `"1006900000000"` | -| `exponent` | `string` | Decimal exponent for price conversion | `-8` | -| `confidence` | `string` | Price confidence interval (mantissa format) | `"5000000"` | -| `publisherCount` | `string` | Number of data publishers contributing | `9` | -| `bestBidPrice` | `string` | Highest bid price across all publishers | `"1006800000000"` | -| `bestAskPrice` | `string` | Lowest ask price across all publishers | `"1007000000000"` | -| `fundingRate` | `string` | Current funding rate for perpetual futures | `"125000"` | -| `fundingTimestamp` | `string` | Timestamp of last funding rate update | `"1730986152000000"` | -| `fundingRateInterval` | `string` | Funding rate update interval (microseconds) | `"28800000000"` | - **Important**: Price values are in mantissa format. To get the actual price, use: `actual_price = mantissa × 10^exponent`. For example: `1006900000000 × @@ -123,11 +104,10 @@ Number of data publishers contributing to this price feed - **Availability**: Always included when any price properties are present - **Algorithm**: Count of publishers whose data passed validation and quality checks - **Invariants**: Always positive for valid price feeds -- **Business Value**: Higher count indicates more robust price discovery and reduced manipulation risk #### Decimal Exponent - `exponent` -Power of 10 to apply for decimal representation +Decimal exponent for price conversion - **Type**: `i16` - **Availability**: Always included when price properties are present @@ -156,7 +136,6 @@ Highest bid price across all contributing publishers - **Availability**: Only included if requested in subscription properties - **Algorithm**: Maximum bid price from all publishers with active order book data - **Invariants**: Non-zero when present, typically ≤ current price -- **Business Value**: Essential for market makers and algorithmic trading strategies #### Lowest Market Ask - `best_ask_price` @@ -166,7 +145,6 @@ Lowest ask price across all contributing publishers - **Availability**: Only included if requested in subscription properties - **Algorithm**: Minimum ask price from all publishers with active order book data - **Invariants**: Non-zero when present, typically ≥ current price -- **Business Value**: Critical for understanding market liquidity and bid-ask spreads ### Derivatives Properties (FundingRate Feed Type Only) @@ -178,7 +156,6 @@ Current funding rate for perpetual futures contracts - **Availability**: Only for FeedKind::FundingRate feeds, only if requested in subscription - **Algorithm**: Interest rate differential: `(PerpetualsPrice - IndexPrice) / IndexPrice` - **Invariants**: Can be positive (longs pay shorts) or negative (shorts pay longs) -- **Business Value**: Essential for perpetual futures trading and funding arbitrage #### Funding Payment Timestamp - `funding_timestamp` @@ -187,7 +164,6 @@ Timestamp when funding rate was last calculated or applied - **Type**: `optional u64` (microseconds) - **Availability**: Only for FeedKind::FundingRate feeds, only if requested in subscription - **Invariants**: Valid Unix timestamp in microseconds when present -- **Business Value**: Critical for funding payment timing and schedule management #### Funding Update Interval - `funding_interval` @@ -197,9 +173,8 @@ Duration between consecutive funding rate calculations - **Availability**: Only for FeedKind::FundingRate feeds, only if requested in subscription - **Invariants**: Positive value when present - **Typical Values**: 28,800,000,000 microseconds (8 hours) for major exchanges -- **Business Value**: Used for funding cost calculations and payment scheduling -## Available Properties by Use Case +## Available Properties by Feed Types Based on the [API documentation](https://pyth-lazer.dourolabs.app/docs), you can request specific properties when subscribing: @@ -237,12 +212,6 @@ Lazer offers multiple delivery channels to match your latency and frequency requ | `fixed_rate@50ms` | Updates every 50 milliseconds | Low-latency trading systems | | `fixed_rate@200ms` | Updates every 200 milliseconds | Standard trading applications | - - **Channel Selection**: Most production applications use `real_time` for - maximum freshness. Fixed-rate channels provide predictable update timing for - applications requiring consistent intervals. - - ## Signature Schemes and Binary Formats Lazer provides multiple cryptographic formats to support different blockchain ecosystems. When you subscribe, you can request specific binary formats in the `chains` parameter: From b73d175a2aafdb2eff2452c5d1b8b073687d8ce6 Mon Sep 17 00:00:00 2001 From: nidhi-singh02 Date: Thu, 25 Sep 2025 11:23:08 +0530 Subject: [PATCH 5/8] update unsigned usecase --- pages/lazer/payload-reference.mdx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pages/lazer/payload-reference.mdx b/pages/lazer/payload-reference.mdx index 873ba8e0..e723f434 100644 --- a/pages/lazer/payload-reference.mdx +++ b/pages/lazer/payload-reference.mdx @@ -253,12 +253,7 @@ Lazer provides multiple cryptographic formats to support different blockchain ec #### Unsigned Format (`leUnsigned`) - **Signature**: None (raw payload) -- **Use Cases**: Testing, development, trusted environments - - - **Security**: Never use in production - - +- **Use Cases**: Off-chain use, testing and development
@@ -266,6 +261,5 @@ Lazer provides multiple cryptographic formats to support different blockchain ec **How to Choose**: Use `evm` for Ethereum-compatible chains, `solana` for - Solana, `leEcdsa` for custom implementations, and `leUnsigned` only for - testing. + Solana, `leEcdsa` for custom implementations, and `leUnsigned` for off-chain. From 45ddfa8131ed36724ae84464490e5bd74eba9626 Mon Sep 17 00:00:00 2001 From: nidhi-singh02 Date: Tue, 30 Sep 2025 15:07:23 +0530 Subject: [PATCH 6/8] update algorithm --- pages/lazer/payload-reference.mdx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pages/lazer/payload-reference.mdx b/pages/lazer/payload-reference.mdx index e723f434..d9c4a0dc 100644 --- a/pages/lazer/payload-reference.mdx +++ b/pages/lazer/payload-reference.mdx @@ -93,7 +93,7 @@ Main aggregate price calculated from all contributing publishers - **Type**: `optional non-zero i64` (mantissa representation) - **Availability**: Only included if requested in subscription properties -- **Algorithm**: Robust statistical aggregation using median-based methods with outlier detection +- **Algorithm**: Refer to [price aggregation](../../price-feeds/how-pyth-works/price-aggregation) for the current algorithm - **Invariants**: Non-zero when present (null values filtered out) #### Data Publisher Count - `publisher_count` @@ -102,7 +102,6 @@ Number of data publishers contributing to this price feed - **Type**: `u16` - **Availability**: Always included when any price properties are present -- **Algorithm**: Count of publishers whose data passed validation and quality checks - **Invariants**: Always positive for valid price feeds #### Decimal Exponent - `exponent` @@ -111,7 +110,6 @@ Decimal exponent for price conversion - **Type**: `i16` - **Availability**: Always included when price properties are present -- **Algorithm**: Determines decimal placement for all price values in the feed - **Invariants**: Typically negative (e.g., -8 for USD prices, -18 for token prices) - **Usage**: Convert mantissa to actual price: `actual_price = mantissa × 10^exponent` - **Example**: With exponent `-8`, mantissa `1006900000000` becomes `$10,069.00` @@ -122,7 +120,7 @@ Confidence interval representing price uncertainty - **Type**: `optional i64` (mantissa representation) - **Availability**: Only included if requested in subscription properties -- **Algorithm**: Statistical measure derived from publisher price variance and market volatility +- **Algorithm**: Refer to [price aggregation](../../price-feeds/how-pyth-works/price-aggregation) for the current algorithm - **Invariants**: Positive when present - **Usage**: Risk management and price quality assessment @@ -134,7 +132,7 @@ Highest bid price across all contributing publishers - **Type**: `optional non-zero i64` (mantissa representation) - **Availability**: Only included if requested in subscription properties -- **Algorithm**: Maximum bid price from all publishers with active order book data +- **Algorithm**: Refer to [price aggregation](../../price-feeds/how-pyth-works/price-aggregation) for the current algorithm - **Invariants**: Non-zero when present, typically ≤ current price #### Lowest Market Ask - `best_ask_price` @@ -143,7 +141,7 @@ Lowest ask price across all contributing publishers - **Type**: `optional non-zero i64` (mantissa representation) - **Availability**: Only included if requested in subscription properties -- **Algorithm**: Minimum ask price from all publishers with active order book data +- **Algorithm**: Refer to [price aggregation](../../price-feeds/how-pyth-works/price-aggregation) for the current algorithm - **Invariants**: Non-zero when present, typically ≥ current price ### Derivatives Properties (FundingRate Feed Type Only) @@ -154,7 +152,6 @@ Current funding rate for perpetual futures contracts - **Type**: `optional i64` (mantissa representation) - **Availability**: Only for FeedKind::FundingRate feeds, only if requested in subscription -- **Algorithm**: Interest rate differential: `(PerpetualsPrice - IndexPrice) / IndexPrice` - **Invariants**: Can be positive (longs pay shorts) or negative (shorts pay longs) #### Funding Payment Timestamp - `funding_timestamp` From 1cd62f6a6b241d19fc9d6b796974ea573c8d259b Mon Sep 17 00:00:00 2001 From: nidhi-singh02 Date: Fri, 3 Oct 2025 17:38:02 +0530 Subject: [PATCH 7/8] add 1s channel and other comments --- pages/lazer/payload-reference.mdx | 58 ++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/pages/lazer/payload-reference.mdx b/pages/lazer/payload-reference.mdx index d9c4a0dc..06be4e3d 100644 --- a/pages/lazer/payload-reference.mdx +++ b/pages/lazer/payload-reference.mdx @@ -16,6 +16,14 @@ A Lazer payload is a real-time data update containing financial market informati ## Stream Response Structure + + **Customizable Payload**: The payload structure is customizable based on the + properties you request in your subscription. Only the fields you specify will + be included in the response. See [Available Properties by Feed + Types](#available-properties-by-feed-types) for details on what you can + request. + + When you receive a `StreamUpdated` message from Lazer, it contains the following structure: ### Top-Level Response Fields @@ -23,7 +31,7 @@ When you receive a `StreamUpdated` message from Lazer, it contains the following | Field | Type | Description | | ---------------- | --------------- | ------------------------------------------------------ | | `type` | `string` | Always `"streamUpdated"` for price updates | -| `subscriptionId` | `number` | Your subscription identifier | +| `subscriptionId` | `number` | Your subscription identifier, provided by the user | | `parsed` | `ParsedPayload` | Human-readable price data (when `parsed: true`) | | `evm` | `BinaryData` | EVM-compatible binary payload (when requested) | | `solana` | `BinaryData` | Solana-compatible binary payload (when requested) | @@ -32,18 +40,18 @@ When you receive a `StreamUpdated` message from Lazer, it contains the following ### Parsed Payload Structure -The `parsed` object contains human-readable price data: +The `parsed` object contains human-readable price data (if `parsed` is requested): | Field | Type | Description | | ------------- | ------------------ | ---------------------------------------------------------- | | `timestampUs` | `string` | Unix timestamp in microseconds when the data was generated | | `priceFeeds` | `Array` | Array of price feed data objects | -## How Does a Price Feed Look? +## What does a price feed update look like? Each price feed in the `priceFeeds` array represents real-time market data for a specific trading pair (e.g., BTC/USD, ETH/USD). Think of a price feed as a comprehensive snapshot of market conditions for that asset. -Here's what a typical price feed looks like in a Lazer response: +Here's what a typical StreamUpdated response that contains a PriceFeed looks like:: ```json { @@ -60,6 +68,15 @@ Here's what a typical price feed looks like in a Lazer response: "publisherCount": 9, "exponent": -8, "confidence": 1373488286 + }, + { + "priceFeedId": 2, + "price": "448480908040", + "bestBidPrice": "448475995765", + "bestAskPrice": "448508987987", + "publisherCount": 12, + "exponent": -8, + "confidence": 106965585 } ] }, @@ -71,9 +88,10 @@ Here's what a typical price feed looks like in a Lazer response: ``` - **Important**: Price values are in mantissa format. To get the actual price, - use: `actual_price = mantissa × 10^exponent`. For example: `1006900000000 × - 10^(-8) = $10,069.00` + **Important**: The price is stored in two parts: an integer mantissa value + (the price field) and a power-of-ten exponent. The actual decimal + representation of the price is given by: `decimal_price = price × + 10^exponent`. For example: `1006900000000 × 10^(-8) = $10,069.00` ## Property Specifications @@ -193,21 +211,17 @@ Based on the [API documentation](https://pyth-lazer.dourolabs.app/docs), you can - `fundingTimestamp` - Most recent funding rate timestamp - `fundingRateInterval` - Duration between funding updates - - **Subscription Flexibility**: You only receive the properties you request in - your subscription, optimizing bandwidth and processing. - - ## Subscription Channels Lazer offers multiple delivery channels to match your latency and frequency requirements: -| Channel | Description | Use Cases | -| ------------------ | --------------------------------------- | ------------------------------------------- | -| `real_time` | Updates sent immediately when available | High-frequency trading, real-time analytics | -| `fixed_rate@1ms` | Updates every 1 millisecond | Ultra-low latency applications | -| `fixed_rate@50ms` | Updates every 50 milliseconds | Low-latency trading systems | -| `fixed_rate@200ms` | Updates every 200 milliseconds | Standard trading applications | +| Channel | Description | Use Cases | +| ------------------ | ---------------------------------------------------------------------------------------------- | ------------------------------------------- | +| `real_time` | Updates sent immediately when new price is available (no faster than 1ms, no slower than 50ms) | High-frequency trading, real-time analytics | +| `fixed_rate@1ms` | Updates every 1 millisecond | Ultra-low latency applications | +| `fixed_rate@50ms` | Updates every 50 milliseconds | Low-latency trading systems | +| `fixed_rate@200ms` | Updates every 200 milliseconds | Standard trading applications | +| `fixed_rate@1s` | Updates every 1 second | General applications, dashboards | ## Signature Schemes and Binary Formats @@ -257,6 +271,10 @@ Lazer provides multiple cryptographic formats to support different blockchain ec
- **How to Choose**: Use `evm` for Ethereum-compatible chains, `solana` for - Solana, `leEcdsa` for custom implementations, and `leUnsigned` for off-chain. + **How to Choose**: Select the optimal signing algorithm for your use case. + These formats are not blockchain-specific - for example, the `solana` format + (Ed25519) has been used on non-SVM blockchains when Ed25519 was the most + efficient algorithm for that specific chain. Choose `evm` for secp256k1 ECDSA, + `solana` for Ed25519, `leEcdsa` for little-endian secp256k1, and `leUnsigned` + for off-chain use. From 9d69e01d2c1db567fd5f946d14cca769b0a586c0 Mon Sep 17 00:00:00 2001 From: nidhi-singh02 Date: Fri, 3 Oct 2025 17:47:04 +0530 Subject: [PATCH 8/8] identation in callout --- pages/lazer/payload-reference.mdx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pages/lazer/payload-reference.mdx b/pages/lazer/payload-reference.mdx index 06be4e3d..e1834fe8 100644 --- a/pages/lazer/payload-reference.mdx +++ b/pages/lazer/payload-reference.mdx @@ -89,9 +89,10 @@ Here's what a typical StreamUpdated response that contains a PriceFeed looks lik **Important**: The price is stored in two parts: an integer mantissa value - (the price field) and a power-of-ten exponent. The actual decimal - representation of the price is given by: `decimal_price = price × - 10^exponent`. For example: `1006900000000 × 10^(-8) = $10,069.00` + (the `price` field) and a power-of-ten `exponent`. +
The actual decimal representation of the price is given by: `decimal_price + = price × 10^exponent`. +
For example: `1006900000000 × 10^(-8) = $10,069.00`
## Property Specifications