Price Ratio
How one long and one short collapse into a single line, which formula the API actually uses, and how to trade the ratio with a trigger.
When you hold one long asset and one short asset, the Price Ratio is one of the cleanest ways to visualize their relationship. It is defined simply as:
Despite being simple, this ratio does several powerful things at once:
Captures Relative Strength
Instead of tracking two separate price charts, the ratio collapses the performance of both assets into a single line.
- If the ratio trends upward, your long asset is outperforming your short.
- If it trends downward, your short asset is outperforming your long.
This is particularly useful when the two assets are highly correlated (e.g., competitors, L1 vs L2 tokens, two DeFi governance tokens, etc.).
Encodes Correlation and Divergences
When two assets normally move together, deviations in the ratio often indicate:
- A temporary mispricing
- A divergence that may revert
- A possible trading opportunity
For example, if Asset A and Asset B are historically correlated but suddenly one rallies without the other, the ratio will spike, often a sign the spread might snap back.
Creates a Natural Mean-Reversion Indicator
Because many asset pairs have long-term equilibrium relationships (due to fundamentals or shared market conditions), the price ratio often behaves like an oscillator:
- Overstretched highs → long is unusually strong → potential short-the-ratio setup
- Overstretched lows → short is unusually strong → potential long-the-ratio setup
This behavior is the foundation of pair trading, stat arb, and market-neutral strategies.
Reading it from the API
Pear computes a ratio for you on every basket market. GET /markets/baskets returns price and weightRatio on each basket, with priceChange24h and weightRatioChange24h alongside. For the raw inputs, GET /prices returns mid and mark prices per instrument.
Four things to know before you display those numbers:
priceandweightRatiohold the same value. So dopriceChange24handweightRatioChange24h. The endpoint computes one ratio and reports it under both names.- The ratio is a mean over a mean. It is the average price of the long legs divided by the average price of the short legs, not a product of prices.
- It is unweighted. Every leg counts equally. A basket on this endpoint carries no weights at all: a leg is
{ id, symbol, side }. - A one-long/one-short pair is the special case. Each mean is then a single price, so the value equals
Price_LONG / Price_SHORTexactly. Only a multi-leg basket differs.
The endpoint returns materialized multi-leg baskets first, then generated one-long/one-short pairs, so both cases arrive in one response.
Which formula runs where
Three parts of Pear collapse a basket into one number, and they do not agree. Match the formula to the surface you are on.
| Where | Ratio | Net funding | Weight unit |
|---|---|---|---|
GET /markets/baskets | Mean of long prices ÷ mean of short prices. | Mean of long rates − mean of short rates. Positive means you pay. | None. Every leg counts equally. |
weighted_ratio conditions on triggers and ladders | ∏ Priceᵢ ^ (signᵢ × weightᵢ) | Not computed. | Fractions. The legs sum to 1. |
@pear-protocol/market-sdk charts | ∏ Priceᵢ ^ (signᵢ × weightᵢ) | Σ (short rate × weight) − Σ (long rate × weight). Positive means you earn. | Percents. The legs sum to 100. |
signᵢ is +1 for a BUY leg and −1 for a SELL leg.
The two net-funding columns carry opposite signs. Read Net Funding before you colour a number red. The product formula is on Weighted Price Ratio.
Trading it
The ratio is a first-class trigger condition, so you can act on it without polling:
{
"condition": {
"type": "ratio",
"data": {
"priceSource": "mid",
"symbol_a": "0",
"symbol_b": "1",
"track": "TROUGH",
"threshold": 24
}
}
}| Field | Rule |
|---|---|
priceSource | Required. mid or mark. |
symbol_a | The numerator, as an instrument ID. |
symbol_b | The denominator. It must differ from symbol_a, or the call is rejected. |
track | PEAK fires when the ratio reaches or passes the threshold. TROUGH fires only when the ratio falls strictly below it. |
threshold | Required on an open condition, and greater than 0. |
The same condition takes a different shape on each endpoint:
POST /triggers/opentakes all five fields above.POST /triggers/closetakes notrack. A close condition ispriceSource,symbol_a,symbol_b, andthreshold.POST /ladderstakes nothreshold. A ladder takestrack, and its range comes fromconfig.thresholdStartandconfig.thresholdEnd.
Orders and Executions
What a trigger, schedule, ladder, execution, order, and fill each are, and how one becomes the next.
Weighted Price Ratio
The weighted geometric ratio a multi-leg basket trades on, where the weights live in the API, and why the value on GET /markets/baskets is computed differently.