@@ -5382,11 +5382,13 @@ const SymbolParser = require('./../utilities/parsers/SymbolParser'),
53825382
53835383const AssetClass = require('./../utilities/data/AssetClass');
53845384
5385+ const cmdtyViewPriceFormatter = require('./../utilities/format/specialized/cmdtyView');
5386+
53855387module.exports = (() => {
53865388 'use strict';
53875389
53885390 let profiles = {};
5389- let formatter = buildPriceFormatter('-', true, ',') ;
5391+ let formatter = cmdtyViewPriceFormatter ;
53905392 /**
53915393 * Describes an instrument (associated with a unique symbol).
53925394 *
@@ -5572,7 +5574,7 @@ module.exports = (() => {
55725574 return Profile;
55735575})();
55745576
5575- },{"../utilities/format/factories/price":30,"./../utilities/data/AssetClass":25,"./../utilities/parsers/SymbolParser":39}],19:[function(require,module,exports){
5577+ },{"../utilities/format/factories/price":30,"./../utilities/data/AssetClass":25,"./../utilities/format/specialized/cmdtyView":34,"./../utilities/ parsers/SymbolParser":39}],19:[function(require,module,exports){
55765578module.exports = (() => {
55775579 'use strict';
55785580 /**
@@ -5832,7 +5834,7 @@ module.exports = (() => {
58325834 'use strict';
58335835
58345836 return {
5835- version: '5.17.1 '
5837+ version: '5.18.0 '
58365838 };
58375839})();
58385840
@@ -6113,7 +6115,7 @@ module.exports = (() => {
61136115 /**
61146116 * An enumeration that describes different conventions for formatting prices,
61156117 * as decimals or fractions (using tick notation). Each instrument is assigned
6116- * a unit code. See the {@link Profile.unitcode } property.
6118+ * a unit code. See the {@link Profile.unitCode } property.
61176119 *
61186120 * Barchart uses fourteen distinct unit codes.
61196121 *
@@ -6224,10 +6226,6 @@ module.exports = (() => {
62246226 /**
62256227 * Special fraction factors refer to the CME tick notation scheme (read more [here](https://www.cmegroup.com/confluence/display/EPICSANDBOX/Fractional+Pricing+-+Tick+and+Decimal+Conversions)).
62266228 *
6227- * For example, the CME notation for 0.51171875 (in 1/8ths of 1/32nds) is "0-163", where the
6228- * numerator of "163" means 16 thirty-seconds and 3 eighths of a thirty-second, where the
6229- * actual fraction is 16.3[75] / 32, which equals 0.51171875.
6230- *
62316229 * @public
62326230 * @returns {Number|undefined}
62336231 */
@@ -6487,16 +6485,16 @@ module.exports = (() => {
64876485 */
64886486
64896487 function buildPriceFormatter(fractionSeparator, specialFractions, thousandsSeparator, useParenthesis) {
6490- return (value, unitCode) => formatPrice(value, unitCode, fractionSeparator, specialFractions, thousandsSeparator, useParenthesis);
6488+ return (value, unitCode, profile ) => formatPrice(value, unitCode, fractionSeparator, specialFractions, thousandsSeparator, useParenthesis);
64916489 }
64926490 /**
6493- * Accepts a numeric value and a unit code, and returns a formatted
6494- * price as a string.
6491+ * Accepts a numeric value and a unit code, and returns a formatted price as a string.
64956492 *
64966493 * @public
64976494 * @callback PriceFormatterFactory~formatPrice
64986495 * @param {Number} value
64996496 * @param {String} unitCode
6497+ * @param {Profile} profile
65006498 * @returns {String}
65016499 */
65026500
@@ -6528,7 +6526,7 @@ module.exports = (() => {
65286526 return ['000', Math.floor(value)].join('').substr(-1 * digits);
65296527 }
65306528 /**
6531- * Formats a value using fractional notation.
6529+ * Formats a value using fractional tick notation.
65326530 *
65336531 * @exported
65346532 * @function
@@ -6749,20 +6747,21 @@ module.exports = (() => {
67496747 regex.ZN = /^BN\d$/;
67506748 /**
67516749 * An implementation of {@link Callbacks.CustomPriceFormatterCallback} which can be
6752- * used with ${@link Profile.setPriceFormatterCustom} which uses logic specific to
6753- * the [cmdtyView](https://www.barchart.com/cmdty/trading/cmdtyview) product.
6750+ * used with ${@link Profile.setPriceFormatterCustom}. This implementation applies
6751+ * logic specific to the [cmdtyView](https://www.barchart.com/cmdty/trading/cmdtyview)
6752+ * product.
67546753 *
67556754 * @function
67566755 * @ignore
67576756 * @param {Number} value
6758- * @param {String} unitcode
6757+ * @param {String} unitCode
67596758 * @param {Profile} profile
67606759 * @returns {String}
67616760 */
67626761
6763- function formatForCmdtyView(value, unitcode , profile) {
6762+ function formatForCmdtyView(value, unitCode , profile) {
67646763 if (profile.asset === AssetClass.FUTURE_OPTION) {
6765- const root = profile.root; // 2021/07/15, BRI. Options for ZB and ZN use unitcode ="5" which defines
6764+ const root = profile.root; // 2021/07/15, BRI. Options for ZB and ZN use unitCode ="5" which defines
67666765 // 64 price increments. The default price formatter will output fractions
67676766 // using halves of thirty-seconds (e.g. 0-315). However, the CME specifies
67686767 // formatting with sixty-fourths (e.g. 0-63). These notations are numerically
@@ -6772,7 +6771,7 @@ module.exports = (() => {
67726771
67736772 if (root === 'ZB' || root === 'ZN' || regex.ZB.test(root) || regex.ZN.test(root)) {
67746773 return formatFraction(value, 64, 2, '-', false);
6775- } // 2021/07/15, BRI. Options for ZT and ZF use unitcode ="6" which defines
6774+ } // 2021/07/15, BRI. Options for ZT and ZF use unitCode ="6" which defines
67766775 // 128 price increments. The default price formatter will output fractions
67776776 // using quarters of thirty-seconds (e.g. 0-317). However, the CME specifies
67786777 // formatting with halves of sixty-fourths (e.g. 0-635). These notations are
@@ -6786,7 +6785,7 @@ module.exports = (() => {
67866785 }
67876786 }
67886787
6789- return formatPrice(value, unitcode , '-', true, ',');
6788+ return formatPrice(value, unitCode , '-', true, ',');
67906789 }
67916790
67926791 return formatForCmdtyView;
0 commit comments