@forgecharts/sdk 1.5.67 → 1.5.69
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/datafeed/DatafeedConnector.d.ts +5 -3
- package/dist/datafeed/DatafeedConnector.d.ts.map +1 -1
- package/dist/index.js +19 -50
- package/dist/index.js.map +1 -1
- package/dist/internal.js +19 -50
- package/dist/internal.js.map +1 -1
- package/dist/react/index.js +19 -50
- package/dist/react/index.js.map +1 -1
- package/dist/react/internal.js +19 -50
- package/dist/react/internal.js.map +1 -1
- package/package.json +1 -1
|
@@ -69,9 +69,11 @@ export declare class DatafeedConnector {
|
|
|
69
69
|
*/
|
|
70
70
|
private _emptyPageStreak;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
72
|
+
* Nothing arms this any more — live-tick suppression went with the rest of
|
|
73
|
+
* the client-side stitching once history became authoritative through the
|
|
74
|
+
* forming bar. Kept (with its clear helper) because reconnect paths call
|
|
75
|
+
* the helper and older subclasses may too; clearing a never-set timer is
|
|
76
|
+
* free. Remove both in the next breaking cleanup.
|
|
75
77
|
*/
|
|
76
78
|
private _batchSafetyTimer;
|
|
77
79
|
constructor(datafeed: IDatafeed, series: ISeries, callbacks: ConnectorCallbacks);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatafeedConnector.d.ts","sourceRoot":"","sources":["../../src/datafeed/DatafeedConnector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"DatafeedConnector.d.ts","sourceRoot":"","sources":["../../src/datafeed/DatafeedConnector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oB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QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB;IAQ/E;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAyLnD;;;;OAIG;IACH,UAAU,IAAI,IAAI;IAIlB;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAKrD;;;;OAIG;IACH,OAAO,IAAI,IAAI;IAOf;;;;;;;;;;;OAWG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IA0G3D,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,aAAa;CAoBtB"}
|
package/dist/index.js
CHANGED
|
@@ -10359,14 +10359,13 @@ function toOHLCV(bar) {
|
|
|
10359
10359
|
function _historyWindow(tf) {
|
|
10360
10360
|
return 500 * (parseTfSeconds(tf) ?? 3600);
|
|
10361
10361
|
}
|
|
10362
|
-
var
|
|
10362
|
+
var REFETCH_ON_DOUBT_DELAY_MS = 3e3;
|
|
10363
10363
|
function tfSeconds(tf) {
|
|
10364
10364
|
const m = /^(\d+)\s*(s|m|h|D|W|M)$/.exec(tf);
|
|
10365
10365
|
if (!m) return 0;
|
|
10366
10366
|
const mult = { s: 1, m: 60, h: 3600, D: 86400, W: 604800, M: 2592e3 }[m[2]];
|
|
10367
10367
|
return parseInt(m[1], 10) * mult;
|
|
10368
10368
|
}
|
|
10369
|
-
var LIVE_GAP_REPAIR_DELAY_MS = 3e3;
|
|
10370
10369
|
function _pageSize(tf) {
|
|
10371
10370
|
return 500 * (parseTfSeconds(tf) ?? 3600);
|
|
10372
10371
|
}
|
|
@@ -10402,9 +10401,11 @@ var DatafeedConnector = class {
|
|
|
10402
10401
|
*/
|
|
10403
10402
|
_emptyPageStreak = 0;
|
|
10404
10403
|
/**
|
|
10405
|
-
*
|
|
10406
|
-
*
|
|
10407
|
-
*
|
|
10404
|
+
* Nothing arms this any more — live-tick suppression went with the rest of
|
|
10405
|
+
* the client-side stitching once history became authoritative through the
|
|
10406
|
+
* forming bar. Kept (with its clear helper) because reconnect paths call
|
|
10407
|
+
* the helper and older subclasses may too; clearing a never-set timer is
|
|
10408
|
+
* free. Remove both in the next breaking cleanup.
|
|
10408
10409
|
*/
|
|
10409
10410
|
_batchSafetyTimer = null;
|
|
10410
10411
|
constructor(datafeed, series, callbacks) {
|
|
@@ -10428,12 +10429,10 @@ var DatafeedConnector = class {
|
|
|
10428
10429
|
const to = Math.floor(Date.now() / 1e3);
|
|
10429
10430
|
const from = to - _historyWindow(timeframe);
|
|
10430
10431
|
this._clearBatchTimer();
|
|
10431
|
-
let batchPending = false;
|
|
10432
10432
|
const engine = new CandleEngine({
|
|
10433
10433
|
// Every live tick mutates the engine's bar array and the chart series.
|
|
10434
10434
|
onBarUpdated: (bar) => {
|
|
10435
10435
|
if (this._activeUID !== uid) return;
|
|
10436
|
-
if (batchPending) return;
|
|
10437
10436
|
const ohlcv = toOHLCV(bar);
|
|
10438
10437
|
this._series.update(ohlcv);
|
|
10439
10438
|
this._cb.onUpdate?.(ohlcv);
|
|
@@ -10487,54 +10486,33 @@ var DatafeedConnector = class {
|
|
|
10487
10486
|
}).catch(() => {
|
|
10488
10487
|
});
|
|
10489
10488
|
if (this._activeUID !== uid) return;
|
|
10490
|
-
if (lastBarTime != null) {
|
|
10491
|
-
batchPending = true;
|
|
10492
|
-
this._batchSafetyTimer = setTimeout(() => {
|
|
10493
|
-
batchPending = false;
|
|
10494
|
-
this._batchSafetyTimer = null;
|
|
10495
|
-
}, BATCH_SUPPRESSION_MS);
|
|
10496
|
-
}
|
|
10497
10489
|
const tfSec = tfSeconds(timeframe);
|
|
10498
10490
|
let lastSeenBarTime = lastBarTime ?? 0;
|
|
10499
|
-
let
|
|
10500
|
-
const
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
if (repairTimer) clearTimeout(repairTimer);
|
|
10505
|
-
repairTimer = setTimeout(() => {
|
|
10506
|
-
repairTimer = null;
|
|
10491
|
+
let refetchTimer = null;
|
|
10492
|
+
const refetchOnDoubt = (fromTime, toTime) => {
|
|
10493
|
+
if (refetchTimer) clearTimeout(refetchTimer);
|
|
10494
|
+
refetchTimer = setTimeout(() => {
|
|
10495
|
+
refetchTimer = null;
|
|
10507
10496
|
if (this._activeUID !== uid || this._destroyed) return;
|
|
10508
10497
|
void this._datafeed.getHistoricalBars(symbol, timeframe, fromTime, toTime).then(({ bars: filled }) => {
|
|
10509
|
-
if (this._activeUID !== uid) return;
|
|
10510
|
-
|
|
10511
|
-
const newest = filled
|
|
10512
|
-
|
|
10513
|
-
if (!covered && repairAttempts < REPAIR_MAX_ATTEMPTS) {
|
|
10514
|
-
repairAttempts += 1;
|
|
10515
|
-
if (repairTimer) clearTimeout(repairTimer);
|
|
10516
|
-
repairTimer = setTimeout(() => {
|
|
10517
|
-
repairTimer = null;
|
|
10518
|
-
repairGap(fromTime, toTime);
|
|
10519
|
-
}, REPAIR_RETRY_MS);
|
|
10520
|
-
} else if (covered) {
|
|
10521
|
-
repairAttempts = 0;
|
|
10522
|
-
}
|
|
10498
|
+
if (this._activeUID !== uid || filled.length === 0) return;
|
|
10499
|
+
engine.backfillGap(filled);
|
|
10500
|
+
const newest = filled[filled.length - 1].time;
|
|
10501
|
+
if (newest > lastSeenBarTime) lastSeenBarTime = newest;
|
|
10523
10502
|
}).catch(() => {
|
|
10524
10503
|
});
|
|
10525
|
-
},
|
|
10504
|
+
}, REFETCH_ON_DOUBT_DELAY_MS);
|
|
10526
10505
|
};
|
|
10527
10506
|
this._datafeed.subscribeBars(symbol, timeframe, (bar) => {
|
|
10528
10507
|
if (this._activeUID !== uid) return;
|
|
10529
10508
|
const t = bar.time;
|
|
10530
10509
|
if (tfSec > 0 && lastSeenBarTime > 0 && t > lastSeenBarTime + tfSec) {
|
|
10531
|
-
|
|
10510
|
+
refetchOnDoubt(lastSeenBarTime, t);
|
|
10532
10511
|
}
|
|
10533
10512
|
if (t > lastSeenBarTime) lastSeenBarTime = t;
|
|
10534
10513
|
engine.applyLiveUpdate(bar);
|
|
10535
10514
|
}, uid, lastBarTime, (bars) => {
|
|
10536
10515
|
this._clearBatchTimer();
|
|
10537
|
-
batchPending = false;
|
|
10538
10516
|
if (this._activeUID === uid) {
|
|
10539
10517
|
engine.backfillGap(bars);
|
|
10540
10518
|
const newest = bars.length > 0 ? bars[bars.length - 1].time : 0;
|
|
@@ -10542,16 +10520,7 @@ var DatafeedConnector = class {
|
|
|
10542
10520
|
}
|
|
10543
10521
|
fireLoaded();
|
|
10544
10522
|
});
|
|
10545
|
-
if (result.filling)
|
|
10546
|
-
setTimeout(() => {
|
|
10547
|
-
if (this._activeUID !== uid || this._destroyed) return;
|
|
10548
|
-
void this._datafeed.getHistoricalBars(symbol, timeframe, from, to).then(({ bars: refetchedBars }) => {
|
|
10549
|
-
if (this._activeUID !== uid) return;
|
|
10550
|
-
engine.backfillGap(refetchedBars);
|
|
10551
|
-
}).catch(() => {
|
|
10552
|
-
});
|
|
10553
|
-
}, 8e3);
|
|
10554
|
-
}
|
|
10523
|
+
if (result.filling) refetchOnDoubt(from, to);
|
|
10555
10524
|
}).catch((err) => {
|
|
10556
10525
|
if (this._activeUID !== uid) return;
|
|
10557
10526
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -25575,7 +25544,7 @@ var demonstrationTool = {
|
|
|
25575
25544
|
};
|
|
25576
25545
|
|
|
25577
25546
|
// src/version.ts
|
|
25578
|
-
var FORGECHARTS_VERSION = "1.5.
|
|
25547
|
+
var FORGECHARTS_VERSION = "1.5.69" ;
|
|
25579
25548
|
|
|
25580
25549
|
// src/compatibility.ts
|
|
25581
25550
|
var MIN_KIT_API = 1;
|