Skip to content
First Access Exchange

The company index

The index I is what a company's IPO expiries say it is worth if it lists, blended by how much each can be trusted. The chain computes it in every block's EndBlock, after each expiry's implied market cap S and the call marks, with integer arithmetic. It is published as the oracle price of {BASE}PERP-USD (written only when it changes) and is what the perpetual is margined, liquidated and funded against.

1. Qualifying expiries

An expiry T counts in a block when:

  • it is trading and before its deadline;
  • its S is fresh (not stale);
  • its binary's price p_T is at least the p floor, 25% (p_floor_ppm);
  • its S had depth (depth_used > 0: over the strikes S used, the sum of the lesser of the call's and the put's book depth), and that depth, capped at 400 contracts (depth_cap), is at least 10% of the deepest qualifying expiry's (min_relative_depth_ppm).

Its target weight is

w_T = p_T (ppm) × min(depth_T, 400 contracts)

While three or more expiries qualify, no expiry may hold more than 60% of the targets' sum (max_expiry_weight_share_ppm): the largest is lowered, never another raised, one at a time, until none is above it. With two the cap doesn't apply.

Why p: S comes from F = K + (C − P)/p, so a small p magnifies the books' noise. Why depth: a deep, two-sided set of books is harder to lean on. Depth is capped and the share is capped, so one deep expiry can't take all the weight.

2. Smoothing

Each trading expiry's weight moves toward its target (0 once it stops qualifying) by 1/600 of the gap a block (weight_smoothing_blocks). An expiry whose S goes stale fades out over about 600 blocks at its last fresh S, and a new one fades in, so no single block's quotes move the blend's weights. With no weight at all (the first blend, or after every weight faded out) the qualifying expiries start at their targets. An expiry that stops trading (halted, or at its deadline) drops at once.

3. Blend and average

If at least one expiry qualifies,

B = ⌊ Σ w_T · S_T / Σ w_T ⌋

with w_T the smoothed weights and S_T a fading expiry's last fresh S. B goes into a 60-block ring (window_blocks); the blend average A is the mean of the ring's valid samples once at least 40 of the last 60 are valid (min_valid_samples).

4. The perpetual's own book

Every block the chain also samples the perpetual's book: long-term orders in chain state only, only quotes their owners can cover, at least 5 contracts (min_depth) from at least 2 subaccounts (min_quoters) a side within 1% of the mid (book_band_ppm, at least depth_band_ticks), reading the first 16 price levels (max_scan) and at most a subaccount's best 4 orders a side. Its mids go into a second 60-block ring (book_window_blocks, valid with book_min_valid_samples of them). The same sample gives the impact bid and ask that funding reads.

5. Mode

modeWhenHow I movesFresh
INDEX_MODE_BLENDEDAn expiry qualifies this block and A is validI = A, at most max(0.5% × I, $0.01B) a block from the previous I (collar_ppm); E = IWhile the live expiries hold at least half the smoothed weight
INDEX_MODE_FALLBACKThe blend isn't valid but the book average isTarget: the book average held within ±5% of E; E moves toward it by 1/3,600 of the gap a block; I follows E by at most 0.1% a blockNever
INDEX_MODE_HELDNeitherUnchangedNever

Fresh and fading. An expiry is live when it qualifies and its capped depth is at least 10% of the deepest expiry still holding weight, fading ones included at their last depth. A blended index is fresh only while the live expiries hold at least 50% of the smoothed weight (min_live_weight_ppm). Otherwise it is blended but stale (fading_expiries): the perpetual gets the 2% band and no funding, and I doesn't follow the fading S. It moves toward the live expiries' own blend by at most 0.1% a block (fallback_collar_ppm), never past it, and holds while none is live. The fading weights still show in weights and blend_raw.

Re-entry ramp. When the index blends again after a stretch in fallback or held (not its first blend after listing), I moves at most 0.1% a block for the next 600 blocks (reentry_ramp_until_height).

Bounds. I is never below $0.01B and never above the perpetual's price cap (E neither). A company that leaves ACTIVE (an IPO halt, settling) has its index frozen with hold reason company_halted.

Hold reasons

While I is stale the record says why (hold_reason):

ReasonModeMeaning
no_qualifying_expiryFALLBACKNo expiry qualifies; I follows the perpetual's book average
warming_upFALLBACKExpiries qualify but the blend has fewer than 40 valid samples
no_book_averageHELDNeither the blend nor the perpetual's book has a valid average
fading_expiriesBLENDEDBlended, but mostly from expiries fading at a last S
company_haltedanyThe company is halted for an IPO, settling or settled: I is frozen

After a genesis import the rings start empty (they aren't exported), so I is held, stale, until they refill.

Reading it

GET /dydxprotocol/binary/company_index/{company_id} returns the record with the perpetual's insurance fund:

curl -s https://api.testnet.firstaccess.exchange/dydxprotocol/binary/company_index/1
{
  "company_index": {
    "company_id": 1,
    "market_id": 0,
    "params": { "window_blocks": 0, "...": "0 reads as the default" },
    "value": "50000000",
    "mode": "INDEX_MODE_BLENDED",
    "stale": false,
    "hold_reason": "",
    "blend_raw": "50000000",
    "weights": [
      { "event_id": 1, "s": "50000000", "p_ppm": "600000", "depth": "240", "weight": "143513115", "share_ppm": 336116 }
    ],
    "fallback_ema": "50000000",
    "book_twap_mid": "50000000",
    "premium_ppm": 0,
    "premium_valid": true,
    "impact_bid": "49980000",
    "impact_ask": "50020000",
    "has_blended": true,
    "reentry_ramp_until_height": "0"
  },
  "insurance_fund_address": "dydx1...",
  "insurance_fund_balance": "10000000000"
}

value is I and fallback_ema is E, both in micro-$B. Events: company_index_updated and company_index_held (both with the band), company_index_near_cap. Every index parameter, with its default and bounds, is in the parameter reference.

Limits

The index is bounded, not unmovable. Taking one side of a thin expiry's quotes moves I only as fast as that expiry's weight fades; an attacker quoting a thin expiry at 10% of the deepest's depth is followed, at the collars. The residual cases, with their numbers, are in rules and risks.