TRENDDocs
Concepts

Amounts and units

Every amount is a decimal string of base units. Never a number.

Every amount on the wire is a decimal string of base units. Never a float, never a UI quantity.

Supplies, reserves and trade amounts routinely exceed 2^53. A JSON number is an IEEE-754 double, so a u64 sent as a number is silently rounded, on exactly the quantities that have to stay exact. The API validates the string form and refuses a number, a float, a leading zero, or anything above the u64 maximum.

Scale by the right decimals: primaryDecimals for a launch token, the component's own decimals for a component, 9 for SOL.

1 SOL              "1000000000"        lamports
40 WIF (6 dp)      "40000000"

Units you will see

FieldUnit
amountIn, expectedOut, minOut, primaryAmount, quantitybase units, string
solLamports, solIn, an exactInSol amountInlamports, string
priceSol, dnaUnitSolSOL, a number. null when a component has no measured price
priceE12, costBasisE12an internal quote unit scaled by 1e12. Comparable to each other, not a currency
any *Bpsbasis points. 100 is 1%

For a price in SOL use priceSol. For a price in dollars, multiply by solUsd from GET /v1/stats: one rate governs every figure, and solUsdSource names where it came from.

Null is not zero

A value the API could not measure is null, and the reference says so on each field. A price change of null means "not enough history", never "flat". A cost basis of null means "acquired before it was indexed", never a free position. Render null as a dash.

Reading a sell

On a curve quote, expectedOut for a sell is in DNA units, the protocol's internal quote unit, not in SOL. Read quotes only through the shapes in the quote guide.

On this page