AshSwap Docs
  • GETTING STARTED
    • โ„น๏ธUnderstand AshSwap
      • ๐Ÿ“œAshSwap Litepaper
      • ๐Ÿช™AshSwap Tokenomics
      • ๐Ÿ’ธAshSwap Fees
    • ๐Ÿ—บ๏ธAshSwap Roadmap
    • โ›“๏ธAshSwap Token
    • โ„น๏ธUnderstand AshPerp
      • โ‰๏ธWhy AshPerp?
      • โšกAshPerp Key Technologies
      • โš™๏ธHow AshPerp Works
      • ๐Ÿ’นAshPerp Oracle
      • โ›‘๏ธAshPerp Fee
      • ๐Ÿ”คAshPerp Terms
        • โš–๏ธBorrowing Fee
        • ๐ŸŒŠSpread
        • ๐Ÿ’ฐNet PnL
  • AshSwap DEX
    • ๐Ÿ’ณConnect a Wallet
    • ๐Ÿ”„Swap
    • โ†”๏ธLiquidity Provision
      • ๐Ÿ“‹Liquidity Provision Guide
    • ๐ŸŒŠLiquidity Staking
      • ๐Ÿ“Liquidity Staking Guide
    • ๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘Governance - AshDAO
      • ๐Ÿ•œGovernance Staking
        • ๐Ÿ“Governance Staking Guide
      • โฌ†๏ธFarm Boost
        • ๐Ÿ“Farm Boost Guide
      • ๐ŸšฎFarm Weight Voting
        • ๐Ÿ“Farm Weight Voting Guide
      • ๐Ÿ›‚AshDAO Proposal
        • ๐Ÿ“AshDAO Proposal Guide
      • ๐Ÿ’ธBribe
        • ๐Ÿ“Bribe Guide
  • Aggregator
    • ๐Ÿ”€Understand Aggregator
      • โฌ†๏ธFeature Updates
    • ๐Ÿ”Swap Guide
    • ๐Ÿ› ๏ธAggregator Integration
      • Adding Fees
  • ASHPERP
    • ๐Ÿ“ŠTrade
      • ๐Ÿ“Trade Guide
    • ๐Ÿ›ก๏ธPerpetual Vault
      • ๐Ÿ“Vault Guide
    • โšกOne-click Trading (1CT)
    • ๐ŸคReferral
      • ๐Ÿ“Referral Guide
    • ๐ŸŒช๏ธAshGuard NFTs
      • ๐Ÿ“œAshGuard Staking Guide
      • ๐Ÿ“œAshGuard Merge Guide
  • Developers
    • ๐Ÿ“”Smart Contracts
      • Pool Router
      • Stable Pool
      • Crypto Pool
      • Liquidity Staking (Farming)
      • Governance Staking
    • ๐Ÿ“ฆSDKs
  • Resources
    • ๐Ÿ”—Links & Contact
    • โšชDevnet
      • ๐ŸšฐFaucets
    • ๐Ÿ“Audit Report
    • ๐Ÿ‘จโ€๐ŸซAshSwap Academy
      • Decentralized Finance (DeFi)? โ€” What is it?
      • DeFi Components. What are they?
      • DeFi Handbook โ€” Introduction to Decentralized Finance
      • ๐Ÿ“„What is LP Token?
      • ๐Ÿ“„Dynamic Aggregator
    • โ”Popular Error Message
Powered by GitBook
On this page
  • Trading Parameters
  • Trading Flow
  • Open a market order
  • Open a limit / stop order
  • Close an order
  • Update Take Profit / Stop Loss Price
  • Take Profit / Close Stop Loss
  • Adjust Leverage
  • Liquidations

Was this helpful?

  1. GETTING STARTED
  2. Understand AshPerp

How AshPerp Works

PreviousAshPerp Key TechnologiesNextAshPerp Oracle

Last updated 1 year ago

Was this helpful?

  • Trades are opened with USDC collateral, regardless of the trading pair.

  • The leverage is synthetic and backed by our Vault. USDC is taken from the vault to pay for the tradersโ€™ profits or sent to the vault if the PnL is negative.

