Caplin Trader 4.7.1

Class: module:caplin/element/formatter/BondNotationFormatter

module:caplin/element/formatter/BondNotationFormatter

Constructor

new module:caplin/element/formatter/BondNotationFormatter()

Formats a bond price into one of two standard market convention notations.

BondNotationFormatter is typically used in the XML Renderer Framework, but can be invoked programmatically as in the following example, which evaluates to "99-10+":

caplin.element.formatter.BondNotationFormatter.format(99.328, {})
Implements:

Methods

format(vValue, mAttributes) → {String}

Formats a bond price into one of two standard market convention notations.

Two market conventions are supported, which both express the fractional part of the price as a whole number of 32nds, followed by a remainder which is expressed in as a number of eighths in two different ways:

Fractions notation expresses the remainder as a unicode fraction, but using + to represent a half (e.g. 102-05+)
Decimal notation expresses the remainder as number of eighths, from 00 to 07 (e.g. 102-05 04)

Parameters:
Name Type Description
vValue String | Number the price.
mAttributes Map the map of attributes.
Properties
Name Type Attributes Default Description
fraction boolean <optional>
false if true, then fractions notation will be used.
rounding String <optional>
rounding method for least significant 8th: "up", "down" (defaults to nearest 8th).
Returns:
the price expressed in bond notation.
Type
String