LogX Docs
  • LogX Aggregator
    • Trading Guide
      • Open Position - Market Order
      • Close Position - Market Order
      • Positions
      • Open Position - Limit Order
      • Close Position - Limit Order
      • Cancel Order
      • Orders
      • Open Position - TPSL Order
      • Close Position - TPSL Order
    • Functional Guide
      • Chains
      • Exchanges
      • Routing
      • Assets
      • Fees
    • Technical Guide
      • Architecture
      • Contracts
    • Protocol Details
      • Audits
      • APIs
      • Bug Bounty
  • LogX Perp Dex
    • Overview
    • Liquidity
      • Liquidity Providers
      • LLP Token
    • Chains and Pairs
    • Fee Structure
    • Incentives and Rewards
    • Contracts
      • Blast
    • Technical Overview
      • Open/Increase a market Position
      • Close/Decrease a Market position
      • Market Order Execution
      • Placing a Limit order
      • Limit and TPSL Order Execution
      • Liquidations
      • Adding/Removing Liquidity
      • Staking
  • Audit
Powered by GitBook
On this page
  1. LogX Perp Dex
  2. Technical Overview

Close/Decrease a Market position

In order to close an existing position:

  1. Call OrderManager.createDecreasePosition with

  • _collateralToken: address of the collateral token for the position.

  • _indexToken: address of the index token of the position.

  • _collateralDelta: keep this as 0 if you do not want to adjust the leverage for the position.

  • _sizeDelta: the USD value of the change in position size.

  • _isLong: whether the position is long or short

  • _receiver: the address to receive the withdrawn tokens

  • _acceptablePrice: price at which you want your position request to be executed

  • _executionFee: can be set to OrderManager.minExecutionFeeMarketOrder

  1. After this transaction, a request to close your position will be created, and a keeper will execute your request.

  2. Once the request is executed, the funds are transferred to _receiver of the position request.

Note that for both createIncreasePosition and createDecreasePosition, send the equivalent amount of native token in msg.value as specified in _executionFee, or else your request won’t be entertained.

PreviousOpen/Increase a market PositionNextMarket Order Execution

Last updated 1 year ago