Skip to content

Commit 8c4a32b

Browse files
committed
Release. Bump version number
1 parent 818ad3e commit 8c4a32b

File tree

5 files changed

+79
-10
lines changed

5 files changed

+79
-10
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 5.26.0</small>
1+
# Barchart Market Data SDK <small>JavaScript 5.27.0</small>
22

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

example/browser/example.js

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,7 +1985,7 @@ module.exports = (() => {
19851985
return;
19861986
}
19871987

1988-
retrieveProfileExtensions(array.difference(symbols, __completedProfileExtensions), __loginInfo.username, __loginInfo.password).then(extensions => {
1988+
retrieveProfileExtensions(array.difference(symbols, __completedProfileExtensions)).then(extensions => {
19891989
if (__connectionState !== state.authenticated) {
19901990
return;
19911991
}
@@ -3282,14 +3282,14 @@ module.exports = (() => {
32823282
* @returns {Promise<ProfileExtension[]>}
32833283
*/
32843284

3285-
function retrieveExtensions(symbols, username, password) {
3285+
function retrieveExtensions(symbols) {
32863286
return Promise.resolve().then(() => {
32873287
if (logger === null) {
32883288
logger = LoggerFactory.getLogger('@barchart/marketdata-api-js');
32893289
}
32903290

32913291
assert.argumentIsArray(symbols, 'symbols', String);
3292-
return Promise.all([retrieveExtensionsForC3(symbols.filter(SymbolParser.getIsC3)), retrieveExtensionsForCmdtyStats(symbols.filter(SymbolParser.getIsCmdtyStats)), retrieveExtensionsForFutures(symbols.filter(SymbolParser.getIsFuture)), retrieveExtensionsForFuturesOptions(symbols.filter(SymbolParser.getIsFutureOption))]).then(results => {
3292+
return Promise.all([retrieveExtensionsForC3(symbols.filter(SymbolParser.getIsC3)), retrieveExtensionsForCmdtyStats(symbols.filter(SymbolParser.getIsCmdtyStats)), retrieveExtensionsForFutures(symbols.filter(SymbolParser.getIsFuture)), retrieveExtensionsForFuturesOptions(symbols.filter(SymbolParser.getIsFutureOption)), retrieveExtensionsForGrainBids(symbols.filter(SymbolParser.getIsGrainBid))]).then(results => {
32933293
return array.flatten(results);
32943294
});
32953295
});
@@ -3510,6 +3510,34 @@ module.exports = (() => {
35103510
});
35113511
}
35123512

3513+
function retrieveExtensionsForGrainBids(symbols) {
3514+
return Promise.resolve().then(() => {
3515+
if (symbols.length === 0) {
3516+
return Promise.resolve([]);
3517+
}
3518+
3519+
const options = {
3520+
url: `https://instrument-extensions.aws.barchart.com/v1/grains/meta?&symbols=${encodeURIComponent(symbols.join())}`,
3521+
method: 'GET'
3522+
};
3523+
return Promise.resolve(axios(options)).then(response => {
3524+
if (response.status !== 200) {
3525+
return [];
3526+
}
3527+
3528+
const results = (response.data || []).filter(result => {
3529+
return result.meta !== null;
3530+
});
3531+
return results.map(result => {
3532+
const extension = {};
3533+
extension.symbol = result.symbol;
3534+
extension.grainBid = result.meta;
3535+
return extension;
3536+
});
3537+
});
3538+
});
3539+
}
3540+
35133541
const regex = {};
35143542
regex.dates = {};
35153543
regex.dates.expire = /^([0-9]{4}-[0-9]{2}-[0-9]{2})T/;
@@ -3541,9 +3569,10 @@ module.exports = (() => {
35413569
* @ignore
35423570
* @property {String} symbol
35433571
* @property {String=} expiration
3544-
* @property {String=} firstNotice
35453572
* @property {Object=} c3
35463573
* @property {Object=} cmdtyStats
3574+
* @property {String=} firstNotice
3575+
* @property {Object=} grainBid
35473576
* @property {Object=} option
35483577
*/
35493578

@@ -4809,6 +4838,10 @@ module.exports = (() => {
48094838
profile.cmdtyStats = extension.cmdtyStats;
48104839
}
48114840

4841+
if (extension.grainBid) {
4842+
profile.grainBid = extension.grainBid;
4843+
}
4844+
48124845
if (extension.option) {
48134846
profile.option = extension.option;
48144847
}
@@ -6109,7 +6142,7 @@ module.exports = (() => {
61096142
'use strict';
61106143

61116144
return {
6112-
version: '5.26.0'
6145+
version: '5.27.0'
61136146
};
61146147
})();
61156148

@@ -8091,7 +8124,7 @@ module.exports = (() => {
80918124
return is.string(symbol) && types.indicies.external.test(symbol);
80928125
}
80938126
/**
8094-
* Returns true if the symbol represents an Barchart sector (i.e. a type
8127+
* Returns true if the symbol represents a Barchart sector (i.e. a type
80958128
* of index calculated by Barchart).
80968129
*
80978130
* @public
@@ -8244,6 +8277,19 @@ module.exports = (() => {
82448277
static getIsPit(symbol, name) {
82458278
return is.string(symbol) && is.string(name) && predicates.pit.test(name);
82468279
}
8280+
/**
8281+
* Returns true if the symbol represents a grain bid instrument.
8282+
*
8283+
* @public
8284+
* @static
8285+
* @param {String} symbol
8286+
* @returns {Boolean}
8287+
*/
8288+
8289+
8290+
static getIsGrainBid(symbol) {
8291+
return is.string(symbol) && types.bids.test(symbol);
8292+
}
82478293
/**
82488294
* Returns a simple instrument definition containing information which
82498295
* can be inferred from the symbol. A null value is returned if nothing
@@ -8412,6 +8458,7 @@ module.exports = (() => {
84128458
predicates.percent = /(\.RT)$/;
84138459
predicates.pit = /\(P(it)?\)/;
84148460
const types = {};
8461+
types.bids = /^([A-Z]{2})([B|P])([A-Z\d]{3,4})-(\d+)-(\d+)(\.CM)$/i;
84158462
types.c3 = {};
84168463
types.c3.alias = /^(C3:)(.*)$/i;
84178464
types.c3.concrete = /(\.C3)$/i;

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: '5.26.0'
5+
version: '5.27.0'
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": "5.26.0",
3+
"version": "5.27.0",
44
"description": "SDK for streaming market data from Barchart.com",
55
"author": {
66
"name": "Eero Pikat",

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3066,7 +3066,7 @@ module.exports = (() => {
30663066
return is.string(symbol) && types.indicies.external.test(symbol);
30673067
}
30683068
/**
3069-
* Returns true if the symbol represents an Barchart sector (i.e. a type
3069+
* Returns true if the symbol represents a Barchart sector (i.e. a type
30703070
* of index calculated by Barchart).
30713071
*
30723072
* @public
@@ -3219,6 +3219,19 @@ module.exports = (() => {
32193219
static getIsPit(symbol, name) {
32203220
return is.string(symbol) && is.string(name) && predicates.pit.test(name);
32213221
}
3222+
/**
3223+
* Returns true if the symbol represents a grain bid instrument.
3224+
*
3225+
* @public
3226+
* @static
3227+
* @param {String} symbol
3228+
* @returns {Boolean}
3229+
*/
3230+
3231+
3232+
static getIsGrainBid(symbol) {
3233+
return is.string(symbol) && types.bids.test(symbol);
3234+
}
32223235
/**
32233236
* Returns a simple instrument definition containing information which
32243237
* can be inferred from the symbol. A null value is returned if nothing
@@ -3387,6 +3400,7 @@ module.exports = (() => {
33873400
predicates.percent = /(\.RT)$/;
33883401
predicates.pit = /\(P(it)?\)/;
33893402
const types = {};
3403+
types.bids = /^([A-Z]{2})([B|P])([A-Z\d]{3,4})-(\d+)-(\d+)(\.CM)$/i;
33903404
types.c3 = {};
33913405
types.c3.alias = /^(C3:)(.*)$/i;
33923406
types.c3.concrete = /(\.C3)$/i;
@@ -21936,6 +21950,14 @@ describe('When checking to see if a symbol is a BATS listing', () => {
2193621950
expect(SymbolParser.getIsBats('IBM.BZ')).toEqual(true);
2193721951
});
2193821952
});
21953+
describe('When checking to see if a symbol is a grain bids instrument', () => {
21954+
it('the symbol "IBM" should return false', () => {
21955+
expect(SymbolParser.getIsGrainBid('IBM')).toEqual(false);
21956+
});
21957+
it('the symbol "ZCPN22-4574-5387.CM" should return true', () => {
21958+
expect(SymbolParser.getIsGrainBid('ZCPN22-4574-5387.CM')).toEqual(true);
21959+
});
21960+
});
2193921961
describe('When checking to see if a symbol is pit-traded', () => {
2194021962
it('the symbol "IBM" (with the name "International Business Machines") should return false', () => {
2194121963
expect(SymbolParser.getIsPit('IBM', 'International Business Machines')).toEqual(false);

0 commit comments

Comments
 (0)