Skip to content

Commit 315dc36

Browse files
committed
Release. Bump version number
1 parent 8180846 commit 315dc36

File tree

5 files changed

+142
-8
lines changed

5 files changed

+142
-8
lines changed

docs/_coverpage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Barchart Market Data SDK <small>JavaScript 6.0.2</small>
1+
# Barchart Market Data SDK <small>JavaScript 6.0.3</small>
22

33
> Inject real-time market data into your JavaScript applications
44

example/browser/example.js

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4903,7 +4903,7 @@ module.exports = (() => {
49034903
this.pointValue = pointValue;
49044904

49054905
/**
4906-
* @property {number} tickIncrement - The minimum price movement.
4906+
* @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.
49074907
* @public
49084908
* @readonly
49094909
*/
@@ -5312,7 +5312,7 @@ module.exports = (() => {
53125312
'use strict';
53135313

53145314
return {
5315-
version: '6.0.2'
5315+
version: '6.0.3'
53165316
};
53175317
})();
53185318

@@ -5567,6 +5567,8 @@ module.exports = (() => {
55675567
})();
55685568

55695569
},{"@barchart/common-js/lang/Enum":48}],28:[function(require,module,exports){
5570+
const assert = require('@barchart/common-js/lang/assert'),
5571+
is = require('@barchart/common-js/lang/is');
55705572
const Enum = require('@barchart/common-js/lang/Enum');
55715573
module.exports = (() => {
55725574
'use strict';
@@ -5723,6 +5725,40 @@ module.exports = (() => {
57235725
getFractionDigits(special) {
57245726
return special === true ? this._fractionDigitsSpecial : this._fractionDigits;
57255727
}
5728+
5729+
/**
5730+
* Determines the minimum price fluctuation. In other words, multiples
5731+
* of this value determine the set of valid quote and trade prices
5732+
* for an instrument.
5733+
*
5734+
* @public
5735+
* @param {Number} tickIncrement - Taken from a {@link Profile} instance.
5736+
* @returns {Number}
5737+
*/
5738+
getMinimumTick(tickIncrement) {
5739+
assert.argumentIsValid(tickIncrement, 'tickIncrement', is.integer, 'must be an integer');
5740+
let discretePrice;
5741+
if (this.supportsFractions) {
5742+
discretePrice = 1 / this._fractionFactor;
5743+
} else {
5744+
discretePrice = 1 / Math.pow(10, this._decimalDigits);
5745+
}
5746+
return discretePrice * tickIncrement;
5747+
}
5748+
5749+
/**
5750+
* Returns the change in value of a position when the instrument's price moves
5751+
* up by the minimum tick.
5752+
*
5753+
* @public
5754+
* @param {Number} tickIncrement - Taken from a {@link Profile} instance.
5755+
* @param {Number} pointValue - Taken from a {@link Profile} instance.
5756+
*/
5757+
getMinimumTickValue(tickIncrement, pointValue) {
5758+
assert.argumentIsValid(tickIncrement, 'tickIncrement', is.integer, 'must be an integer');
5759+
assert.argumentIsValid(pointValue, 'pointValue', is.number, 'must be a number');
5760+
return this.getMinimumTick(tickIncrement) * pointValue;
5761+
}
57265762
toString() {
57275763
return `[UnitCode (code=${this.code})]`;
57285764
}
@@ -5768,7 +5804,7 @@ module.exports = (() => {
57685804
return UnitCode;
57695805
})();
57705806

5771-
},{"@barchart/common-js/lang/Enum":48}],29:[function(require,module,exports){
5807+
},{"@barchart/common-js/lang/Enum":48,"@barchart/common-js/lang/assert":51,"@barchart/common-js/lang/is":52}],29:[function(require,module,exports){
57725808
const timezone = require('@barchart/common-js/lang/timezone');
57735809
module.exports = (() => {
57745810
'use strict';

lib/meta.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ module.exports = (() => {
22
'use strict';
33

44
return {
5-
version: '6.0.2'
5+
version: '6.0.3'
66
};
77
})();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@barchart/marketdata-api-js",
3-
"version": "6.0.2",
3+
"version": "6.0.3",
44
"description": "SDK for streaming market data from Barchart.com",
55
"author": {
66
"name": "Eero Pikat",

test/dist/barchart-marketdata-api-tests-6.js

Lines changed: 100 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ module.exports = (() => {
578578
this.pointValue = pointValue;
579579

580580
/**
581-
* @property {number} tickIncrement - The minimum price movement.
581+
* @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.
582582
* @public
583583
* @readonly
584584
*/
@@ -1036,6 +1036,8 @@ module.exports = (() => {
10361036
})();
10371037

10381038
},{"@barchart/common-js/lang/Enum":34}],14:[function(require,module,exports){
1039+
const assert = require('@barchart/common-js/lang/assert'),
1040+
is = require('@barchart/common-js/lang/is');
10391041
const Enum = require('@barchart/common-js/lang/Enum');
10401042
module.exports = (() => {
10411043
'use strict';
@@ -1192,6 +1194,40 @@ module.exports = (() => {
11921194
getFractionDigits(special) {
11931195
return special === true ? this._fractionDigitsSpecial : this._fractionDigits;
11941196
}
1197+
1198+
/**
1199+
* Determines the minimum price fluctuation. In other words, multiples
1200+
* of this value determine the set of valid quote and trade prices
1201+
* for an instrument.
1202+
*
1203+
* @public
1204+
* @param {Number} tickIncrement - Taken from a {@link Profile} instance.
1205+
* @returns {Number}
1206+
*/
1207+
getMinimumTick(tickIncrement) {
1208+
assert.argumentIsValid(tickIncrement, 'tickIncrement', is.integer, 'must be an integer');
1209+
let discretePrice;
1210+
if (this.supportsFractions) {
1211+
discretePrice = 1 / this._fractionFactor;
1212+
} else {
1213+
discretePrice = 1 / Math.pow(10, this._decimalDigits);
1214+
}
1215+
return discretePrice * tickIncrement;
1216+
}
1217+
1218+
/**
1219+
* Returns the change in value of a position when the instrument's price moves
1220+
* up by the minimum tick.
1221+
*
1222+
* @public
1223+
* @param {Number} tickIncrement - Taken from a {@link Profile} instance.
1224+
* @param {Number} pointValue - Taken from a {@link Profile} instance.
1225+
*/
1226+
getMinimumTickValue(tickIncrement, pointValue) {
1227+
assert.argumentIsValid(tickIncrement, 'tickIncrement', is.integer, 'must be an integer');
1228+
assert.argumentIsValid(pointValue, 'pointValue', is.number, 'must be a number');
1229+
return this.getMinimumTick(tickIncrement) * pointValue;
1230+
}
11951231
toString() {
11961232
return `[UnitCode (code=${this.code})]`;
11971233
}
@@ -1237,7 +1273,7 @@ module.exports = (() => {
12371273
return UnitCode;
12381274
})();
12391275

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

@@ -9797,6 +9833,68 @@ describe('When parsing a valid character as a unit code', () => {
97979833
});
97989834
});
97999835
});
9836+
describe('When calculating minimum ticks and minimum tick values', () => {
9837+
describe('For unit code "2" and with a tickIncrement of 2 and a pointValue of 50 (e.g. corn)', () => {
9838+
let uc;
9839+
beforeEach(() => {
9840+
uc = UnitCode.parse('2');
9841+
});
9842+
it('The minimum tick should be 0.25', () => {
9843+
expect(uc.getMinimumTick(2)).toEqual(0.25);
9844+
});
9845+
it('The minimum tick value should be 12.50', () => {
9846+
expect(uc.getMinimumTickValue(2, 50)).toEqual(12.5);
9847+
});
9848+
});
9849+
describe('For unit code "A" and with a tickIncrement of 25 and a pointValue of 50 (e.g. e-mini)', () => {
9850+
let uc;
9851+
beforeEach(() => {
9852+
uc = UnitCode.parse('A');
9853+
});
9854+
it('The minimum tick should be 0.25', () => {
9855+
expect(uc.getMinimumTick(25)).toEqual(0.25);
9856+
});
9857+
it('The minimum tick value should be 12.50', () => {
9858+
expect(uc.getMinimumTickValue(25, 50)).toEqual(12.5);
9859+
});
9860+
});
9861+
describe('For unit code "A" and with a tickIncrement of 1 and a pointValue of 1000 (e.g. crude)', () => {
9862+
let uc;
9863+
beforeEach(() => {
9864+
uc = UnitCode.parse('A');
9865+
});
9866+
it('The minimum tick should be 0.01', () => {
9867+
expect(uc.getMinimumTick(1)).toEqual(0.01);
9868+
});
9869+
it('The minimum tick value should be 10', () => {
9870+
expect(uc.getMinimumTickValue(1, 1000)).toEqual(10);
9871+
});
9872+
});
9873+
describe('For unit code "9" and with a tickIncrement of 1 and a pointValue of 100 (e.g. gold)', () => {
9874+
let uc;
9875+
beforeEach(() => {
9876+
uc = UnitCode.parse('9');
9877+
});
9878+
it('The minimum tick should be 0.1', () => {
9879+
expect(uc.getMinimumTick(1)).toEqual(0.1);
9880+
});
9881+
it('The minimum tick value should be 10', () => {
9882+
expect(uc.getMinimumTickValue(1, 100)).toEqual(10);
9883+
});
9884+
});
9885+
describe('For unit code "5" and with a tickIncrement of 1 and a pointValue of 1000 (e.g. t-notes)', () => {
9886+
let uc;
9887+
beforeEach(() => {
9888+
uc = UnitCode.parse('5');
9889+
});
9890+
it('The minimum tick should be 0.015625', () => {
9891+
expect(uc.getMinimumTick(1)).toEqual(0.015625);
9892+
});
9893+
it('The minimum tick value should be 15.625', () => {
9894+
expect(uc.getMinimumTickValue(1, 1000)).toEqual(15.625);
9895+
});
9896+
});
9897+
});
98009898

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

0 commit comments

Comments
 (0)