My App

Preview portfolio details with simulated order

Retrieve a preview of portfolio details including the impact of a simulated order, showing how balances, positions, and margins would change.

Requires authentication.

POST
/portfolios/detail-preview
OBSIDIAN-KEY<token>

In: header

OBSIDIAN-SECRET<token>

In: header

type?string

Order type (LIMIT, MARKET, etc.). Specifies the execution behavior of the order.

Default"LIMIT"
Value in"LIMIT" | "MARKET" | "STOP" | "TWAP"
side?string

Side of the book to place order on. Either BUY or SELL. Determines if the order is buying or selling the base asset.

Default"BUY"
Value in"BUY" | "SELL"
product_index?integer

Product index to place order on (BTC-PERP=1, ETH-PERP=2, SOL-PERP=3). Identifies the trading pair/instrument.

Formatint64
stp?string

Self-trade prevention flag. Either CANCEL_TAKER or CANCEL_MAKER. Prevents the order from matching against own orders.

Default"CANCEL_TAKER"
Value in"CANCEL_TAKER" | "CANCEL_MAKER" | "CANCEL_BOTH"
price?number

Order price in quote currency (e.g., USDC). For limit orders, this is the maximum buy price or minimum sell price.

Formatdouble
size?number

Order size in base currency (e.g., BTC). The quantity of the asset to buy or sell.

Formatdouble
time_in_force?string

Time in force policy (GTC, IOC, FOK, GTT). Specifies the execution behavior and lifetime of the order. Constraints by order type: LIMIT orders support all values; MARKET orders require FOK or IOC; STOP and TWAP orders require GTC, FOK, or IOC.

Default"GTC"
Value in"GTC" | "IOC" | "FOK" | "GTT"
nonce?string

Unique nonce value (typically Unix timestamp in nanoseconds). Must be within ±5 minutes of current time to prevent replay attacks.

Formatuint64
post_only?boolean

Post-only flag. If true, order will only execute as maker (adds liquidity). Order is rejected if it would take liquidity.

signature?string

Cryptographic signature of the order payload. Used to authenticate and verify the order was signed by the sender.

reduce_only?boolean

Reduce-only flag. If true, order can only reduce existing position size, not increase it or open a new position.

order_stop_type?string

Stop order type (STOP_LOSS, TAKE_PROFIT, etc.). Defines the trigger condition for conditional orders.

Default"STOP_NONE"
Value in"STOP_NONE" | "STOP_LOSS" | "TAKE_PROFIT"
stop_price?string

Stop trigger price. The price level at which the stop order becomes active and enters the order book.

client_order_id?string

Client-provided order identifier. Must be unique among open orders. Supports alphanumeric characters and symbols (:, -, _). Case-insensitive. Optional.

stop_price_option?string

Stop price reference. Either LAST_PRICE (last traded price) or MARK_PRICE (mark price). Determines which price feed triggers the stop order.

Default"NONE"
Value in"NONE" | "LAST_PRICE" | "MARK_PRICE"
expired_at?string

Order expiration timestamp in nanoseconds. Mandatory when time_in_force is set to GTT (Good-Till-Time). Order is canceled if not filled by this time.

Formatint64
scheduled_at?string

Scheduled execution timestamp in nanoseconds. Delays order processing until the specified time. Default 0 means immediate execution.

Formatint64
wait?boolean

Synchronous processing flag. If true, the response is sent only after the matching engine fully processes the order (status: "open", "done", or "accepted"). If false, returns immediately with "pending" status. Note: HTTP 200 OK is returned even if the order is rejected; check the order status field for actual result.

Response Body

application/json

application/json

curl -X POST "https://api.dev.obsidian.exchange/portfolios/detail-preview" \  -H "Content-Type: application/json" \  -d '{}'
{
  "user_address": "string",
  "summary": {
    "collateral_mode": "USDC_COLLATERAL",
    "collateral_margin_balance": "string",
    "cross_margin_balance": "string",
    "cross_margin_usage": "string",
    "cross_account_leverage": "string",
    "in_cross_liquidation": true,
    "free_collateral": "string",
    "total_account_value": "string",
    "total_cross_notional": "string",
    "unsettled_usdc": "string",
    "realized_pnl": "string",
    "total_cross_initial_margin": "string",
    "total_cross_maintenance_margin": "string",
    "collateral_assets": [
      {
        "asset": "string",
        "address": "string",
        "balance": "string",
        "withdrawable_amount": "string",
        "market_value_usd": "string",
        "collateral_value_usd": "string",
        "collateral_value_composition": "string"
      }
    ],
    "has_pending_withdrawal": true,
    "total_unrealized_pnl": "string",
    "total_collateral_value": "string",
    "margin_health": "string",
    "total_isolated_order_reserve": "string"
  },
  "positions": [
    {
      "product_index": 0,
      "product_id": "string",
      "net_size": "string",
      "avg_entry_price": "string",
      "quote_balance": "string",
      "mark_price": "string",
      "index_price": "string",
      "margin_mode": "MARGIN_MODE_CROSS",
      "leverage": "string",
      "margin_balance": "string",
      "initial_margin_requirement": "string",
      "maintenance_margin_requirement": "string",
      "liquidation_price": "string",
      "unrealized_pnl": "string",
      "unsettled_funding": "string",
      "funding_index": "string",
      "isolated_usdc_balance": "string",
      "free_isolated_usdc_balance": "string",
      "in_isolated_liquidation": true
    }
  ],
  "stats": {
    "order_stats": {
      "total_orders": "string",
      "total_done_orders": "string",
      "total_open_orders": "string",
      "total_pending_orders": "string"
    },
    "products": [
      {
        "product_id": "string",
        "order_stats": {
          "total_orders": "string",
          "total_done_orders": "string",
          "total_open_orders": "string",
          "total_pending_orders": "string"
        }
      }
    ],
    "trading_stats": {
      "total_trading_volume": "string"
    },
    "assets": [
      {
        "asset": "string",
        "address": "string",
        "total_deposit": "string",
        "total_withdraw": "string"
      }
    ]
  },
  "maker_fee": "string",
  "taker_fee": "string",
  "private_name": "string",
  "is_market_maker": true,
  "disable_post_order": true,
  "disable_withdrawal": true
}
{
  "code": 0,
  "message": "string",
  "details": [
    {
      "@type": "string",
      "property1": null,
      "property2": null
    }
  ]
}