💰
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

getPositionConfig

Retrieves and parses the position configuration for a given index token and position type (long or short).

Function Signature

getPositionConfig(
  indexToken: string
  long: boolean
): Promise<IPositionConfig>

Parameters

  • indexToken (string): The token for which to retrieve the position configuration.

  • long (boolean): Indicates whether to retrieve the configuration for a long (true) or short (false) position.

Return Value

Returns a Promise that resolves to an IPositionConfig object. The object contains parsed position configuration, including:

interface IPositionConfig {
    decreaseFeeBps: number;
    liquidationBonus: number;
    liquidationThreshold: number;
    maxLeverage: number;
    minHoldingDuration: number;
    openFeeBps: number;
    maxReservedMultiplier: number;
    minCollateralValue: number;
}

Description

This method fetches the position configuration data from the blockchain for a specified index token and position type. It performs the following steps:

Usage Example

const sudoAPI = new SudoAPI(provider);

try {
  const positionConfig = await sudoAPI.getPositionConfig('BTC', true);
  console.log("Fetched position config:", positionConfig);
} catch (error) {
  console.error("Error fetching position config:", error);
}
PreviousgetPositionInfoListNextOracleAPI

Last updated 8 months ago

📚