Price Formatting

Price data from exchanges is often times an augmented version of the price a trader would typically see quoted. For example, the bid price of a future might be 10.125, but the exchange might represent that price as 101.25 (10x greater than the actual price).

Another way in which prices are augmented is if they trade with non-decimal fractional components. For example, a product trading in 4ths, would have a price sequence like the following: 0, 0.1, 0.2, 0.3, 1 (sometimes displayed 0'0, 0'1, 0'2, 0'3, 1'0). Exchanges will often times use decimal fractions in their price feeds, however. The same price sequence might be given as the following from the exchange: 0, 0.25, 0.5, 0.75, 1.

Optionshop will always provide the raw price data from the exchange, to avoid ambiguity. We also, however, will provide you with the means to display prices with their common format.

Two properties are used to convert raw exchange prices into how it should be presented to the user (these are defined per product):

  • Display factor (display_factor)
  • Base factor (base_factor)

The display factor is a multiplier applied to the raw data (corrects for any differences in order of magnitude). The base factor is used to adjust the way the fractional component is presented. The following code snippet (C#) illustrates the exact calculation that must be performed.

Decimal DisplayDecForRawDec(Decimal raw, Decimal baseFactor, Decimal displayFactor) {
  raw *= displayFactor;
  var whole = raw < 0 ? Math.Ceiling(raw) : Math.Floor(raw);
  var fraction = raw - whole;
  var convertedFraction = fraction * baseFactor;
  return (whole + convertedFraction);

Formatting Strike Prices

Strike prices are formatted just like any other price, but there is one important aspect to note: options do not necessarily share the same formatting rules as their underlying future. Because strike prices refer to a price on the future, they should be formatted with the display factor and base factor specified on the underlying, not the option.