@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
package/dist/react/index.js
CHANGED
|
@@ -10304,14 +10304,13 @@ function toOHLCV(bar) {
|
|
|
10304
10304
|
function _historyWindow(tf) {
|
|
10305
10305
|
return 500 * (parseTfSeconds(tf) ?? 3600);
|
|
10306
10306
|
}
|
|
10307
|
-
var
|
|
10307
|
+
var REFETCH_ON_DOUBT_DELAY_MS = 3e3;
|
|
10308
10308
|
function tfSeconds(tf) {
|
|
10309
10309
|
const m = /^(\d+)\s*(s|m|h|D|W|M)$/.exec(tf);
|
|
10310
10310
|
if (!m) return 0;
|
|
10311
10311
|
const mult = { s: 1, m: 60, h: 3600, D: 86400, W: 604800, M: 2592e3 }[m[2]];
|
|
10312
10312
|
return parseInt(m[1], 10) * mult;
|
|
10313
10313
|
}
|
|
10314
|
-
var LIVE_GAP_REPAIR_DELAY_MS = 3e3;
|
|
10315
10314
|
function _pageSize(tf) {
|
|
10316
10315
|
return 500 * (parseTfSeconds(tf) ?? 3600);
|
|
10317
10316
|
}
|
|
@@ -10347,9 +10346,11 @@ var DatafeedConnector = class {
|
|
|
10347
10346
|
*/
|
|
10348
10347
|
_emptyPageStreak = 0;
|
|
10349
10348
|
/**
|
|
10350
|
-
*
|
|
10351
|
-
*
|
|
10352
|
-
*
|
|
10349
|
+
* Nothing arms this any more — live-tick suppression went with the rest of
|
|
10350
|
+
* the client-side stitching once history became authoritative through the
|
|
10351
|
+
* forming bar. Kept (with its clear helper) because reconnect paths call
|
|
10352
|
+
* the helper and older subclasses may too; clearing a never-set timer is
|
|
10353
|
+
* free. Remove both in the next breaking cleanup.
|
|
10353
10354
|
*/
|
|
10354
10355
|
_batchSafetyTimer = null;
|
|
10355
10356
|
constructor(datafeed, series, callbacks) {
|
|
@@ -10373,12 +10374,10 @@ var DatafeedConnector = class {
|
|
|
10373
10374
|
const to = Math.floor(Date.now() / 1e3);
|
|
10374
10375
|
const from = to - _historyWindow(timeframe);
|
|
10375
10376
|
this._clearBatchTimer();
|
|
10376
|
-
let batchPending = false;
|
|
10377
10377
|
const engine = new CandleEngine({
|
|
10378
10378
|
// Every live tick mutates the engine's bar array and the chart series.
|
|
10379
10379
|
onBarUpdated: (bar) => {
|
|
10380
10380
|
if (this._activeUID !== uid) return;
|
|
10381
|
-
if (batchPending) return;
|
|
10382
10381
|
const ohlcv = toOHLCV(bar);
|
|
10383
10382
|
this._series.update(ohlcv);
|
|
10384
10383
|
this._cb.onUpdate?.(ohlcv);
|
|
@@ -10432,54 +10431,33 @@ var DatafeedConnector = class {
|
|
|
10432
10431
|
}).catch(() => {
|
|
10433
10432
|
});
|
|
10434
10433
|
if (this._activeUID !== uid) return;
|
|
10435
|
-
if (lastBarTime != null) {
|
|
10436
|
-
batchPending = true;
|
|
10437
|
-
this._batchSafetyTimer = setTimeout(() => {
|
|
10438
|
-
batchPending = false;
|
|
10439
|
-
this._batchSafetyTimer = null;
|
|
10440
|
-
}, BATCH_SUPPRESSION_MS);
|
|
10441
|
-
}
|
|
10442
10434
|
const tfSec = tfSeconds(timeframe);
|
|
10443
10435
|
let lastSeenBarTime = lastBarTime ?? 0;
|
|
10444
|
-
let
|
|
10445
|
-
const
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
if (repairTimer) clearTimeout(repairTimer);
|
|
10450
|
-
repairTimer = setTimeout(() => {
|
|
10451
|
-
repairTimer = null;
|
|
10436
|
+
let refetchTimer = null;
|
|
10437
|
+
const refetchOnDoubt = (fromTime, toTime) => {
|
|
10438
|
+
if (refetchTimer) clearTimeout(refetchTimer);
|
|
10439
|
+
refetchTimer = setTimeout(() => {
|
|
10440
|
+
refetchTimer = null;
|
|
10452
10441
|
if (this._activeUID !== uid || this._destroyed) return;
|
|
10453
10442
|
void this._datafeed.getHistoricalBars(symbol, timeframe, fromTime, toTime).then(({ bars: filled }) => {
|
|
10454
|
-
if (this._activeUID !== uid) return;
|
|
10455
|
-
|
|
10456
|
-
const newest = filled
|
|
10457
|
-
|
|
10458
|
-
if (!covered && repairAttempts < REPAIR_MAX_ATTEMPTS) {
|
|
10459
|
-
repairAttempts += 1;
|
|
10460
|
-
if (repairTimer) clearTimeout(repairTimer);
|
|
10461
|
-
repairTimer = setTimeout(() => {
|
|
10462
|
-
repairTimer = null;
|
|
10463
|
-
repairGap(fromTime, toTime);
|
|
10464
|
-
}, REPAIR_RETRY_MS);
|
|
10465
|
-
} else if (covered) {
|
|
10466
|
-
repairAttempts = 0;
|
|
10467
|
-
}
|
|
10443
|
+
if (this._activeUID !== uid || filled.length === 0) return;
|
|
10444
|
+
engine.backfillGap(filled);
|
|
10445
|
+
const newest = filled[filled.length - 1].time;
|
|
10446
|
+
if (newest > lastSeenBarTime) lastSeenBarTime = newest;
|
|
10468
10447
|
}).catch(() => {
|
|
10469
10448
|
});
|
|
10470
|
-
},
|
|
10449
|
+
}, REFETCH_ON_DOUBT_DELAY_MS);
|
|
10471
10450
|
};
|
|
10472
10451
|
this._datafeed.subscribeBars(symbol, timeframe, (bar) => {
|
|
10473
10452
|
if (this._activeUID !== uid) return;
|
|
10474
10453
|
const t = bar.time;
|
|
10475
10454
|
if (tfSec > 0 && lastSeenBarTime > 0 && t > lastSeenBarTime + tfSec) {
|
|
10476
|
-
|
|
10455
|
+
refetchOnDoubt(lastSeenBarTime, t);
|
|
10477
10456
|
}
|
|
10478
10457
|
if (t > lastSeenBarTime) lastSeenBarTime = t;
|
|
10479
10458
|
engine.applyLiveUpdate(bar);
|
|
10480
10459
|
}, uid, lastBarTime, (bars) => {
|
|
10481
10460
|
this._clearBatchTimer();
|
|
10482
|
-
batchPending = false;
|
|
10483
10461
|
if (this._activeUID === uid) {
|
|
10484
10462
|
engine.backfillGap(bars);
|
|
10485
10463
|
const newest = bars.length > 0 ? bars[bars.length - 1].time : 0;
|
|
@@ -10487,16 +10465,7 @@ var DatafeedConnector = class {
|
|
|
10487
10465
|
}
|
|
10488
10466
|
fireLoaded();
|
|
10489
10467
|
});
|
|
10490
|
-
if (result.filling)
|
|
10491
|
-
setTimeout(() => {
|
|
10492
|
-
if (this._activeUID !== uid || this._destroyed) return;
|
|
10493
|
-
void this._datafeed.getHistoricalBars(symbol, timeframe, from, to).then(({ bars: refetchedBars }) => {
|
|
10494
|
-
if (this._activeUID !== uid) return;
|
|
10495
|
-
engine.backfillGap(refetchedBars);
|
|
10496
|
-
}).catch(() => {
|
|
10497
|
-
});
|
|
10498
|
-
}, 8e3);
|
|
10499
|
-
}
|
|
10468
|
+
if (result.filling) refetchOnDoubt(from, to);
|
|
10500
10469
|
}).catch((err) => {
|
|
10501
10470
|
if (this._activeUID !== uid) return;
|
|
10502
10471
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -18089,7 +18058,7 @@ var DEMONSTRATION_STROKE = "rgba(255, 200, 50, 0.7)";
|
|
|
18089
18058
|
var DEMONSTRATION_COLOR = "var(--crosshair-overlay, rgba(255,255,255,0.75))";
|
|
18090
18059
|
|
|
18091
18060
|
// src/version.ts
|
|
18092
|
-
var FORGECHARTS_VERSION = "1.5.
|
|
18061
|
+
var FORGECHARTS_VERSION = "1.5.69" ;
|
|
18093
18062
|
function applyRuntimeConfig(caps, config) {
|
|
18094
18063
|
if (!config) return caps;
|
|
18095
18064
|
const orderEntry = config.enableOrderEntry === false ? false : caps.orderEntry;
|