Skip to content

Shares ​

The Quarzo API represents each complete share count with two fields:

json
{
  "quantity": 1234567,
  "scale": 5
}

This value represents 12.34567 shares.

Fields ​

FieldTypeDescription
quantityintegerThe share quantity without a decimal point.
scaleintegerThe number of fractional digits in quantity.

Use this rule to read a Shares value:

text
decimal value = quantity / 10^scale

For quantity = 1234567 and scale = 5, the result is 12.34567.

The scale field is the instrument share decimalization. Do not look up the scale from another record.

Safe limits ​

The API accepts only safe integer values for quantity and scale.

The safe quantity range is:

text
-Number.MAX_SAFE_INTEGER <= quantity <= Number.MAX_SAFE_INTEGER

Number.MAX_SAFE_INTEGER is 9007199254740991.

The safe scale range is:

text
0 <= scale <= Number.MAX_SAFE_INTEGER

For example, this is the largest safe quantity at scale 5:

json
{
  "quantity": 9007199254740991,
  "scale": 5
}

This value represents 90071992547.40991 shares.

The API rejects an unsafe quantity or scale.

Negative quantities are valid for share deltas. A position balance can apply its own non-negative balance rule.

Common mistakes ​

Do not store shares as a decimal string when the value crosses an API or event boundary.

Do not store shares as Money with a fabricated currency.

Do not omit scale:

json
{
  "quantity": 1234567
}

Use a complete value instead:

json
{
  "quantity": 1234567,
  "scale": 5
}

Website