LogoLogo
AppBlogGovSocials
  • What is Premia?
    • Premia Origins
      • History
      • Principles
      • Mission, Vision, & Values
  • Quick Start
  • The Premia Protocol
    • Options on Premia
      • Options Primer
      • Order-book vs. AMM
    • Key Protocol Features
      • Base Layer (Exchange)
      • Depot Layer (Vaults)
      • Messaging Layer (RFQ & OB)
      • Fee Schedule
      • Differentiators
    • Concepts
      • LP Range Orders
      • Trading
      • Orderbook & Request-for-Quote (RFQ)
      • Fees
      • Exercise & Settlement
      • Margin
      • Oracles
      • Liquidity Mining
      • Referral Programs
      • Advanced Exchange Concepts
        • Token Integration Requirements
        • Flash Swaps and Loans
      • Vault Depot
        • What is a Depot?
        • APY Calculation
        • Underwriter Depot
    • Governance
      • Premian Civitas
        • Parliament
        • Blue Descent
        • Premian Assembly
        • "Influence" Politics
      • Voting (vxPremia)
        • vxPremia Manifold
        • vxPremia Rewards
          • Options Liquidity Mining
          • Protocol Commissions
          • AirDrip Initiative
      • Operator & Facilitator Role
        • Operational Expenditure and Maintenance Costs
        • Insurance Fund
      • Meta Economics
  • Developer Center
    • APIs
      • Orderbook API
        • REST API
        • WEBSOCKET
      • Subgraph API
      • Containerized API
        • API Reference
          • Orderbook
            • Quotes
            • Orders
          • Pool
            • Settle
            • Exercise
            • Annihilate
          • Account
            • Collateral Approval
            • Orders
            • Collateral Balances
            • Native Balance
            • Option Balances
          • Pools
            • Find Pools
            • Create Pools
            • Valid Maturities
            • Valid Strikes
          • Oracles
            • IV
            • Spot
          • Vaults
            • Quote
            • Trade
        • WebSockets Reference
          • Authorization
          • Connection
          • Quotes Channel
          • RFQ Channel
    • SDK
      • Guides
      • SDK Technical Docs
    • Contracts
      • Multi-Signature Wallets
      • V3 Protocol
        • Overview
        • Guides
        • Smart Contract Technical Documentation
      • Margin
      • Orderbook
      • vxPremia
      • Universal Router
      • Vaults
    • Integrations
      • Use Cases
      • Code Snippets
    • Subgraph
    • V3 Change log
  • Bots
    • Range Order Bot
  • Resources
    • VIP & Institutional Services
    • Media Kit
    • Bug Bounty
    • Audits
    • Community Groups
    • Research
      • SSVI
    • Legal, Terms, & Disclaimers
      • Terms of Service
      • Privacy Policy
      • Cookie Policy
      • Prohibited Use
      • Affiliate & Advocate Program
      • Self-Service Affiliate Agreement
      • Bug Bounty Terms
      • Academy/Newsletter Disclaimer
      • Trading Competition Terms and Disclaimers
      • Blue Descent
      • Legal Disclaimer
      • Media Disclaimer
      • AML/KYC Policies
      • Intellectual Property
      • Amendments & Updates
      • Contact Us
      • FAQs (WIP)
    • 📰Newsletter
    • 🌊Crypto News Blotter
    • 🎓Academy
    • 🔵Premia Blue (V3)
    • 💎Premia V2 Docs
Powered by GitBook

Terms and Disclaimers

  • Privacy Policy
On this page
  • Overview
  • AMM
  • Orderbook / RFQ System
  • Makers
  • Takers
  • Vaults
  • External Protocols / Third Parties

Was this helpful?

  1. The Premia Protocol
  2. Concepts

Trading

PreviousLP Range OrdersNextOrderbook & Request-for-Quote (RFQ)

Last updated 1 year ago

Was this helpful?

Overview

Long (short) options are represented as an in a wallet. It allows any EOA or Contract address to easily transfer, trade, or exercise (settle) the option at a future time. When taking liquidity from any source, a transaction fee will need to be paid. More details on fees can be found .

While all options settle within their respective pools, it’s possible to interact with multiple sources of liquidity for the same option. Users of the or Premia v3 SDK will have easy access to the best quotes from each source. Please see here for more details about receiving a quote.

There could be up to 4 sources of liquidity for a given option:

  1. AMM - Range Orders

  2. Orderbook / RFQ System

  3. Vaults

  4. External Protocols / Third Parties

