Skip to content

Commit b1f7329

Browse files
committed
Release. Bump version number
1 parent 9427679 commit b1f7329

File tree

4 files changed

+59
-6
lines changed

4 files changed

+59
-6
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.20.0</small>
1+
# Barchart Market Data SDK <small>JavaScript 5.21.0</small>
22

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

example/browser/example.js

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,7 +2272,7 @@ module.exports = (() => {
22722272

22732273

22742274
function getIsExtendedProfileSymbol(symbol) {
2275-
return SymbolParser.getIsFuture(symbol) || SymbolParser.getIsC3(symbol) || SymbolParser.getIsCmdty(symbol);
2275+
return SymbolParser.getIsFuture(symbol) || SymbolParser.getIsC3(symbol) || SymbolParser.getIsCmdty(symbol) || SymbolParser.getIsFutureOption(symbol);
22762276
}
22772277
/**
22782278
* Indicates if some quote information cannot be extracted from JERQ via
@@ -3289,7 +3289,7 @@ module.exports = (() => {
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))]).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))]).then(results => {
32933293
return array.flatten(results);
32943294
});
32953295
});
@@ -3443,6 +3443,55 @@ module.exports = (() => {
34433443
});
34443444
}
34453445

3446+
function retrieveExtensionsForFuturesOptions(symbols) {
3447+
return Promise.resolve().then(() => {
3448+
if (symbols.length === 0) {
3449+
return Promise.resolve([]);
3450+
}
3451+
3452+
const options = {
3453+
url: `https://extras.ddfplus.com/json/instruments/?lookup=${encodeURIComponent(symbols.join())}`,
3454+
method: 'GET'
3455+
};
3456+
return Promise.resolve(axios(options)).then(response => {
3457+
if (response.status !== 200) {
3458+
return [];
3459+
}
3460+
3461+
const results = (response.data.instruments || []).filter(result => {
3462+
return result.status === 200;
3463+
});
3464+
return results.map(result => {
3465+
const extension = {};
3466+
extension.symbol = result.lookup;
3467+
3468+
if (is.string(result.symbol_expire)) {
3469+
const matches = result.symbol_expire.match(regex.dates.expire);
3470+
3471+
if (matches !== null) {
3472+
extension.expiration = Day.parse(matches[1]).format();
3473+
}
3474+
}
3475+
3476+
extension.option = {};
3477+
3478+
if (result.underlier) {
3479+
extension.option.underlying = result.underlier;
3480+
}
3481+
3482+
const parsed = SymbolParser.parseInstrumentType(result.lookup);
3483+
3484+
if (parsed !== null) {
3485+
extension.option.strike = parsed.strike;
3486+
extension.option.putCall = parsed.option_type;
3487+
}
3488+
3489+
return extension;
3490+
});
3491+
});
3492+
});
3493+
}
3494+
34463495
const regex = {};
34473496
regex.dates = {};
34483497
regex.dates.expire = /^([0-9]{4}-[0-9]{2}-[0-9]{2})T/;
@@ -4676,6 +4725,10 @@ module.exports = (() => {
46764725
if (extension.cmdtyStats) {
46774726
profile.cmdtyStats = extension.cmdtyStats;
46784727
}
4728+
4729+
if (extension.option) {
4730+
profile.option = extension.option;
4731+
}
46794732
};
46804733

46814734
const _createProfile = (symbol, name, exchange, unitCode, pointValue, tickIncrement, additional) => {
@@ -5911,7 +5964,7 @@ module.exports = (() => {
59115964
'use strict';
59125965

59135966
return {
5914-
version: '5.20.0'
5967+
version: '5.21.0'
59155968
};
59165969
})();
59175970

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

0 commit comments

Comments
 (0)