๐Ÿ‹
Moby
  • Letโ€™s Get Started
    • ๐Ÿ‹ About Moby
    • โšก Our Vision
    • ๐Ÿค“ Your Guidebook
      • Get Setup
        • Connect Wallet
        • Trade Options
        • 0DTE Options
        • Provide Liquidity
      • Fees & Instruments
        • Fee Generation
        • Fee Distribution
        • Instruments
      • Testnet
  • How itโ€™s Built
    • ๐Ÿš€ Synchronized Liquidity Engine (SLE)
    • ๐Ÿงฎ Options Pricing Model
      • Mark Price
        • Futures Index
        • Implied Volatility
      • Risk Premium
        • Deriving Greeks
        • Risk Premium Calculation
        • Risk Managing Mechanism
    • ๐Ÿค– Architecture
      • Liquidity Provision Mechanism
      • Options Listing Standard
      • How to Open / Close / Settle Position
      • Synchronized Liquidity Engine (SLE)
      • Options Position Tokens
      • Tools to Maximize Capital Efficiency
    • โš™๏ธ Key Features
      • High Leverage & Limited Risk with No Liquidation
      • Narrow Spread with Dynamic Risk Premium
      • Guaranteed Settlement
      • Capital Efficiency Improvements with Combo Options
      • Even Higher Capital Efficiency with Clearing House
      • Abundant Liquidity for All Options
      • Composable Options for Structured Products
      • High Profitability for LPs
      • Real-Time Automatically Hedged OLP
      • Upcoming Features
    • โ›“ DeFi Options Vault
      • ๐Ÿป Berachain DeFi Options Vault
        • ๐Ÿ”’ Architecture
        • ๐Ÿ“ˆ Options Strategy
  • How itโ€™s Driven
    • ๐Ÿ›ก๏ธ Building the Safest DeFi Protocol
      • Safety Features
      • Smart Contract Audit & Real-Time Security Monitoring
    • ๐Ÿ› Backed by Decentralized Governance
      • Governance
    • ๐ŸŒ Led by the Best Partners & Community
      • Arbitrum X Moby
      • Engagement Programs
  • Need More Info?
    • ๐Ÿ“š Resource Library
      • Developer Resources & Educational Contents
      • Terms & Conditions
      • Glossary
      • FAQ
  • Developers
    • Moby Traders API
      • REST API
        • General
        • Account
        • Market
    • Trade Scripts
      • Prerequisites
      • Open Positions
      • Close Positions
    • Interfaces & ABI
      • PositionManager.sol
      • SettleManager.sol
      • RewardRouterV2.sol
      • OptionsMarket.sol
    • Appendix 1: Parameters for Open/Close Options
    • Appendix 2: the Diff between optionId and optionTokenId
    • Appendix 3: Sample Moby Contract Module for Developers
Powered by GitBook
On this page
  1. Developers
  2. Trade Scripts

Close Positions

Every cases are similar to the open positions, but you need to convert the -o flag from -c to close the position. In close script, The value of amount(-a) flag is the amount of contract. The decimal of the amount is same as underlying asset's decimal.

Once more, it doesn't need to be given payment(-p) flag when closing position.

Example

If you want to close the position of BTC-3JUL24-61250-P, buy put option with 0.01 contracts:

ts-node scripts/trade.ts -c -i BTC-3JUL24-61250-P --buy --put --naked -a 0.01

If you want to close all position of corresponding instrument, you can use all option to -a at following command:

ts-node scripts/trade.ts -c -i BTC-3JUL24-61250-P --buy --put --combo -a all --pair 60500

PreviousOpen PositionsNextInterfaces & ABI

Last updated 9 months ago