Skip to main content
Version: pre-release (v0.79)

Estimate position

GET 

/api/v2/estimate/position

Estimate the margin that would be required for maintaining the specified position, collateral increase needed to open the specified position and the liquidation price estimate. Margin estimates are scaled to asset decimal places. Liquidation price estimates are scaled to asset decimal places by default, unless an argument to scale to market decimal places is specified in the request.

Request

Query Parameters

    marketId stringrequired

    Market ID to estimate position for.

    openVolume int64required

    Open volume. This field is a signed integer scaled to the market's position decimal places. A negative number denotes a short position.

    averageEntryPrice stringrequired

    Average entry price corresponding to the open volume. The price is an unsigned integer. For example 123456 is a correctly formatted price of 1.23456 assuming market configured to 5 decimal places.

    marginAccountBalance stringrequired

    Margin account balance. Needs to scaled by asset decimal places.

    generalAccountBalance stringrequired

    General account balance. Needs to scaled by asset decimal places.

    orderMarginAccountBalance stringrequired

    Order margin account balance. Needs to be scaled by asset decimal places.

    marginMode string

    Possible values: [MARGIN_MODE_UNSPECIFIED, MARGIN_MODE_CROSS_MARGIN, MARGIN_MODE_ISOLATED_MARGIN]

    Default value: MARGIN_MODE_UNSPECIFIED

    Margin mode for the party, cross margin or isolated margin.

    • MARGIN_MODE_UNSPECIFIED: Never valid.
    • MARGIN_MODE_CROSS_MARGIN: Cross margin mode - margin is dynamically acquired and released as a position is marked to market
    • MARGIN_MODE_ISOLATED_MARGIN: Isolated margin mode - margin for any newly opened position volume is transferred to the margin account when the trade is executed
    marginFactor string

    Margin factor to be used along with isolated margin mode.

    includeRequiredPositionMarginInAvailableCollateral boolean

    Whether the estimated position margin increase should be included in available collateral for liquidation price calculation in isolated margin mode.

    scaleLiquidationPriceToMarketDecimals boolean

    Whether the liquidation price estimates should be scaled to market decimal places or by asset decimal places. If not set, asset decimal places are used.

Responses

A successful response.

Schema
    collateralIncreaseEstimate object

    Estimated margin account balance increase.

    bestCase Estimate assuming no slippage (string)
    worstCase Estimate assuming slippage cap is applied (string)
    liquidation object

    Liquidation price range estimate for the specified position. Only populated if available collateral was specified in the request.

    bestCase object

    Liquidation price estimate assuming no slippage.

    includingBuyOrders string

    Liquidation price assuming buy orders start getting filled.

    includingSellOrders string

    Liquidation price assuming sell orders start getting filled.

    openVolumeOnly string

    Liquidation price for current open volume ignoring any active orders.

    worstCase object

    Liquidation price estimate assuming slippage cap is applied.

    includingBuyOrders string

    Liquidation price assuming buy orders start getting filled.

    includingSellOrders string

    Liquidation price assuming sell orders start getting filled.

    openVolumeOnly string

    Liquidation price for current open volume ignoring any active orders.

    margin object

    Margin level range estimate for the specified position.

    bestCase object

    Margin level estimate assuming no slippage.

    asset string

    Asset ID for which the margin levels apply.

    collateralReleaseLevel string

    Collateral release level value. This field is an unsigned integer scaled to the asset's decimal places.

    initialMargin string

    Initial margin value. This field is an unsigned integer scaled to the asset's decimal places.

    maintenanceMargin string

    Maintenance margin value. This field is an unsigned integer scaled to the asset's decimal places.

    marginFactor string

    Margin factor, relevant only for isolated margin, 0 otherwise.

    marginMode - MARGIN_MODE_UNSPECIFIED: Never valid. - MARGIN_MODE_CROSS_MARGIN: Cross margin mode - margin is dynamically acquired and released as a position is marked to market - MARGIN_MODE_ISOLATED_MARGIN: Isolated margin mode - margin for any newly opened position volume is transferred to the margin account when the trade is executed (string)

    Possible values: [MARGIN_MODE_UNSPECIFIED, MARGIN_MODE_CROSS_MARGIN, MARGIN_MODE_ISOLATED_MARGIN]

    Default value: MARGIN_MODE_UNSPECIFIED

    Margin mode for the party, cross margin or isolated margin.

    marketId string

    Market ID for which the margin levels apply.

    orderMargin string

    Margin required to cover orders in isolated margin mode.

    partyId string

    Party ID for whom the margin levels apply.

    searchLevel string

    Margin search level value. This field is an unsigned integer scaled to the asset's decimal places.

    timestamp int64

    Timestamp in Unix nanoseconds for when the ledger entry was created.

    worstCase object

    Margin level estimate assuming slippage cap is applied.

    asset string

    Asset ID for which the margin levels apply.

    collateralReleaseLevel string

    Collateral release level value. This field is an unsigned integer scaled to the asset's decimal places.

    initialMargin string

    Initial margin value. This field is an unsigned integer scaled to the asset's decimal places.

    maintenanceMargin string

    Maintenance margin value. This field is an unsigned integer scaled to the asset's decimal places.

    marginFactor string

    Margin factor, relevant only for isolated margin, 0 otherwise.

    marginMode - MARGIN_MODE_UNSPECIFIED: Never valid. - MARGIN_MODE_CROSS_MARGIN: Cross margin mode - margin is dynamically acquired and released as a position is marked to market - MARGIN_MODE_ISOLATED_MARGIN: Isolated margin mode - margin for any newly opened position volume is transferred to the margin account when the trade is executed (string)

    Possible values: [MARGIN_MODE_UNSPECIFIED, MARGIN_MODE_CROSS_MARGIN, MARGIN_MODE_ISOLATED_MARGIN]

    Default value: MARGIN_MODE_UNSPECIFIED

    Margin mode for the party, cross margin or isolated margin.

    marketId string

    Market ID for which the margin levels apply.

    orderMargin string

    Margin required to cover orders in isolated margin mode.

    partyId string

    Party ID for whom the margin levels apply.

    searchLevel string

    Margin search level value. This field is an unsigned integer scaled to the asset's decimal places.

    timestamp int64

    Timestamp in Unix nanoseconds for when the ledger entry was created.

Loading...