Release v20.028 (from a477abd4)

This commit is contained in:
jenkins@tradingview.com
2021-09-10 14:56:00 +00:00
parent 017382d7b8
commit a0f6900107
623 changed files with 2115 additions and 2145 deletions

View File

@@ -1,12 +1,11 @@
import { getErrorMessage, } from './helpers';
var HistoryProvider = /** @class */ (function () {
function HistoryProvider(datafeedUrl, requester) {
export class HistoryProvider {
constructor(datafeedUrl, requester) {
this._datafeedUrl = datafeedUrl;
this._requester = requester;
}
HistoryProvider.prototype.getBars = function (symbolInfo, resolution, periodParams) {
var _this = this;
var requestParams = {
getBars(symbolInfo, resolution, periodParams) {
const requestParams = {
symbol: symbolInfo.ticker || '',
resolution: resolution,
from: periodParams.from,
@@ -18,15 +17,18 @@ var HistoryProvider = /** @class */ (function () {
if (symbolInfo.currency_code !== undefined) {
requestParams.currencyCode = symbolInfo.currency_code;
}
return new Promise(function (resolve, reject) {
_this._requester.sendRequest(_this._datafeedUrl, 'history', requestParams)
.then(function (response) {
if (symbolInfo.unit_id !== undefined) {
requestParams.unitId = symbolInfo.unit_id;
}
return new Promise((resolve, reject) => {
this._requester.sendRequest(this._datafeedUrl, 'history', requestParams)
.then((response) => {
if (response.s !== 'ok' && response.s !== 'no_data') {
reject(response.errmsg);
return;
}
var bars = [];
var meta = {
const bars = [];
const meta = {
noData: false,
};
if (response.s === 'no_data') {
@@ -34,10 +36,10 @@ var HistoryProvider = /** @class */ (function () {
meta.nextTime = response.nextTime;
}
else {
var volumePresent = response.v !== undefined;
var ohlPresent = response.o !== undefined;
for (var i = 0; i < response.t.length; ++i) {
var barValue = {
const volumePresent = response.v !== undefined;
const ohlPresent = response.o !== undefined;
for (let i = 0; i < response.t.length; ++i) {
const barValue = {
time: response.t[i] * 1000,
close: parseFloat(response.c[i]),
open: parseFloat(response.c[i]),
@@ -60,14 +62,12 @@ var HistoryProvider = /** @class */ (function () {
meta: meta,
});
})
.catch(function (reason) {
var reasonString = getErrorMessage(reason);
.catch((reason) => {
const reasonString = getErrorMessage(reason);
// tslint:disable-next-line:no-console
console.warn("HistoryProvider: getBars() failed, error=" + reasonString);
console.warn(`HistoryProvider: getBars() failed, error=${reasonString}`);
reject(reasonString);
});
});
};
return HistoryProvider;
}());
export { HistoryProvider };
}
}