The Lab

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from this space and version 1.5.47

...

Prices and Quantities

Overview

Prices and Quantities are represented by PriceNULL and DecimalQtyNULL composites which comprise an int64 mantissa, and an int8 exponent.

Warning

These datatypes differ from the equivalents defined in The Whisperer Classic SBE3 Schema, which defines fixed scalings for each.


Whisperer honours the implied precision of all prices and quantities passed between Client and Venue.This is achieved , and Clients should match the decimal precision provided by the Venue for both, by setting mantissa and exponent values for the relevant SBE datatypes  (DecimalQtyNULL and PriceNULL) such that the original value representation is preserved exactly.

Note that
Note
titleFractional Trailing Zeros

A feature of FIX protocol interfaces (vs binary APIs) is that they involve an integer to string conversion when constructing the message. The way this is performed varies not only across venues, but also across individual fields or message types.

The net result is that trailing zeros for a fractional component may not always be published, so that a price could move between "1.1999" and "1.2", vs the "1.2000") that would be most consistent.

Info
titleNegative values

Scaling Considerations

The maximum mantissa value is  2^63 - 1 = 9,223,372,036,854,775,807

This is because a 64-bit signed integer uses one bit for the sign (positive or negative) and the remaining 63 bits for the value.

When decimal arithmetic is performed, the new mantissa value is first calculated, and then scaled according to the combined exponents. Inappropriately set precisions may cause problems, especially when multiplications are performed (as is the case when ExecutionReport LegCalculatedCcyQty and LegAllocCalculatedCcyQty values are calculated). For example:

  • LegAllocQty = 1,000,000.000000000 = 1,000,000,000,000,000 * 10-9
  • LastPx = 1.047400 = 1,047,400 * 10-6
  • LegCalculatedCcyQty = (1,000,000,000,000,000 * 1,047,400) * 10-9-6 = 1,047,400,000,000,000,000,000 * 10-15 = 1047400.000000000000000
  • 1,047,400,000,000,000,000,000 > 9,223,372,036,854,775,807 and is thus not representable.

Such problems are easily avoided by ensuring that Quantities in particular are always scaled appropriately. 

Negative Values

DecimalQtyNULL and PriceNULL may both be used to represent negative values:

  • Negative quantities are used in pre-trade allocations to denote the opposite allocation direction vs the net direction for the leg as a whole.
  • Negative prices are used to represent negative Forward Points, where appropriate.

Examples

Examples below:

ValueMantissaExponent
1.234512345-4
1.23123-2
1.230012300-4
123.0012300-2
0.00012341234-7
100000010000000
1567234.56156723456-2
-0.01-1-2
-500000-5000000
000
0.00000-4

...

Taker Considerations - Orders

...