Skip to content

Commit 71ab426

Browse files
committed
more updates
1 parent cbe7934 commit 71ab426

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

src/content/data-streams/concepts/calculated-streams.mdx

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Instead of aggregating only raw market data, calculated streams compute derived
4646

4747
## How to identify calculated streams
4848

49-
Calculated streams are marked with a <span style="display: inline-block; font-size: 0.75rem; padding: 2px 6px; margin-left: 4px; border-radius: 4px; background: var(--blue-100); color: var(--blue-700); font-weight: 500; vertical-align: middle;">Calculated</span> badge in the documentation.
49+
Calculated streams are marked with a <span style="display: inline-block; font-size: 0.75rem; padding: 2px 6px; margin-left: 4px; border-radius: 4px; background: var(--blue-100); color: var(--blue-700); font-weight: 500; vertical-align: middle;">Calculated</span> badge in the Data Streams feed list.
5050

5151
## How calculated streams work
5252

@@ -87,6 +87,20 @@ External data from specific trusted providers, such as yield rates or reference
8787

8888
The DON executes the predefined formula (weighted averages, ratios, sums, etc.) using the latest available inputs. The calculated value is packaged into a signed report with standard metadata (timestamps, fees) and published through the Data Streams Aggregation Network. You consume these reports using the same REST APIs, WebSocket connections, and onchain verification as traditional streams.
8989

90+
## Example: Tokenized yield product
91+
92+
A calculated stream for a tokenized yield-bearing vault might combine:
93+
94+
- **Vault balance (onchain)**: Total assets in the vault contract
95+
- **Token supply (onchain)**: Circulating supply of vault shares
96+
- **Accrued yield (offchain)**: Interest from an external API
97+
98+
**Formula:** `(vault balance + accrued yield) / token supply`
99+
100+
**Result**: a price per share that reflects the vault's total value including pending yield.
101+
102+
Without this stream, protocols accepting the vault token as collateral would need to query the vault contract, fetch accrued interest from the yield provider's API, perform the calculation themselves, and keep this logic synchronized across all integrators. A calculated stream helps ensure integrators apply the same pricing logic and update together when the underlying formula or yield source changes.
103+
90104
---
91105

92106
## Risks and mitigation
@@ -101,6 +115,8 @@ Single-source inputs (such as a specific protocol API or contract) carry higher
101115

102116
#### Mitigation
103117

118+
The following strategies can help mitigate multiple dependency risks:
119+
104120
- Design your protocol to handle report gaps gracefully (pause operations, use last-known values with appropriate staleness checks, or implement fallbacks based on your risk tolerance)
105121
- Implement staleness checks to detect when reports stop arriving and trigger appropriate protocol responses
106122
- Understand your input sources and assess the reliability of each, particularly single-source APIs or contracts
@@ -115,6 +131,8 @@ If any input source experiences an outage (API errors, RPC failures, or contract
115131

116132
#### Mitigation
117133

134+
The following strategies can help mitigate timing and synchronization risks:
135+
118136
- Implement max deviation checks against expected ranges
119137
- Use time-weighted averages or circuit breakers for extreme moves
120138
- Monitor trends over time rather than reacting to individual updates
@@ -129,22 +147,10 @@ If any input source experiences an outage (API errors, RPC failures, or contract
129147

130148
---
131149

132-
## Example: Tokenized yield product
133-
134-
A calculated stream for a tokenized yield-bearing vault might combine:
135-
136-
- **Vault balance (onchain)**: Total assets in the vault contract
137-
- **Token supply (onchain)**: Circulating supply of vault shares
138-
- **Accrued yield (offchain)**: Interest from an external API
139-
140-
**Formula:** `(vault balance + accrued yield) / token supply`
141-
142-
**Result**: a price per share that reflects the vault's total value including pending yield.
143-
144-
Without this stream, protocols accepting the vault token as collateral would need to query the vault contract, fetch accrued interest from the yield provider's API, perform the calculation themselves, and keep this logic synchronized across all integrators. A calculated stream helps ensure integrators apply the same pricing logic and update together when the underlying formula or yield source changes.
145-
146150
## Best practices
147151

152+
To ensure the reliability and integrity of calculated streams in your application, consider the following best practices:
153+
148154
### Protocol design
149155

150156
- Set deviation limits to cap price changes per update or time window
@@ -158,8 +164,3 @@ Without this stream, protocols accepting the vault token as collateral would nee
158164
- Monitor key inputs independently when feasible (vault balances, token supplies, API availability) to identify which input may be causing issues
159165
- Alert on movements outside your expected range
160166
- For critical applications, consider independently monitoring the availability of single-source APIs or contracts used as inputs
161-
162-
### Handling updates
163-
164-
- Subscribe to Chainlink release notes for formula changes
165-
- Test new streams or updated configurations in staging

0 commit comments

Comments
 (0)