@forgecharts/sdk 1.5.54 → 1.5.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/TimeScale.d.ts.map +1 -1
- package/dist/datafeed/DatafeedConnector.d.ts.map +1 -1
- package/dist/index.js +51 -7
- package/dist/index.js.map +1 -1
- package/dist/internal.js +51 -7
- package/dist/internal.js.map +1 -1
- package/dist/pixi/PixiGridRenderer.d.ts.map +1 -1
- package/dist/react/index.js +51 -7
- package/dist/react/index.js.map +1 -1
- package/dist/react/internal.js +51 -7
- package/dist/react/internal.js.map +1 -1
- package/package.json +1 -1
package/dist/internal.js
CHANGED
|
@@ -483,9 +483,17 @@ var TimeScale = class {
|
|
|
483
483
|
const toIdx = this.timeToIndex(this._visibleRange.to);
|
|
484
484
|
const idxSpan = toIdx - fromIdx;
|
|
485
485
|
const idxStep = Math.max(1, Math.round(idxSpan / approxTicks));
|
|
486
|
-
const span = this._visibleRange.to - this._visibleRange.from;
|
|
487
|
-
const step = this._niceTimeStep(span / approxTicks);
|
|
488
486
|
const startIdx = Math.ceil(fromIdx / idxStep) * idxStep;
|
|
487
|
+
const _tickDeltas = [];
|
|
488
|
+
for (let i = Math.max(0, startIdx); i + idxStep <= Math.min(toIdx, this._barTimes.length - 1); i += idxStep) {
|
|
489
|
+
const a = this._barTimes[Math.round(i)];
|
|
490
|
+
const b = this._barTimes[Math.round(i + idxStep)];
|
|
491
|
+
if (a != null && b != null && b > a) _tickDeltas.push(b - a);
|
|
492
|
+
if (_tickDeltas.length >= 12) break;
|
|
493
|
+
}
|
|
494
|
+
_tickDeltas.sort((p, q) => p - q);
|
|
495
|
+
const _perTick = _tickDeltas.length > 0 ? _tickDeltas[Math.floor(_tickDeltas.length / 2)] : (this._visibleRange.to - this._visibleRange.from) / approxTicks;
|
|
496
|
+
const step = this._niceTimeStep(_perTick);
|
|
489
497
|
for (let i = startIdx; i <= toIdx; i += idxStep) {
|
|
490
498
|
const bIdx = Math.round(i);
|
|
491
499
|
if (bIdx < 0) continue;
|
|
@@ -5795,8 +5803,16 @@ var PixiGridRenderer = class {
|
|
|
5795
5803
|
const idxStep = Math.max(1, Math.round(rawIdxStep));
|
|
5796
5804
|
const barTimes = this._timeScale.barTimes;
|
|
5797
5805
|
const startIdx = Math.ceil(fromIdx / idxStep) * idxStep;
|
|
5798
|
-
const
|
|
5799
|
-
|
|
5806
|
+
const _tickDeltas = [];
|
|
5807
|
+
for (let i = Math.max(0, startIdx); i + idxStep <= Math.min(toIdx, barTimes.length - 1); i += idxStep) {
|
|
5808
|
+
const a = barTimes[Math.round(i)];
|
|
5809
|
+
const b = barTimes[Math.round(i + idxStep)];
|
|
5810
|
+
if (a != null && b != null && b > a) _tickDeltas.push(b - a);
|
|
5811
|
+
if (_tickDeltas.length >= 12) break;
|
|
5812
|
+
}
|
|
5813
|
+
_tickDeltas.sort((p, q) => p - q);
|
|
5814
|
+
const _perTick = _tickDeltas.length > 0 ? _tickDeltas[Math.floor(_tickDeltas.length / 2)] : (timeTo - timeFrom) / approxTicks;
|
|
5815
|
+
const step = this._niceTimeStep(_perTick);
|
|
5800
5816
|
for (let i = startIdx; i <= toIdx; i += idxStep) {
|
|
5801
5817
|
const bIdx = Math.round(i);
|
|
5802
5818
|
if (bIdx < 0) continue;
|
|
@@ -10354,6 +10370,13 @@ function _historyWindow(tf) {
|
|
|
10354
10370
|
return 500 * (parseTfSeconds(tf) ?? 3600);
|
|
10355
10371
|
}
|
|
10356
10372
|
var BATCH_SUPPRESSION_MS = 1e4;
|
|
10373
|
+
function tfSeconds(tf) {
|
|
10374
|
+
const m = /^(\d+)\s*(s|m|h|D|W|M)$/.exec(tf);
|
|
10375
|
+
if (!m) return 0;
|
|
10376
|
+
const mult = { s: 1, m: 60, h: 3600, D: 86400, W: 604800, M: 2592e3 }[m[2]];
|
|
10377
|
+
return parseInt(m[1], 10) * mult;
|
|
10378
|
+
}
|
|
10379
|
+
var LIVE_GAP_REPAIR_DELAY_MS = 3e3;
|
|
10357
10380
|
function _pageSize(tf) {
|
|
10358
10381
|
return 500 * (parseTfSeconds(tf) ?? 3600);
|
|
10359
10382
|
}
|
|
@@ -10481,15 +10504,36 @@ var DatafeedConnector = class {
|
|
|
10481
10504
|
this._batchSafetyTimer = null;
|
|
10482
10505
|
}, BATCH_SUPPRESSION_MS);
|
|
10483
10506
|
}
|
|
10507
|
+
const tfSec = tfSeconds(timeframe);
|
|
10508
|
+
let lastSeenBarTime = lastBarTime ?? 0;
|
|
10509
|
+
let repairTimer = null;
|
|
10510
|
+
const repairGap = (fromTime, toTime) => {
|
|
10511
|
+
if (repairTimer) clearTimeout(repairTimer);
|
|
10512
|
+
repairTimer = setTimeout(() => {
|
|
10513
|
+
repairTimer = null;
|
|
10514
|
+
if (this._activeUID !== uid || this._destroyed) return;
|
|
10515
|
+
void this._datafeed.getHistoricalBars(symbol, timeframe, fromTime, toTime).then(({ bars: filled }) => {
|
|
10516
|
+
if (this._activeUID !== uid || filled.length === 0) return;
|
|
10517
|
+
engine.backfillGap(filled);
|
|
10518
|
+
}).catch(() => {
|
|
10519
|
+
});
|
|
10520
|
+
}, LIVE_GAP_REPAIR_DELAY_MS);
|
|
10521
|
+
};
|
|
10484
10522
|
this._datafeed.subscribeBars(symbol, timeframe, (bar) => {
|
|
10485
|
-
if (this._activeUID
|
|
10486
|
-
|
|
10523
|
+
if (this._activeUID !== uid) return;
|
|
10524
|
+
const t = bar.time;
|
|
10525
|
+
if (tfSec > 0 && lastSeenBarTime > 0 && t > lastSeenBarTime + tfSec) {
|
|
10526
|
+
repairGap(lastSeenBarTime, t);
|
|
10487
10527
|
}
|
|
10528
|
+
if (t > lastSeenBarTime) lastSeenBarTime = t;
|
|
10529
|
+
engine.applyLiveUpdate(bar);
|
|
10488
10530
|
}, uid, lastBarTime, (bars) => {
|
|
10489
10531
|
this._clearBatchTimer();
|
|
10490
10532
|
batchPending = false;
|
|
10491
10533
|
if (this._activeUID === uid) {
|
|
10492
10534
|
engine.backfillGap(bars);
|
|
10535
|
+
const newest = bars.length > 0 ? bars[bars.length - 1].time : 0;
|
|
10536
|
+
if (newest > lastSeenBarTime) lastSeenBarTime = newest;
|
|
10493
10537
|
}
|
|
10494
10538
|
fireLoaded();
|
|
10495
10539
|
});
|
|
@@ -25526,7 +25570,7 @@ var demonstrationTool = {
|
|
|
25526
25570
|
};
|
|
25527
25571
|
|
|
25528
25572
|
// src/version.ts
|
|
25529
|
-
var FORGECHARTS_VERSION = "1.5.
|
|
25573
|
+
var FORGECHARTS_VERSION = "1.5.56" ;
|
|
25530
25574
|
|
|
25531
25575
|
// src/compatibility.ts
|
|
25532
25576
|
var MIN_KIT_API = 1;
|