Trading Parameters

Parameter
Metric

Min Position Size

1000

Max Collateral

5000

Max OI

Dynamic

Min Leverage

2

Max Leverage

100

Max Positions per Pair

3

Maximum SL

80%

Maximum TP

900%

Trading Flow

Currently, AshPerp only supports those types of orders:

  • Market: To be used to open a trade immediately. It will open at the market price + spread.

  • Limit: To be used when you want to go long at a lower price than present, or to go short if the price reaches a higher price than present. The execution price is the determined limit price + spread.

  • Stop: To be used when you want to go long if the price reaches a higher price than present, or to go short if the price reaches a lower price than present. You might want to use this to long a breakout, or short a breakdown. The execution price is the determined stop price + spread.

Open a market order

  • When a user creates a market order, their order is sent to the AshPerpโ€™s servers.

  • The price will be fulfilled off-chain via our oracle system, and the fulfilled order is sent to the trading contract afterwards.

  • A small fee will be charged for opening an order.

Open a limit / stop order

  • Users initiate a trade by sending their order to the Trading Contract and paying the associated gas fee. Our Matching bots then receive the order and wait until the price aligns with the user's specified price.

  • When the price meets the user's criteria, the Matching bots sign off on this price and forward it to the Trading Engine. The Trading Engine, in turn, contacts the oracle bots to gather their signatures and confirm the price. Following this verification, the Trading Engine proceeds to submit the transaction to our Trading Contract. Before opening the order, the Trading Contract conducts a final verification of the price.

  • A small fee will be charged for opening an order.

Close an order

  • When a user closes their order, the close order awaits fulfillment through the price feed system, after which the callback is triggered to officially close it.

  • A small fee will be charged for closing an order.

Update Take Profit / Stop Loss Price

  • Users can modify the take profit (TP) or stop loss (SL) price of an order, and the new parameters will be stored in the contract.

Take Profit / Close Stop Loss

  • When an order reaches the take profit or stop loss condition, Matching bots will initiate the order and submit a request to our system to close the order.

  • When the price meets the TP/SL price, the Matching bots sign off on this price and forward it to the Trading Engine. The Trading Engine, in turn, contacts the oracle bots to gather their signatures and confirm the price. Following this verification, the Trading Engine proceeds to submit the transaction to our Trading Contract. Before opening the order, the Trading Contract conducts a final verification of the price.

  • A small fee will be charged for closing an order.

Adjust Leverage

  • Adjusting the leverage of your order keeps the position size constant; only the amount of collateral is altered to match the new leverage setting. Currently, AshPerp permits only a reduction in leverage. To lower the leverage, traders must add a proportional amount of collateral to the position.

  • This adjustment in collateral affects the Liquidation Price accordingly.

Liquidations

  • When an order reaches the liquidation price, Matching bots will initiate the order and send a request to our system to liquidate the order. The Liquidation Price Distance is calculated as follows:

LiquidationPriceDistance=OpenPriceโˆ—(Collateralโˆ—90%โˆ’BorrowFee)โˆ—LeverageCollateralLiquidationPriceDistance=\frac{OpenPrice*(Collateral*90\%-BorrowFee)*Leverage}{Collateral}LiquidationPriceDistance=CollateralOpenPriceโˆ—(Collateralโˆ—90%โˆ’BorrowFee)โˆ—Leverageโ€‹
  • The liquidation price is determined as follows:

    • For Long positions: Open Price - Liquidation Price Distance

    • For Short positions: Open Price + Liquidation Price Distance.

  • When the price meets liquidation price, the Matching bots sign off on this price and forward it to the Trading Engine. The Trading Engine, in turn, contacts the oracle bots to gather their signatures and confirm the price. Following this verification, the Trading Engine proceeds to submit the transaction to our Trading Contract. Before opening the order, the Trading Contract conducts a final verification of the price.

  • A small fee will be charged when your order is liquidated.

โ„น๏ธ
โš™๏ธ
๐Ÿ›ก๏ธPerpetual Vault
๐Ÿ’นAshPerp Oracle