Skip to content

Commit 2d21106

Browse files
Address PR comments: Move TWAP limitation to main paragraph, remove unused parameter, mention similarity to regular price updates
Co-Authored-By: Tejas Badadare <[email protected]>
1 parent 6449055 commit 2d21106

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

pages/price-feeds/use-real-time-data/solana.mdx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,21 +243,17 @@ The [SDK documentation](https://github.com/pyth-network/pyth-crosschain/tree/mai
243243

244244
## Time-Weighted Average Price (TWAP)
245245

246-
Pyth also provides Time-Weighted Average Price (TWAP) for Solana applications. TWAP represents the average price over a specified time window, which can be useful for reducing the impact of short-term price volatility.
247-
248-
<Callout type="warning" emoji="⚠️">
249-
The TWAP window is currently limited to a maximum of 10 minutes (600 seconds).
250-
</Callout>
246+
Pyth also provides Time-Weighted Average Price (TWAP) for Solana applications. TWAP represents the average price over a specified time window, which can be useful for reducing the impact of short-term price volatility. The TWAP window is currently limited to a maximum of 10 minutes (600 seconds).
251247

252248
### Using TWAP in Solana Programs
253249

254-
To use TWAP in your Solana program, import the `TwapUpdate` struct from the Pyth Solana receiver SDK:
250+
To use TWAP in your Solana program, import the `TwapUpdate` struct from the Pyth Solana receiver SDK. The process for fetching and posting TWAP updates is similar to regular price updates from Hermes.
255251

256252
```rust copy
257253
use pyth_solana_receiver_sdk::price_update::{TwapUpdate};
258254

259255
#[derive(Accounts)]
260-
#[instruction(amount_in_usd : u64, twap_window_seconds: u64)]
256+
#[instruction(twap_window_seconds: u64)]
261257
pub struct SampleWithTwap<'info> {
262258
#[account(mut)]
263259
pub payer: Signer<'info>,
@@ -271,7 +267,6 @@ Update your instruction logic to read the TWAP from the update account:
271267
```rust copy
272268
pub fn sample_with_twap(
273269
ctx: Context<SampleWithTwap>,
274-
amount_in_usd: u64,
275270
twap_window_seconds: u64,
276271
) -> Result<()> {
277272
let twap_update = &mut ctx.accounts.twap_update;

0 commit comments

Comments
 (0)