Mark + Index Introduction

tl;dr: v3 continues to work. No immediate breaking changes. However, starting Feb 16, 2025, the new v4 pricing API separates mark prices (TP/SL, limits, PnL) from index prices (liquidations). Action required only if you perform liquidation calculations on volatile pairs (non-core crypto with futures feeds). Without updating, those calculations will use the wrong price.

Mark & Index Price Separation (v4 API)

Overview

Starting February 16, 2025 (tentative), gTrade introduces a new v4 format that separates mark prices from index prices to support more advanced market structures and align with industry norm.

What Changed

Price Type
Description
Used For

Mark Price

Price used for trade execution

TP/SL, Limit Orders, Stop Orders, PnL calculations

Index Price

Spot price, unaffected by derivatives skew

Liquidations only

How Prices Differ by Market Type

Type
Mark Price
Index Price
Examples

Core

market (spot + skew)

spot

BTC, ETH (funding fees)

Volatile

futures

spot

Non-core crypto

Regular

spot

spot

Forex, stocks, commodities, non-core crypto w/o futures

  • Core: Crypto with funding fees. Mark includes skew adjustment (for now clients have to calculate).

  • Volatile: Crypto with futures feeds available. Mark sourced from futures.

  • Regular: All other markets. Spot price used for both mark and index.

For Core and Regular pairs, mark and index prices will be identical from gTrade endpoints. For Volatile pairs, they may differ significantly. Core will still need mark/market price calculated on the client.


API Changes

Connection

To use the v4 API, connect to the v4 endpoint:

Message Format

v3 (Legacy)

v4 (New)

Field
Type
Description

m

number[]

Mark prices as flat array [pairIndex, price, ...]

i

number[]

Index prices as flat array [pairIndex, price, ...]

t

number

Timestamp (milliseconds)

/charts Endpoint

The /charts snapshot endpoint now includes an additional indexPrices field alongside the existing OHLC data.

Before:

After:

opens, highs, lows, closes reflect mark prices (as before). indexPrices provides the latest index price per pair index.


SDK Changes

@gainsnetwork/sdk v1.8.3 introduces:

  • corePairIndices β€” exported from constants, provides the list of core crypto pair indices (BTC, ETH, etc.)

  • getMarketType(pairIndex) β€” returns the market classification (CORE, VOLATILE, or REGULAR) for a given pair index

These can be used to determine which price type applies to each pair:


Migration Guide

Example (TypeScript):


Timeline

Date
Event

Feb 16, 2025

v4 becomes recommended; index prices enabled for volatile pairs

TBD

v3 deprecation (will be announced separately)


Impact of Not Updating

If you continue using v3 or don't separate mark/index prices:

  • Liquidation calculations will be incorrect for volatile pairs, as they will use mark price instead of index price

  • TP/SL/Limit orders are unaffected (these use mark price, which v3 provides)

  • Price display is unaffected for most use cases

Recommendation: Evaluate your integration's use of price data. If you perform liquidation-related calculations, prioritize this update. The impact depends on your exposure to volatile pairs (non core crypto pairs with separate futures markets).


Questions?

Contact the Gains Network team on Discord if you have questions about the migration.

Last updated

Was this helpful?