Skip to content

Commit

Permalink
Release. Bump version number
Browse files Browse the repository at this point in the history
  • Loading branch information
bryaningl3 committed Aug 8, 2023
1 parent 8180846 commit 315dc36
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Barchart Market Data SDK <small>JavaScript 6.0.2</small>
# Barchart Market Data SDK <small>JavaScript 6.0.3</small>

> Inject real-time market data into your JavaScript applications
Expand Down
42 changes: 39 additions & 3 deletions example/browser/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -4903,7 +4903,7 @@ module.exports = (() => {
this.pointValue = pointValue;

/**
* @property {number} tickIncrement - The minimum price movement.
* @property {number} tickIncrement - The minimum price movement, expressed as an integer multiple of the number of the possible divisions within one unit. For example, the number of discrete divisions of a dollar is 100. If the tick increment is ten, that means quotes and trades can occur at $0.10, $0.20, $0.30, etc.
* @public
* @readonly
*/
Expand Down Expand Up @@ -5312,7 +5312,7 @@ module.exports = (() => {
'use strict';

return {
version: '6.0.2'
version: '6.0.3'
};
})();

Expand Down Expand Up @@ -5567,6 +5567,8 @@ module.exports = (() => {
})();

},{"@barchart/common-js/lang/Enum":48}],28:[function(require,module,exports){
const assert = require('@barchart/common-js/lang/assert'),
is = require('@barchart/common-js/lang/is');
const Enum = require('@barchart/common-js/lang/Enum');
module.exports = (() => {
'use strict';
Expand Down Expand Up @@ -5723,6 +5725,40 @@ module.exports = (() => {
getFractionDigits(special) {
return special === true ? this._fractionDigitsSpecial : this._fractionDigits;
}

/**
* Determines the minimum price fluctuation. In other words, multiples
* of this value determine the set of valid quote and trade prices
* for an instrument.
*
* @public
* @param {Number} tickIncrement - Taken from a {@link Profile} instance.
* @returns {Number}
*/
getMinimumTick(tickIncrement) {
assert.argumentIsValid(tickIncrement, 'tickIncrement', is.integer, 'must be an integer');
let discretePrice;
if (this.supportsFractions) {
discretePrice = 1 / this._fractionFactor;
} else {
discretePrice = 1 / Math.pow(10, this._decimalDigits);
}
return discretePrice * tickIncrement;
}

/**
* Returns the change in value of a position when the instrument's price moves
* up by the minimum tick.
*
* @public
* @param {Number} tickIncrement - Taken from a {@link Profile} instance.
* @param {Number} pointValue - Taken from a {@link Profile} instance.
*/
getMinimumTickValue(tickIncrement, pointValue) {
assert.argumentIsValid(tickIncrement, 'tickIncrement', is.integer, 'must be an integer');
assert.argumentIsValid(pointValue, 'pointValue', is.number, 'must be a number');
return this.getMinimumTick(tickIncrement) * pointValue;
}
toString() {
return `[UnitCode (code=${this.code})]`;
}
Expand Down Expand Up @@ -5768,7 +5804,7 @@ module.exports = (() => {
return UnitCode;
})();

},{"@barchart/common-js/lang/Enum":48}],29:[function(require,module,exports){
},{"@barchart/common-js/lang/Enum":48,"@barchart/common-js/lang/assert":51,"@barchart/common-js/lang/is":52}],29:[function(require,module,exports){
const timezone = require('@barchart/common-js/lang/timezone');
module.exports = (() => {
'use strict';
Expand Down
2 changes: 1 addition & 1 deletion lib/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module.exports = (() => {
'use strict';

return {
version: '6.0.2'
version: '6.0.3'
};
})();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@barchart/marketdata-api-js",
"version": "6.0.2",
"version": "6.0.3",
"description": "SDK for streaming market data from Barchart.com",
"author": {
"name": "Eero Pikat",
Expand Down
102 changes: 100 additions & 2 deletions test/dist/barchart-marketdata-api-tests-6.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ module.exports = (() => {
this.pointValue = pointValue;

/**
* @property {number} tickIncrement - The minimum price movement.
* @property {number} tickIncrement - The minimum price movement, expressed as an integer multiple of the number of the possible divisions within one unit. For example, the number of discrete divisions of a dollar is 100. If the tick increment is ten, that means quotes and trades can occur at $0.10, $0.20, $0.30, etc.
* @public
* @readonly
*/
Expand Down Expand Up @@ -1036,6 +1036,8 @@ module.exports = (() => {
})();

},{"@barchart/common-js/lang/Enum":34}],14:[function(require,module,exports){
const assert = require('@barchart/common-js/lang/assert'),
is = require('@barchart/common-js/lang/is');
const Enum = require('@barchart/common-js/lang/Enum');
module.exports = (() => {
'use strict';
Expand Down Expand Up @@ -1192,6 +1194,40 @@ module.exports = (() => {
getFractionDigits(special) {
return special === true ? this._fractionDigitsSpecial : this._fractionDigits;
}

/**
* Determines the minimum price fluctuation. In other words, multiples
* of this value determine the set of valid quote and trade prices
* for an instrument.
*
* @public
* @param {Number} tickIncrement - Taken from a {@link Profile} instance.
* @returns {Number}
*/
getMinimumTick(tickIncrement) {
assert.argumentIsValid(tickIncrement, 'tickIncrement', is.integer, 'must be an integer');
let discretePrice;
if (this.supportsFractions) {
discretePrice = 1 / this._fractionFactor;
} else {
discretePrice = 1 / Math.pow(10, this._decimalDigits);
}
return discretePrice * tickIncrement;
}

/**
* Returns the change in value of a position when the instrument's price moves
* up by the minimum tick.
*
* @public
* @param {Number} tickIncrement - Taken from a {@link Profile} instance.
* @param {Number} pointValue - Taken from a {@link Profile} instance.
*/
getMinimumTickValue(tickIncrement, pointValue) {
assert.argumentIsValid(tickIncrement, 'tickIncrement', is.integer, 'must be an integer');
assert.argumentIsValid(pointValue, 'pointValue', is.number, 'must be a number');
return this.getMinimumTick(tickIncrement) * pointValue;
}
toString() {
return `[UnitCode (code=${this.code})]`;
}
Expand Down Expand Up @@ -1237,7 +1273,7 @@ module.exports = (() => {
return UnitCode;
})();

},{"@barchart/common-js/lang/Enum":34}],15:[function(require,module,exports){
},{"@barchart/common-js/lang/Enum":34,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":38}],15:[function(require,module,exports){
module.exports = (() => {
'use strict';

Expand Down Expand Up @@ -9797,6 +9833,68 @@ describe('When parsing a valid character as a unit code', () => {
});
});
});
describe('When calculating minimum ticks and minimum tick values', () => {
describe('For unit code "2" and with a tickIncrement of 2 and a pointValue of 50 (e.g. corn)', () => {
let uc;
beforeEach(() => {
uc = UnitCode.parse('2');
});
it('The minimum tick should be 0.25', () => {
expect(uc.getMinimumTick(2)).toEqual(0.25);
});
it('The minimum tick value should be 12.50', () => {
expect(uc.getMinimumTickValue(2, 50)).toEqual(12.5);
});
});
describe('For unit code "A" and with a tickIncrement of 25 and a pointValue of 50 (e.g. e-mini)', () => {
let uc;
beforeEach(() => {
uc = UnitCode.parse('A');
});
it('The minimum tick should be 0.25', () => {
expect(uc.getMinimumTick(25)).toEqual(0.25);
});
it('The minimum tick value should be 12.50', () => {
expect(uc.getMinimumTickValue(25, 50)).toEqual(12.5);
});
});
describe('For unit code "A" and with a tickIncrement of 1 and a pointValue of 1000 (e.g. crude)', () => {
let uc;
beforeEach(() => {
uc = UnitCode.parse('A');
});
it('The minimum tick should be 0.01', () => {
expect(uc.getMinimumTick(1)).toEqual(0.01);
});
it('The minimum tick value should be 10', () => {
expect(uc.getMinimumTickValue(1, 1000)).toEqual(10);
});
});
describe('For unit code "9" and with a tickIncrement of 1 and a pointValue of 100 (e.g. gold)', () => {
let uc;
beforeEach(() => {
uc = UnitCode.parse('9');
});
it('The minimum tick should be 0.1', () => {
expect(uc.getMinimumTick(1)).toEqual(0.1);
});
it('The minimum tick value should be 10', () => {
expect(uc.getMinimumTickValue(1, 100)).toEqual(10);
});
});
describe('For unit code "5" and with a tickIncrement of 1 and a pointValue of 1000 (e.g. t-notes)', () => {
let uc;
beforeEach(() => {
uc = UnitCode.parse('5');
});
it('The minimum tick should be 0.015625', () => {
expect(uc.getMinimumTick(1)).toEqual(0.015625);
});
it('The minimum tick value should be 15.625', () => {
expect(uc.getMinimumTickValue(1, 1000)).toEqual(15.625);
});
});
});

},{"../../../../lib/utilities/data/UnitCode":14}],63:[function(require,module,exports){
const monthCodes = require('../../../../lib/utilities/data/monthCodes');
Expand Down

0 comments on commit 315dc36

Please sign in to comment.