LogoLogo
  • BASICS
    • What is Contango?
    • Who's this for?
    • Use cases
    • What is looping?
    • How does it work?
      • Detailed tx analysis
    • Key features
      • Liquidity and price impact
      • Pricing
      • Funding rates
      • PnL computations
      • Fees
      • Automation
      • Liquidations
      • Margin in any currency
      • Multiple positions on the same pair and direction
      • More than 300 trading pairs
      • Incentives and rewards
        • Contango points
        • Third-party rewards
        • Incentive layer
    • Ecosystem
    • Risks
  • APP
    • Simplified
      • Simplified tutorials
    • Advanced
      • Advanced tutorials
    • Staking
      • How staking works
      • Staking APR
      • Staking tutorial
    • oTANGO
      • oTANGO tutorial
    • Profile
  • TANGO
    • TANGOnomics
    • Allocations and unlocking
  • RESOURCES
    • Link tree
    • Brand assets
    • Contracts and audits
    • Permits and approvals
    • Glossary
    • FAQ
      • PT instruments
    • Troubleshooting
Powered by GitBook
On this page
  • Long position
  • Short position
  1. BASICS

How does it work?

PreviousWhat is looping?NextDetailed tx analysis

Last updated 10 months ago

Contango builds positions by automating strategies, through .

When a trader opens a long ETH/DAI position with DAI as margin, the protocol gets the remaining DAI from a flash loan, swaps all DAI for ETH on the spot market, and lends ETH on a money market, to borrow DAI and repay the flash loan.

When closing a position, Contango simply undoes the above steps.

Below is a detailed explanation how Contango builds long and short positions.

Long position

Quote currency as margin

If a trader wants to long ETH with some DAI as margin, Contango will first obtain the remaining DAI with a flash loan, swap all DAI for ETH, lend that ETH on a variable rate market, and borrow DAI against it to reimburses the initial flash loan.

The diagram below recaps these steps and provides a numerical example when a trader longs 1 ETH with 200 DAI as margin, and spot ETH = 1000 DAI.

Base currency as margin

If a trader wants to long ETH with some ETH as margin, Contango will first obtain DAI with a flash loan, swap DAI for ETH, lend that ETH + the ETH posted as margin, and borrow DAI against it to reimburses the initial flash loan.

The diagram below recaps these steps and provides a numerical example when a trader longs 1 ETH with 0.2 ETH as margin, and spot ETH = 1000 DAI.

Short position

Short are built slightly different from the above flow.

  • Effectively, shorts are longs on the inverse contract with a +1 on the leverage. For instance, a 2x ETH/DAI short is like a 3x long on the inverse DAI/ETH contract. This is because you need the full notional exposure on the asset you're shorting for your PnL to be coherent.

  • A consequence of this is that you always have a liquidation price on Contango, even at 1x leverage.

Quote currency as margin

If a trader wants to short ETH with some DAI as margin, Contango will first obtain the full ETH exposure with a flash loan, swap all ETH for DAI, lend that DAI on a variable rate market, and borrow ETH against it to reimburses the initial flash loan.

The diagram below recaps these steps and provides a numerical example when a trader shorts 1 ETH with 200 DAI as margin, and spot ETH = 1000 DAI.

Base currency as margin

If a trader wants to short ETH with some ETH as margin, Contango will first obtain the full ETH exposure with a flash loan, swap all ETH for DAI, lend that DAI on a variable rate market, and borrow ETH against it to reimburses the initial flash loan.

The diagram below recaps these steps and provides a numerical example when a trader shorts 1 ETH with 0.2 ETH as margin, and spot ETH = 1000 DAI.

Please note that currently Contango has integrated with (which does not necessarily close the door to integrations with fixed-rate markets too).

The following sub-section examines in detail a .

real transaction
looping
variable-rate markets
flash loans
High level explanation of how Contango synthetizes a long ETH/DAI position
Steps carried out to open a long ETH/DAI position, with DAI as margin
Steps carried out to open a long ETH/DAI position, with ETH as margin
Steps carried out to open a short ETH/DAI position, with DAI as margin
Steps carried out to open a short ETH/DAI position, with ETH as margin