Interacting with the and System can be done directly via the IPool interface while and would involve directly corresponding with their contracts or interfaces if not available on the Premia Interface or Premia v3 SDK.

AMM

Traders (takers) on the Premia v3 exchange can receive a quote to buy (sell) an option from LPs in an option pool at the given quote price using getQuoteAMM. If the taker deems the quote acceptable, they can trade the option and pay (receive) a premium in addition to receiving long (short) option contracts in the form of .

The trade function has 3 inputs: size, isBuy, and premiumLimit. The size parameter refers to the order size, isBuy is a boolean to signify trade direction, and premiumLimit is used for slippage control. If an order trades beyond the premiumLimit, ie. the average execution price of a buy (sell) order is above (below) the premiumLimit, the transaction will revert.

The difference between a pool’s current marketPrice and getQuoteAMM in the IPool interface is the price impact of a potential trade. This is a function of market liquidity and order size, where more a higher ratio of order size to existing liquidity will result in a higher price impact and vice versa.

It is possible to pay/receive premium/collateral for an option in the token of a user’s choice. This requires the user to define their swap parameters in the form of calldata, which will enable the swap to be executed on-chain before or after the necessary action to convert a token. The swapAndTrade and tradeAndSwap functions on each AMM pool can be used to facilitate this feature. More details can be found in the IPool interface within the Contract section.

Orderbook / RFQ System

Makers

A quote will have several parameters, among them a deadline. The deadline will specify how long a quote will be valid for. Alternatively, orders can be cancelled using cancelQuotesOB in the IPool Interface if an order needs to be cancelled before the deadline is reached. Multiple quotes can be cancelled at once by passing a list of quotes. Cancelling quotes can only be done on-chain.

Takers

Vaults

Vaults need to implement the getQuote function, allowing users to request the vault’s price for a specific option (strike, maturity, isCall), including trade size and direction (isBuy). The vault should return both the maxSize and price for the trade, including a maxSize of 0 if the option is not offered by the vault. To enable quotes to be filled, vaults should implement the trade function with the same parameters as the getQuote function.

In addition to implementing the above functions, vaults will additionally need to emit an UpdateQuotes() event (with no parameters) any time the vault’s quotes change, in order for the Premia Interface and Premia v3 SDK to track quote changes.

Anyone interested in learning more about developing vaults on top of Premia v3, Reach out to build with us!

External Protocols / Third Parties

It is entirely possible for other protocols/users/vaults to utilize the pools strictly as a settlement layer and exchange options outside of Premia. To be able to do this, the writeFrom function can be used.

writeFrom is a method that will mint both the long and short option, and send each to the designated addresses for underwriter and longReceiver. In order to invoke this function, the collateral for the short position must be provided. Using the writeFrom function will incur a transaction fee equal to 0.3% of the notional value:

Collateral is 1 for calls and the strike price for puts. In other words, the minting fee here is denominated in the collateral of the option.

Market Makers can provide quotes to the Orderbook either via (off-chain) or on-chain via add within the IOrderbookStream interface. An on-chain event is emitted with the details of each order. This acts as a transparent/capital efficient database for orders. Off-chain indexers can track the state of the Orderbook through these events.

While takers will fill their order on-chain, the process of getting a quote is done off-chain via the . We index all quotes in our subgraph, which users can get from the .

Once a taker has a quote they would like to fill, the order details need to be passed on-chain. The function can be used to fill a quote using the IPool Interface.

Traders can verify if a quote is still valid in the Orderbook by calling with the same inputs as . It is also possible to check the fill status of a quote by using .

More details on how the orderbook architecture can be found in Advanced Concepts under

Each vault will have its own unique contract and functions, however, each must implement the IVault interface to be integrated in the and SDK. If a third party vault correctly implements the IVault interface, it is eligible to be added to the V3 Vault Registry, which means its quotes will be automatically included in platform-wide quote streams.

Minting Fee=0.003∗Size∗CollateralMinting\:Fee = 0.003*Size*Collateral MintingFee=0.003∗Size∗Collateral
Orderbook API
Orderbook API
Orderbook API
fillQuoteOB
isQuoteOBValid
fillQuoteRFQ
getQuoteOBFilledAmount
Orderbook & Request-for-Quote (RFQ)
ERC-1155 token
Orderbook / RFQ
Vaults
ERC-1155 tokens
AMM
External Protocols
here
Premia Interface
Premia Interface