💰
Sudo Gitbook
  • 👋Welcome to Sudo
  • Overview
    • 💡What is Sudo
    • ✨Sudo Features
  • Trade on Sudo
    • 💎Start trading
      • Supported Assets
      • Fees
      • Market Hours
    • 📚Educational Resources
      • What Are Perpetual Futures?
      • Using Leverage Wisely
      • Risk Management Fundamentals
      • What is Sharpe Ratio
      • Real Trading Scenarios
      • Avoiding Rookie Mistakes
  • Liquidity Providers
    • 💰How to provide liquidity
    • 🛰️SLP
    • 🏦SLP Staking
  • S Rewards
    • S Card
      • Getting S Card
      • S Points
      • Using Your S Card
  • Sudo API
    • Sudo API Reference
      • Trader Data
      • Market Info
  • Sudo SDK
    • Introduction to Sudo SDK
    • Core Concepts
    • Installation and Setup
    • Quick Start
    • 📚v0.0.6
      • API Reference
        • SudoAPI
          • Open Position
          • Decrease Position
          • Pledge In Position
          • Redeem From Position
          • Cancel Order
          • getPositionCapInfoList
          • getPositionInfoList
          • getPositionConfig
        • OracleAPI
          • subOraclePrices
      • Changelog
    • Best Practices
    • Troubleshooting
  • Feature Details
    • Algorithm Balanced Funding Rate (ABFR)
    • Risk control
    • FAQ
    • Roadmap
    • On-chain program
Powered by GitBook
On this page
  1. Sudo SDK
  2. v0.0.6
  3. API Reference
  4. SudoAPI

Cancel Order

The cancelOrder function allows users to cancel an existing order.

Function Signature

cancelOrder(
  orderCapId: string,
  collateralToken: string,
  indexToken: string,
  long: boolean,
  type: string
): Promise<TransactionBlock>

Parameters

  • orderCapId: The ID of the order to cancel

  • collateralToken: The token used as collateral (e.g., "USDC")

  • indexToken: The token used as the market index (e.g., "BTC")

  • long: Boolean indicating if this is a long (true) or short (false) position

  • type: The type of order ("OPEN_POSITION" or "DECREASE_POSITION")

Return Value

Returns a Promise that resolves to a TransactionBlock object.

Usage Example

const tx = await sudoAPI.cancelOrder(
  '0x123...', // orderCapId
  'USDC',     // collateralToken
  'BTC',      // indexToken
  true,       // long position
  'OPEN_POSITION' // order type
);

PreviousRedeem From PositionNextgetPositionCapInfoList

Last updated 9 months ago

📚