Javsphere Docs
Open AppJoin Trading Competition
  • Open Javsphere App
  • Welcome to Javsphere
  • Javsphere Stats
  • Fundamentals
    • Javsphere Set Up
      • Base Chain
      • Connect Wallet
      • Add Tokens
      • New to Crypto
    • Buy & add JAV
  • Products
    • LeverageX
      • Assets
        • Cryptocurrencies
        • Stocks
        • Forex
        • Commodities
      • Fees & Spread
      • Trader
        • Open Trade
        • Edit & Close Trade
      • Earn LLP Pool
        • Buy LLP
        • LLP Price & APY
      • xJAV Vault
        • FAQ
      • Limitations
      • Testing
      • Trading Competitions
      • Referral
    • StakeX
    • CryoVault
  • Trading Competitions
    • Current Competition
      • Create Profile
      • Create Community
      • Old competitions
        • Competition Vol. 3
        • Competition Vol. 2
        • Competition Vol. 1
        • Tournament
    • Zealy Campaign
      • Old Airdrops
        • Infinity Pass
        • CFR
        • UPT
        • DTL
        • RNG
        • DPM & Baby Dana
        • GRWV
    • Become a Sponsor
  • JAV Token
    • Utility
    • Whitepaper
      • Javsphere and JAV Token
        • JAV Token
          • Javsphere Fee Structure
          • Tokenomics
        • Added Value for Holders
        • Javsphere Technology
          • StakeX
          • CryoVault
          • LeverageX
      • Disclaimer
    • Governance
      • Onchain Proposals
      • Migration to Base
      • Offchain Proposals
      • Submit a Proposal
    • Base Migration
    • JAV Burn
  • JAVLIS
    • The Ultimate AI Agent
      • Ecosystem
      • USPs
      • Boost for LeverageX
      • Business Model
      • Roadmap
      • Virtuals as Infrastructure
      • More than a hype
      • Hiring
    • Buy JAVLIS
  • Engineering
    • Oracle System
    • Smart Contracts
      • LeverageX
        • JavBorrowingFees
        • JavFeeTiers
        • JavPairsStorage
        • JavPriceAggregator
        • JavPriceImpact
        • JavReferrals
        • JavTradingInteractions
        • JavTradingProcessing
        • JavTradingStorage
        • JavBorrowingProvider
        • LLPToken
        • Feeds
      • JavPriceAggregator
      • JavFreezer
      • JavStakeX
    • Github
    • Bug Bounty Program
  • Community & More
    • Content Library
      • Logos
      • UI Mockups
    • Social Content
    • Socials
      • Telegram Guidelines
  • LEGAL
    • Privacy Policy
    • Terms of Use
      • Excluded Jurisdictions
    • Migration Terms
    • Cookie Policy
    • Trading Competition Terms
    • Bug Bounty Terms
Powered by GitBook
On this page
  • General Description
  • Core Functionalities
  • openTrade
  • updateTermsAndConditionsAddress
  • updateMaxClosingSlippageP
  • closeTradeMarket
  • updateOpenOrder
  • cancelOpenOrder
  • updateTp
  • updateSl
  • updateLeverage
  • increasePositionSize
  • decreasePositionSize
  • triggerOrder

Was this helpful?

  1. Engineering
  2. Smart Contracts
  3. LeverageX

JavTradingInteractions

General Description

The JavTradingInteractions contract used for manage and interact with various types of trading orders, including limit, stop, and market orders, for a trading platform. It enables users to open, close, update, and manage the terms of their trades, including slippage, position size, leverage, and take-profit/stop-loss (TP/SL) parameters. Additionally, it supports the initiation and updating of trigger orders, and allows for the cancellation of open orders. This system provides a wide range of functionalities to give users full control over their trading positions and strategies.

Core Functionalities

openTrade

  • Opens a new trade, limit order, or stop order with specified parameters.

  • Parameters:

    • _trade: The trade data (structure containing details about the trade).

    • _maxSlippageP: Maximum allowed slippage in percentage (1e3 precision).

    • _referrer: Address of the referrer (can only be set once per trader).

    • _priceUpdate: Array containing price update data.

  • Access Control: Public.

updateTermsAndConditionsAddress

  • Updates the address for the terms and conditions.

  • Parameters:

    • _termsAndConditionsAddress: New address for the terms and conditions.

  • Access Control: Public.

updateMaxClosingSlippageP

  • Updates the maximum slippage allowed for closing a trade.

  • Parameters:

    • _index: Index of the trade to be updated.

    • _maxSlippageP: New maximum closing slippage percentage (1e3 precision).

  • Access Control: Public.

closeTradeMarket

  • Closes an open trade using a market order.

  • Parameters:

    • _index: Index of the trade to be closed.

    • _priceUpdate: Array containing price update data.

  • Access Control: Public.

updateOpenOrder

  • Updates an existing limit or stop order with new parameters.

  • Parameters:

    • _index: Index of the existing order.

    • _triggerPrice: New trigger price for the order (1e10 precision).

    • _tp: New take-profit price (1e10 precision).

    • _sl: New stop-loss price (1e10 precision).

    • _maxSlippageP: New maximum slippage percentage (1e3 precision).

  • Access Control: Public.

cancelOpenOrder

  • Cancels an open limit or stop order.

  • Parameters:

    • _index: Index of the order to be canceled.

  • Access Control: Public.

updateTp

  • Updates the take-profit (TP) value of an open trade.

  • Parameters:

    • _index: Index of the open trade.

    • _newTp: New TP value (1e10 precision).

  • Access Control: Public.

updateSl

  • Updates the stop-loss (SL) value of an open trade.

  • Parameters:

    • _index: Index of the open trade.

    • _newSl: New SL value (1e10 precision).

  • Access Control: Public.

updateLeverage

  • Updates the leverage for a trade.

  • Parameters:

    • _index: Index of the trade.

    • _newLeverage: New leverage value (1e3 precision).

    • _priceUpdate: Array containing price update data.

  • Access Control: Public.

increasePositionSize

  • Increases the position size of an open trade by adding collateral and adjusting leverage.

  • Parameters:

    • _index: Index of the trade.

    • _collateralDelta: Amount of collateral to add (collateral precision).

    • _leverageDelta: Amount of leverage to increase by (1e3 precision).

    • _expectedPrice: Expected price for execution (1e10 precision).

    • _maxSlippageP: Maximum slippage percentage allowed (1e3 precision).

    • _priceUpdate: Array containing price update data.

  • Access Control: Public.

decreasePositionSize

  • Decreases the position size of an open trade by removing collateral and adjusting leverage.

  • Parameters:

    • _index: Index of the trade.

    • _collateralDelta: Amount of collateral to remove (collateral precision).

    • _leverageDelta: Amount of leverage to decrease by (1e3 precision).

    • _priceUpdate: Array containing price update data.

  • Access Control: Public.

triggerOrder

  • Initiates a trigger order based on a packed data structure (order type, trader, index) for TP, SL, liquidation, limit, or stop orders.

  • Parameters:

    • _packed: Packed data for the trigger order (encodes order type, trader address, index).

    • _priceUpdate: Array containing price update data.

  • Access Control: Public.

Last updated 5 months ago

Was this helpful?