BigShort Docs

TWAP and Executable Capacity

Mature TWAP confirmation, immediate spot constraints, and lending inventory jointly determine maximum executable short-selling capacity.

Three Distinct Constraints

Constraint Question answered Data source
Risk Curve How much theoretical net selling is currently permitted? Fixed-parameter model
TWAP + spot Which price increases are confirmed, and does the current price contract capacity? V2 cumulative prices and live reserves
Borrowable Token / exact output Can inventory actually be sold for this much BNB? Engine ledger, Token balance, live Pair

The amount that can ultimately be opened depends on all three, not on a single market-cap table.

1. Cumulative Prices and TWAP

V2 records cumulative prices in WBNB18 / token18 . Let A(t) be the cumulative value scaled by 2¹¹² , with Δt:

P‾raw,X112=⌊A(t1)−A(t0)Δt⌋\overline P_{\mathrm{raw},X112} =\left\lfloor\frac{A(t_1)-A(t_0)}{\Delta t}\right\rfloor

Converting to native18 market cap:

MTWAP=⌊P‾raw,X112 S2112⌋M_{\mathrm{TWAP}}= \left\lfloor \frac{\overline P_{\mathrm{raw},X112}\,S}{2^{112}} \right\rfloor

BNB and WBNB both use 18 decimals. Market cap is calculated directly from the accumulated-price calculation and fixed curve supply, with no additional precision conversion. The current group’s curve supply is 10,000,000,000 Token.

2. A Minimum Window Is Not a Fixed Rolling Window

The current BSC economic group uses 300 seconds:

  • Δt < 300 seconds: Observation updates neither writes observation state nor raises the confirmed ceiling.
  • Δt ≥ 300 seconds: the average covers the entire period.

3. The Confirmed Ceiling Can Only Rise

At initialization, the capacity ceiling starts from fixed M₀ and C(M₀) , rather than zero capacity. No elapsed-time TWAP sample exists yet.

For a mature sample, the candidate market cap is:

Mcandidate=max⁡(M0,min⁡(MTWAP,Mt))M_{\mathrm{candidate}} =\max\bigl(M_0,\min(M_{\mathrm{TWAP}},M_t)\bigr)

The historical ceiling rises only when the candidate exceeds it. Let H be the confirmed market-cap ceiling and CHC_H the confirmed capacity ceiling:

H′=max⁡(H,Mcandidate),CH′=max⁡(CH,C(H′))H'=\max(H,M_{\mathrm{candidate}}), \qquad C_H'=\max(C_H,C(H'))

Ordinary price declines do not reduce these two historically confirmed ceilings. Actual available capacity is still immediately limited by spot.

4. Immediate Spot Constraints

Ms=min⁡(max⁡(Mspot,M0),Mt)M_s=\min\bigl(\max(M_{\mathrm{spot}},M_0),M_t\bigr)
Meffective=min⁡(H,Ms)M_{\mathrm{effective}}=\min(H,M_s)
Ceffective=min⁡(CH,C(Meffective))C_{\mathrm{effective}}=\min\bigl(C_H,C(M_{\mathrm{effective}})\bigr)

If total net sold across all existing positions is O = totalOpenShortNative:

Cremaining=max⁡(Ceffective−O,0)C_{\mathrm{remaining}}=\max(C_{\mathrm{effective}}-O,0)
  • Spot falls: capacity for new positions contracts immediately, without waiting for a new TWAP.
  • Spot recovers: capacity can recover immediately within the confirmed ceiling.
  • Spot reaches a new high: the portion above the confirmed ceiling still requires mature TWAP confirmation.
  • Spot falls below M₀: the model still has an M₀ floor; this does not mean that all market risk disappears.

Scenario Example

Current spot market cap Effective capacity (approx. BNB) Remaining capacity (approximately BNB) Meaning
25,000 39.627904792016544177 37.627904792016544177 Price increase above the previous limit has not yet released capacity
1,000 6.003373265906041571 4.003373265906041571 Immediate contraction when spot falls
10,000 39.627904792016544177 37.627904792016544177 Recovering within the previous limit

The table recomputes the current group’s integer implementation; it is not a live quote for an actual market. Pair inventory, global/local pauses, minimum notional, and other checks may further constrain execution.

5. Token Inventory Constraints

Lavailable=L0−Lbad−LborrowedL_{\mathrm{available}}=L_0-L_{\mathrm{bad}}-L_{\mathrm{borrowed}}

The Engine's actual Token balance must also be at least its ledger balance available for lending. Additional Token transfers do not automatically increase L₀; if the balance is insufficient, the Quoter returns an error instead of continuing to show apparently available capacity.

Let T be the Pair's Token18 reserve,R is the WBNB18 reserve, and L the Token18 available for lending. To ensure that V2's exact-output input calculation does not exceed L the maximum net WBNB18 sale proceeds permitted by inventory are:

EL=⌈L⋅9,975⋅RT⋅10,000+L⋅9,975⌉−1E_L=\left\lceil \frac{L\cdot9{,}975\cdot R}{T\cdot10{,}000+L\cdot9{,}975} \right\rceil-1

L = 0 returns zero separately in that case.

BNB and WBNB have equal precision, so previewed risk capacity and inventory capacity are compared directly:

Qsold,max=min⁡(Cremaining,preview,EL)Q_{\mathrm{sold,max}}=\min\left(C_{\mathrm{remaining,preview}},E_L\right)

Quoter also reads the current Factory minimum gross notional and the effective Engine pause status. If paused, or if the calculated maximum gross notional is below the current minimum, the executable net sale amount and notional both return zero; raw risk capacity and inventory capacity remain available for diagnostics.

6. A Quote Is Not an Execution Guarantee

  • Preview and confirmed state are distinct fields and should be displayed separately.
  • Swaps, other users' position openings, tax-Token conversions, or the passage of time may occur after a quote.
  • Executable notional is not a complete transaction quote. Current minimum gross notional, pause state, added collateral, and Token borrowing limits still apply. The opening/increase block lock is separate: after exposure increases in N, partial/full closes and single/batch liquidation begin no earlier than N+1. It does not require waiting for this page’s 300-second window.
BigShort Protocol · BSCIssue · Trade · Short