Skip to content

Commit 5fe32a8

Browse files
docs: add documentation for null price values in Lazer payload reference
- Added example JSON showing price field with null value - Added info callout explaining null price behavior - Added warning callout in Aggregate Market Price section - Documented that null indicates price could not be computed - Advised users to use last valid price or wait for fresh update Co-Authored-By: Nidhi Singh <[email protected]>
1 parent 7d1941f commit 5fe32a8

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

pages/lazer/payload-reference.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ Here's what a typical StreamUpdated response that contains a PriceFeed looks lik
7777
"publisherCount": 12,
7878
"exponent": -8,
7979
"confidence": 106965585
80+
},
81+
{
82+
"priceFeedId": 3,
83+
"price": null,
84+
"bestBidPrice": null,
85+
"bestAskPrice": null,
86+
"publisherCount": 5,
87+
"exponent": -8,
88+
"confidence": null
8089
}
8190
]
8291
},
@@ -87,6 +96,12 @@ Here's what a typical StreamUpdated response that contains a PriceFeed looks lik
8796
}
8897
```
8998

99+
<Callout type="info">
100+
In the example above, the third price feed shows `"price": null`, indicating
101+
that the price could not be computed. When you encounter null values, use the
102+
last valid price or wait for the next update.
103+
</Callout>
104+
90105
<Callout type="warning">
91106
**Important**: The price is stored in two parts: an integer mantissa value
92107
(the `price` field) and a power-of-ten `exponent`.
@@ -115,6 +130,15 @@ Main aggregate price calculated from all contributing publishers
115130
- **Algorithm**: Refer to [price aggregation](../../price-feeds/how-pyth-works/price-aggregation) for the current algorithm
116131
- **Invariants**: Non-zero when present (null values filtered out)
117132

133+
<Callout type="warning">
134+
**Null Price Values**: In some cases, you may receive a `null` value for the
135+
`price` field (shown as `"price": null` in JSON). This indicates that the
136+
price could not be computed at that moment. When this occurs, you should
137+
either use the last valid price you received or wait for a fresh update with
138+
a valid price. Note that you may not always receive a price update in the
139+
response if no valid price is available.
140+
</Callout>
141+
118142
#### Data Publisher Count - `publisher_count`
119143

120144
Number of data publishers contributing to this price feed

0 commit comments

Comments
 (0)