Developer Docs
  • Introduction
  • Key Terms
  • Perpetual Swaps
    • vAMM
    • Margin
    • UA
    • TWAP
    • Funding payments
    • Liquidation
    • Insurance
    • Trading fees
  • Contracts Overview
  • Economic Parameters
  • Risk Factors
  • Guides
    • Trader Interactions
    • Liquidity Provision
    • Liquidation
    • Choosing proposedAmount
    • Governance
    • Staking
  • Core Contracts
    • ClearingHouse
    • Perpetual
    • Vault
    • Oracle
    • Insurance
    • CurveCryptoViews
  • Token Contracts
    • UA
    • vBase
    • vQuote
  • External Contracts
    • CryptoSwap
    • CurveMath
    • CurveToken
    • AggregatorV3Interface
  • Peripheral Contracts
    • RewardController
    • RewardDistributor
    • PerpRewardDistributor
    • StakedToken
    • EcosystemReserve
    • SafetyModule
    • SMRewardDistributor
    • AuctionModule
Powered by GitBook
On this page
  1. Perpetual Swaps

TWAP

Last updated 2 years ago

TWAP (Time-Weighted Average Price) is time weighted average price between two points in time. The TWAP is calculated over a fixed period size of 15 minutes. A simple fixed period size TWAP is used as described by

TWAP=priceCumulative2−priceCumulative1timestamp2−timestamp1{TWAP} = \frac{priceCumulative_2 -priceCumulative_1}{timestamp_2 - timestamp_1}TWAP=timestamp2​−timestamp1​priceCumulative2​−priceCumulative1​​

TWAPs are used to reduce the risk of price manipulations (see: )

https://docs.uniswap.org/protocol/V2/concepts/core-concepts/oracles
https://shouldiusespotpriceasmyoracle.com/