Skip to content

Commit 89b423d

Browse files
committed
Release. Bump version number
1 parent ab6af8d commit 89b423d

File tree

5 files changed

+55
-19
lines changed

5 files changed

+55
-19
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.19.1</small>
1+
# Barchart Market Data SDK <small>JavaScript 5.20.0</small>
22

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

example/browser/example.js

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3289,13 +3289,13 @@ module.exports = (() => {
32893289
}
32903290

32913291
assert.argumentIsArray(symbols, 'symbols', String);
3292-
return Promise.all([retrieveExtensionsFromExtras(symbols.filter(SymbolParser.getIsFuture)), retrieveExtensionsFromOnDemand(symbols.filter(SymbolParser.getIsC3), username, password), retrieveExtensionsFromFundamentals(symbols.filter(SymbolParser.getIsCmdtyStats))]).then(results => {
3292+
return Promise.all([retrieveExtensionsForC3(symbols.filter(SymbolParser.getIsC3)), retrieveExtensionsForCmdtyStats(symbols.filter(SymbolParser.getIsCmdtyStats)), retrieveExtensionsForFutures(symbols.filter(SymbolParser.getIsFuture))]).then(results => {
32933293
return array.flatten(results);
32943294
});
32953295
});
32963296
}
32973297

3298-
function retrieveExtensionsFromExtras(symbols) {
3298+
function retrieveExtensionsForFutures(symbols) {
32993299
return Promise.resolve().then(() => {
33003300
if (symbols.length === 0) {
33013301
return Promise.resolve([]);
@@ -3335,7 +3335,7 @@ module.exports = (() => {
33353335
});
33363336
}
33373337

3338-
function retrieveExtensionsFromFundamentals(symbols) {
3338+
function retrieveExtensionsForCmdtyStats(symbols) {
33393339
return Promise.resolve().then(() => {
33403340
if (symbols.length === 0) {
33413341
return Promise.resolve([]);
@@ -3363,42 +3363,78 @@ module.exports = (() => {
33633363
});
33643364
}
33653365

3366-
function retrieveExtensionsFromOnDemand(symbols, username, password) {
3366+
function retrieveExtensionsForC3(symbols) {
33673367
return Promise.resolve().then(() => {
33683368
if (symbols.length === 0) {
33693369
return Promise.resolve([]);
33703370
}
33713371

33723372
const options = {
3373-
url: `https://webapp-proxy.aws.barchart.com/v1/proxies/ondemand/getQuote.json?username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}&symbols=${encodeURIComponent(symbols.join())}`,
3373+
url: `https://instrument-extensions.aws.barchart.com/v1/c3/meta?symbols=${encodeURIComponent(symbols.join())}`,
33743374
method: 'GET'
33753375
};
33763376
return Promise.resolve(axios(options)).then(response => {
3377-
const results = response.data.results || [];
3377+
const results = response.data || [];
33783378
return results.reduce((accumulator, result) => {
33793379
try {
33803380
const extension = {};
33813381
extension.symbol = result.symbol.toUpperCase();
33823382

3383-
if (SymbolParser.getIsC3(extension.symbol)) {
3383+
if (SymbolParser.getIsC3(extension.symbol) && is.object(result.meta)) {
33843384
const c3 = {};
3385+
c3.area = null;
3386+
c3.basis = null;
33853387
c3.currency = null;
33863388
c3.delivery = null;
3389+
c3.description = null;
3390+
c3.lot = null;
3391+
c3.market = null;
3392+
c3.product = null;
3393+
c3.terms = null;
3394+
const meta = result.meta;
3395+
3396+
if (meta.area) {
3397+
c3.area = meta.area;
3398+
}
33873399

3388-
if (result.commodityDataCurrency) {
3389-
c3.currency = getC3Currency(result.commodityDataCurrency);
3400+
if (meta.basis) {
3401+
c3.basis = meta.basis;
33903402
}
33913403

3392-
if (result.commodityDataDelivery) {
3393-
c3.delivery = result.commodityDataDelivery;
3404+
if (meta.lot) {
3405+
c3.currency = getC3Currency(meta.lot);
3406+
}
3407+
3408+
if (meta.delivery) {
3409+
c3.delivery = meta.delivery;
3410+
}
3411+
3412+
if (meta.description) {
3413+
c3.description = meta.description;
3414+
}
3415+
3416+
if (meta.lot) {
3417+
c3.lot = meta.lot;
3418+
}
3419+
3420+
if (meta.market) {
3421+
c3.market = meta.market;
3422+
}
3423+
3424+
if (meta.product) {
3425+
c3.product = meta.product;
3426+
}
3427+
3428+
if (meta.terms) {
3429+
c3.terms = meta.terms;
33943430
}
33953431

33963432
extension.c3 = c3;
33973433
}
33983434

33993435
accumulator.push(extension);
34003436
} catch (e) {
3401-
logger.warn(`Snapshot: Failed to process symbol [ ${JSON.stringify(result)} ]`);
3437+
logger.warn(`Extensions: Failed to process extension [ ${symbols.join()} ]`);
34023438
}
34033439

34043440
return accumulator;
@@ -3757,7 +3793,7 @@ module.exports = (() => {
37573793

37583794
accumulator.push(message);
37593795
} catch (e) {
3760-
logger.warn(`Snapshot: Failed to process symbol`);
3796+
logger.warn(`Snapshot: Failed to process snapshot [ ${symbols.join()} ]`);
37613797
}
37623798

37633799
return accumulator;
@@ -5541,7 +5577,7 @@ module.exports = (() => {
55415577
profiles[symbol] = this;
55425578
}
55435579
/**
5544-
* Given a price, returns a the human-readable string representation.
5580+
* Given a price, returns the human-readable representation.
55455581
*
55465582
* @public
55475583
* @param {number} price
@@ -5875,7 +5911,7 @@ module.exports = (() => {
58755911
'use strict';
58765912

58775913
return {
5878-
version: '5.19.1'
5914+
version: '5.20.0'
58795915
};
58805916
})();
58815917

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.19.1'
5+
version: '5.20.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.19.1",
3+
"version": "5.20.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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ module.exports = (() => {
733733
profiles[symbol] = this;
734734
}
735735
/**
736-
* Given a price, returns a the human-readable string representation.
736+
* Given a price, returns the human-readable representation.
737737
*
738738
* @public
739739
* @param {number} price

0 commit comments

Comments
 (0)