Skip to main content
POST
Python (SDK)

Authorizations

x-api-key
string
header
required

Your Compass API Key. Get your key here.

Body

application/json

Ask what a position would do under a set of hypotheticals.

pool
PoolSelector · object
required

Which pool, by id or by its key.

A pool id is stable and is what the list endpoints return. The long form exists so a caller who knows the pair can address a pool without a lookup — on a chain minting twenty thousand pools a day, a client should not have to search for one it just created.

Example:
range
SymmetricRange · object
required

A range centred on the current price, given as a percentage either side.

The usual way to ask for a position: narrow earns more fees per dollar while the price stays inside it, and stops earning entirely when it leaves.

Example:
deposit
BothSidesDeposit · object
required

Explicit amounts of each token.

Example:
chain
enum<string>
default:robinhood
Available options:
robinhood
Example:

"robinhood"

horizon_days
integer
default:30
Required range: 1 <= x <= 365
Example:

30

scenarios
ScenarioInput · object[]

Leave empty for a default spread of moves.

Maximum array length: 50
Example:
fee_apr_pct_override

Assume this fee rate instead of the pool's measured one.

Required range: x >= 0
vol_override_pct

Assume this annualized volatility instead of the pair's measured one. Needed for a pool too new to have measured any.

Required range: x > 0
monte_carlo
boolean
default:true

Also estimate how likely each outcome is, not just its size.

n_paths
integer
default:2000
Required range: 100 <= x <= 10000
seed
integer
default:0

Fixed so the same request gives the same answer.

Response

Successful Response

range
ResolvedRange · object
required

A range after the API has snapped it to the pool's tick spacing.

Returned because the range you asked for is rarely the range you get: ticks are discrete, and a 30% band becomes whichever usable ticks bracket it.

assumptions
RiskAssumptions · object
required

What the answers rest on.

Returned in full because every number below is only as good as these, and a caller who disagrees with one can override it and ask again.

scenarios
ScenarioResult · object[]
required
pool_id
integer | null
probabilistic
ProbabilisticOutlook · object | null

Absent when the pair's volatility cannot be measured — a pool with a few hours of history has no measurable volatility, and a distribution built on zero would report that nothing can happen.

warnings
string[]