Skip to content

Commit 493e0e2

Browse files
BryanBryan
authored andcommitted
Add support for both Platts symbol formats, test, route to JERQ
1 parent cc570a2 commit 493e0e2

File tree

5 files changed

+66
-6
lines changed

5 files changed

+66
-6
lines changed

docs/content/releases/5.5.0.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**Configuration Changes**
2+
3+
* Quotes for [Platts](https://www.spglobal.com/platts/en) instruments are sourced from JERQ (instead of OnDemand).
4+
* Symbols for [Platts](https://www.spglobal.com/platts/en) instruments now support `.PT` suffix, in addition to `PLATTS:` prefix.

example/browser/js/startup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ module.exports = (() => {
464464
const C3 = [ 'AL79MRM1.C3', 'BSP9WGQ1.C3', 'RA10BGM1.C3' ];
465465
const C3_OLD = [ 'C3:AL79MRM1', 'C3:BSP9WGQ1', 'C3:RA10BGM1' ];
466466
const CMDTY = [ 'EUJU0Q51.CS', 'BC5L09YB.CS', 'EI3E06EI.CS', 'EI3E06EJ.CS' ];
467-
const PLATTS = [ 'PLATTS:RD52017', 'PLATTS:RD5MA17', 'PLATTS:RD52018' ];
467+
const PLATTS = [ 'PLATTS:AAWAB00', 'AAWAB00.PT', 'PLATTS:AAXVA00', 'AAXVA00.PT', 'PLATTS:CBAAF00', 'CBAAF00.PT' ];
468468
const AG = [ 'ZCPAIA.CM', 'ZCPAIL.CM', 'ZCPAIN.CM', 'ZCPAKS.CM', 'ZCPAMI.CM' ];
469469
const BOTH = [ 'ESZ19', 'ESZ9' ];
470470

lib/connection/Connection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ module.exports = (() => {
15661566
* @returns {Boolean}
15671567
*/
15681568
function getIsSnapshotSymbol(symbol) {
1569-
return SymbolParser.getIsPlatts(symbol) || SymbolParser.getIsCmdty(symbol);
1569+
return SymbolParser.getIsCmdty(symbol);
15701570
}
15711571

15721572
/**

lib/utilities/parsers/SymbolParser.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ module.exports = (() => {
215215
* @returns {Boolean}
216216
*/
217217
static getIsPlatts(symbol) {
218-
return is.string(symbol) && types.platts.test(symbol);
218+
return is.string(symbol) && (types.platts.concrete.test(symbol) || types.platts.alias.test(symbol));
219219
}
220220

221221
/**
@@ -382,7 +382,9 @@ module.exports = (() => {
382382
types.indicies.external = /^\$(.*)$/i;
383383
types.indicies.sector = /^\-(.*)$/i;
384384

385-
types.platts = /^(PLATTS:)(.*)$/i;
385+
types.platts = { };
386+
types.platts.alias = /^(PLATTS:)(.*)$/i;
387+
types.platts.concrete = /^(.*)(\.PT)$/i;
386388

387389
const parsers = [];
388390

@@ -605,6 +607,16 @@ module.exports = (() => {
605607
return converted;
606608
});
607609

610+
converters.push((symbol) => {
611+
let converted = null;
612+
613+
if (types.platts.alias.test(symbol)) {
614+
converted = symbol.replace(types.platts.alias, '$2.PT');
615+
}
616+
617+
return converted;
618+
});
619+
608620
converters.push((symbol) => {
609621
return symbol;
610622
});

test/specs/utilities/parsers/SymbolParserSpec.js

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,10 @@ describe('When checking to see if a symbol is a future', () => {
667667
expect(SymbolParser.getIsFuture('PLATTS:AAVSV00')).toEqual(false);
668668
});
669669

670+
it('the symbol "AAVSV00.PT" should return false', () => {
671+
expect(SymbolParser.getIsFuture('AAVSV00.PT')).toEqual(false);
672+
});
673+
670674
it('the symbol "ZCPAUS.CM" should return false', () => {
671675
expect(SymbolParser.getIsFuture('ZCPAUS.CM')).toEqual(false);
672676
});
@@ -829,6 +833,10 @@ describe('When checking to see if a symbol is sector', () => {
829833
expect(SymbolParser.getIsSector('PLATTS:AAVSV00')).toEqual(false);
830834
});
831835

836+
it('the symbol "AAVSV00.PT" should return false', () => {
837+
expect(SymbolParser.getIsSector('AAVSV00.PT')).toEqual(false);
838+
});
839+
832840
it('the symbol "ZCPAUS.CM" should return false', () => {
833841
expect(SymbolParser.getIsSector('ZCPAUS.CM')).toEqual(false);
834842
});
@@ -943,6 +951,10 @@ describe('When checking to see if a symbol is forex', () => {
943951
expect(SymbolParser.getIsForex('PLATTS:AAVSV00')).toEqual(false);
944952
});
945953

954+
it('the symbol "AAVSV00.PT" should return false', () => {
955+
expect(SymbolParser.getIsForex('AAVSV00.PT')).toEqual(false);
956+
});
957+
946958
it('the symbol "ZCPAUS.CM" should return false', () => {
947959
expect(SymbolParser.getIsForex('ZCPAUS.CM')).toEqual(false);
948960
});
@@ -1057,6 +1069,10 @@ describe('When checking to see if a symbol is a future spread', () => {
10571069
expect(SymbolParser.getIsFutureSpread('PLATTS:AAVSV00')).toEqual(false);
10581070
});
10591071

1072+
it('the symbol "AAVSV00.PT" should return false', () => {
1073+
expect(SymbolParser.getIsFutureSpread('AAVSV00.PT')).toEqual(false);
1074+
});
1075+
10601076
it('the symbol "ZCPAUS.CM" should return false', () => {
10611077
expect(SymbolParser.getIsFutureSpread('ZCPAUS.CM')).toEqual(false);
10621078
});
@@ -1171,6 +1187,10 @@ describe('When checking to see if a symbol is a future option', () => {
11711187
expect(SymbolParser.getIsFutureOption('PLATTS:AAVSV00')).toEqual(false);
11721188
});
11731189

1190+
it('the symbol "AAVSV00.PT" should return false', () => {
1191+
expect(SymbolParser.getIsFutureOption('AAVSV00.PT')).toEqual(false);
1192+
});
1193+
11741194
it('the symbol "ZCPAUS.CM" should return false', () => {
11751195
expect(SymbolParser.getIsFutureOption('ZCPAUS.CM')).toEqual(false);
11761196
});
@@ -1285,6 +1305,10 @@ describe('When checking to see if a symbol is a cmdty index option', () => {
12851305
expect(SymbolParser.getIsCmdty('PLATTS:AAVSV00')).toEqual(false);
12861306
});
12871307

1308+
it('the symbol "AAVSV00.PT" should return false', () => {
1309+
expect(SymbolParser.getIsCmdty('AAVSV00.PT')).toEqual(false);
1310+
});
1311+
12881312
it('the symbol "ZCPAUS.CM" should return true', () => {
12891313
expect(SymbolParser.getIsCmdty('ZCPAUS.CM')).toEqual(true);
12901314
});
@@ -1399,6 +1423,10 @@ describe('When checking to see if a symbol is a equity option', () => {
13991423
expect(SymbolParser.getIsEquityOption('PLATTS:AAVSV00')).toEqual(false);
14001424
});
14011425

1426+
it('the symbol "AAVSV00.PT" should return false', () => {
1427+
expect(SymbolParser.getIsEquityOption('AAVSV00.PT')).toEqual(false);
1428+
});
1429+
14021430
it('the symbol "ZCPAUS.CM" should return false', () => {
14031431
expect(SymbolParser.getIsEquityOption('ZCPAUS.CM')).toEqual(false);
14041432
});
@@ -1513,6 +1541,10 @@ describe('When checking to see if a symbol is a C3 instrument', () => {
15131541
expect(SymbolParser.getIsC3('PLATTS:AAVSV00')).toEqual(false);
15141542
});
15151543

1544+
it('the symbol "AAVSV00.PT" should return false', () => {
1545+
expect(SymbolParser.getIsC3('AAVSV00.PT')).toEqual(false);
1546+
});
1547+
15161548
it('the symbol "ZCPAUS.CM" should return false', () => {
15171549
expect(SymbolParser.getIsC3('ZCPAUS.CM')).toEqual(false);
15181550
});
@@ -1619,6 +1651,10 @@ describe('When checking to see if a symbol is a Platts instrument', () => {
16191651
expect(SymbolParser.getIsPlatts('PLATTS:AAVSV00')).toEqual(true);
16201652
});
16211653

1654+
it('the symbol "AAVSV00.PT" should return true', () => {
1655+
expect(SymbolParser.getIsPlatts('AAVSV00.PT')).toEqual(true);
1656+
});
1657+
16221658
it('the symbol "ZCPAUS.CM" should return false', () => {
16231659
expect(SymbolParser.getIsPlatts('ZCPAUS.CM')).toEqual(false);
16241660
});
@@ -1725,6 +1761,10 @@ describe('When checking to see if a symbol is a Canadian mutual fund', () => {
17251761
expect(SymbolParser.getIsCanadianFund('PLATTS:AAVSV00')).toEqual(false);
17261762
});
17271763

1764+
it('the symbol "AAVSV00.PT" should return false', () => {
1765+
expect(SymbolParser.getIsCanadianFund('AAVSV00.PT')).toEqual(false);
1766+
});
1767+
17281768
it('the symbol "ZCPAUS.CM" should return false', () => {
17291769
expect(SymbolParser.getIsCanadianFund('ZCPAUS.CM')).toEqual(false);
17301770
});
@@ -1835,8 +1875,12 @@ describe('When getting a producer symbol', () => {
18351875
expect(SymbolParser.getProducerSymbol('BZ6N20|25P')).toEqual('BZ6N0|25P');
18361876
});
18371877

1838-
it('PLATTS:AAVSV00 should map to PLATTS:AAVSV00', () => {
1839-
expect(SymbolParser.getProducerSymbol('PLATTS:AAVSV00')).toEqual('PLATTS:AAVSV00');
1878+
it('PLATTS:AAVSV00 should map to AAVSV00.PT', () => {
1879+
expect(SymbolParser.getProducerSymbol('PLATTS:AAVSV00')).toEqual('AAVSV00.PT');
1880+
});
1881+
1882+
it('AAVSV00.PT should map to AAVSV00.PT', () => {
1883+
expect(SymbolParser.getProducerSymbol('AAVSV00.PT')).toEqual('AAVSV00.PT');
18401884
});
18411885

18421886
it('VIC400.CF should map to VIC400.CF', () => {

0 commit comments

Comments
 (0)