Treasury Bond Quotes with 1/32 Fractions

The function quote32 has two purposes: pretty-printing of US treasury bond quotes; and parsing prices quoted in 1/32 fractions. q32 is a short-hand for quote32.

If price is numeric, it is interpreted as a quote in decimal notation and translated into a price quoted in fractions of a point.

library("PMwR")
quote32(100 + 17.5/32)
[1] 100-17+

If price is character, it is interpreted as a quote in fractional notation.

q32("100'105") + 1/32
q32("100-10+") + 1/32
q32("100:10+") + 0.5/32
[1] 100-11+
[1] 100-11+
[1] 100-110