@forgecharts/sdk 1.3.12 → 1.3.13
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/react/internal.js
CHANGED
|
@@ -26314,6 +26314,161 @@ function RightToolbar({
|
|
|
26314
26314
|
}
|
|
26315
26315
|
);
|
|
26316
26316
|
}
|
|
26317
|
+
|
|
26318
|
+
// src/react/agent/contractUtils.ts
|
|
26319
|
+
var MONTH_CODE_MAP = {
|
|
26320
|
+
F: "January",
|
|
26321
|
+
G: "February",
|
|
26322
|
+
H: "March",
|
|
26323
|
+
J: "April",
|
|
26324
|
+
K: "May",
|
|
26325
|
+
M: "June",
|
|
26326
|
+
N: "July",
|
|
26327
|
+
Q: "August",
|
|
26328
|
+
U: "September",
|
|
26329
|
+
V: "October",
|
|
26330
|
+
X: "November",
|
|
26331
|
+
Z: "December"
|
|
26332
|
+
};
|
|
26333
|
+
var PRODUCTS = {
|
|
26334
|
+
// CME Equity Index
|
|
26335
|
+
ES: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
26336
|
+
MES: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
26337
|
+
NQ: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
26338
|
+
MNQ: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
26339
|
+
RTY: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
26340
|
+
M2K: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
26341
|
+
NKD: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
26342
|
+
// CBOT Equity Index
|
|
26343
|
+
YM: { exchange: "CBOT", months: ["H", "M", "U", "Z"] },
|
|
26344
|
+
MYM: { exchange: "CBOT", months: ["H", "M", "U", "Z"] },
|
|
26345
|
+
// CME FX
|
|
26346
|
+
"6E": { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
26347
|
+
"6B": { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
26348
|
+
"6J": { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
26349
|
+
"6A": { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
26350
|
+
"6C": { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
26351
|
+
// NYMEX Energy
|
|
26352
|
+
CL: { exchange: "NYMEX", months: ["F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"] },
|
|
26353
|
+
QM: { exchange: "NYMEX", months: ["F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"] },
|
|
26354
|
+
MCL: { exchange: "NYMEX", months: ["F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"] },
|
|
26355
|
+
NG: { exchange: "NYMEX", months: ["F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"] },
|
|
26356
|
+
HO: { exchange: "NYMEX", months: ["F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"] },
|
|
26357
|
+
RB: { exchange: "NYMEX", months: ["F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"] },
|
|
26358
|
+
// COMEX Metals
|
|
26359
|
+
GC: { exchange: "COMEX", months: ["G", "J", "M", "Q", "V", "Z"] },
|
|
26360
|
+
MGC: { exchange: "COMEX", months: ["G", "J", "M", "Q", "V", "Z"] },
|
|
26361
|
+
SI: { exchange: "COMEX", months: ["H", "K", "N", "U", "Z"] },
|
|
26362
|
+
HG: { exchange: "COMEX", months: ["H", "K", "N", "U", "Z"] },
|
|
26363
|
+
// CBOT Grains
|
|
26364
|
+
ZC: { exchange: "CBOT", months: ["H", "K", "N", "U", "Z"] },
|
|
26365
|
+
ZS: { exchange: "CBOT", months: ["F", "H", "K", "N", "Q", "U", "X"] },
|
|
26366
|
+
ZW: { exchange: "CBOT", months: ["H", "K", "N", "U", "Z"] },
|
|
26367
|
+
// CBOT Interest Rates
|
|
26368
|
+
ZB: { exchange: "CBOT", months: ["H", "M", "U", "Z"] },
|
|
26369
|
+
ZN: { exchange: "CBOT", months: ["H", "M", "U", "Z"] },
|
|
26370
|
+
ZF: { exchange: "CBOT", months: ["H", "M", "U", "Z"] },
|
|
26371
|
+
ZT: { exchange: "CBOT", months: ["H", "M", "U", "Z"] }
|
|
26372
|
+
};
|
|
26373
|
+
var MC_INDEX = {
|
|
26374
|
+
F: 0,
|
|
26375
|
+
G: 1,
|
|
26376
|
+
H: 2,
|
|
26377
|
+
J: 3,
|
|
26378
|
+
K: 4,
|
|
26379
|
+
M: 5,
|
|
26380
|
+
N: 6,
|
|
26381
|
+
Q: 7,
|
|
26382
|
+
U: 8,
|
|
26383
|
+
V: 9,
|
|
26384
|
+
X: 10,
|
|
26385
|
+
Z: 11
|
|
26386
|
+
};
|
|
26387
|
+
function parseContractInfo(symbol) {
|
|
26388
|
+
let input = symbol.trim().toUpperCase();
|
|
26389
|
+
let exchangeHint;
|
|
26390
|
+
if (input.includes(":")) {
|
|
26391
|
+
const colon = input.indexOf(":");
|
|
26392
|
+
exchangeHint = input.slice(0, colon);
|
|
26393
|
+
input = input.slice(colon + 1);
|
|
26394
|
+
}
|
|
26395
|
+
const contMatch = input.match(/^([A-Z0-9]+?)(\d+)!$/);
|
|
26396
|
+
if (contMatch) {
|
|
26397
|
+
const product = contMatch[1];
|
|
26398
|
+
const info = PRODUCTS[product];
|
|
26399
|
+
if (!info) return null;
|
|
26400
|
+
const exchange = exchangeHint ?? info.exchange;
|
|
26401
|
+
const front = _guessFrontMonth(product, info.months);
|
|
26402
|
+
return {
|
|
26403
|
+
isContinuous: true,
|
|
26404
|
+
product,
|
|
26405
|
+
exchange,
|
|
26406
|
+
frontMonthContract: `${exchange}:${front}`,
|
|
26407
|
+
continuousSymbol: `${exchange}:${product}1!`,
|
|
26408
|
+
availableMonths: info.months
|
|
26409
|
+
};
|
|
26410
|
+
}
|
|
26411
|
+
const specificMatch = input.match(/^([A-Z0-9]+?)([FGHJKMNQUVXZ])(\d{1,4})$/);
|
|
26412
|
+
if (specificMatch) {
|
|
26413
|
+
const product = specificMatch[1];
|
|
26414
|
+
const info = PRODUCTS[product];
|
|
26415
|
+
if (!info) return null;
|
|
26416
|
+
const exchange = exchangeHint ?? info.exchange;
|
|
26417
|
+
const front = _guessFrontMonth(product, info.months);
|
|
26418
|
+
return {
|
|
26419
|
+
isContinuous: false,
|
|
26420
|
+
product,
|
|
26421
|
+
exchange,
|
|
26422
|
+
frontMonthContract: `${exchange}:${front}`,
|
|
26423
|
+
continuousSymbol: `${exchange}:${product}1!`,
|
|
26424
|
+
availableMonths: info.months
|
|
26425
|
+
};
|
|
26426
|
+
}
|
|
26427
|
+
if (PRODUCTS[input]) {
|
|
26428
|
+
const info = PRODUCTS[input];
|
|
26429
|
+
const exchange = exchangeHint ?? info.exchange;
|
|
26430
|
+
const front = _guessFrontMonth(input, info.months);
|
|
26431
|
+
return {
|
|
26432
|
+
isContinuous: false,
|
|
26433
|
+
product: input,
|
|
26434
|
+
exchange,
|
|
26435
|
+
frontMonthContract: `${exchange}:${front}`,
|
|
26436
|
+
continuousSymbol: `${exchange}:${input}1!`,
|
|
26437
|
+
availableMonths: info.months
|
|
26438
|
+
};
|
|
26439
|
+
}
|
|
26440
|
+
return null;
|
|
26441
|
+
}
|
|
26442
|
+
function getUpcomingContracts(product, exchange, months, count = 6) {
|
|
26443
|
+
const now = /* @__PURE__ */ new Date();
|
|
26444
|
+
const currentMonth = now.getMonth();
|
|
26445
|
+
const currentYear = now.getFullYear();
|
|
26446
|
+
const contracts = [];
|
|
26447
|
+
for (let yearOffset = 0; yearOffset <= 2 && contracts.length < count; yearOffset++) {
|
|
26448
|
+
const year = currentYear + yearOffset;
|
|
26449
|
+
for (const mc of months) {
|
|
26450
|
+
if (contracts.length >= count) break;
|
|
26451
|
+
const monthIdx = MC_INDEX[mc];
|
|
26452
|
+
if (monthIdx === void 0) continue;
|
|
26453
|
+
if (year === currentYear && monthIdx < currentMonth) continue;
|
|
26454
|
+
contracts.push(`${exchange}:${product}${mc}${year}`);
|
|
26455
|
+
}
|
|
26456
|
+
}
|
|
26457
|
+
return contracts;
|
|
26458
|
+
}
|
|
26459
|
+
function _guessFrontMonth(product, months) {
|
|
26460
|
+
const now = /* @__PURE__ */ new Date();
|
|
26461
|
+
const currentMonth = now.getMonth();
|
|
26462
|
+
const currentYear = now.getFullYear();
|
|
26463
|
+
for (const mc of months) {
|
|
26464
|
+
const monthIdx = MC_INDEX[mc];
|
|
26465
|
+
if (monthIdx === void 0) continue;
|
|
26466
|
+
if (monthIdx >= currentMonth) {
|
|
26467
|
+
return `${product}${mc}${currentYear}`;
|
|
26468
|
+
}
|
|
26469
|
+
}
|
|
26470
|
+
return `${product}${months[0]}${currentYear + 1}`;
|
|
26471
|
+
}
|
|
26317
26472
|
var TIMEZONE_OPTIONS = [
|
|
26318
26473
|
{ label: "UTC", value: "UTC" },
|
|
26319
26474
|
{ label: "Exchange", value: "exchange" },
|
|
@@ -26477,7 +26632,8 @@ var CRYPTO_EXCHANGES = /* @__PURE__ */ new Set([
|
|
|
26477
26632
|
]);
|
|
26478
26633
|
function symbolSupportsSession(symbol) {
|
|
26479
26634
|
const exchange = symbol.includes(":") ? symbol.split(":")[0].toUpperCase() : "";
|
|
26480
|
-
|
|
26635
|
+
if (exchange !== "") return !CRYPTO_EXCHANGES.has(exchange);
|
|
26636
|
+
return parseContractInfo(symbol) !== null;
|
|
26481
26637
|
}
|
|
26482
26638
|
function useClockTime(timezone) {
|
|
26483
26639
|
const [time, setTime] = useState(() => _formatClock(timezone));
|
|
@@ -32544,161 +32700,6 @@ function AssistantPanel({ onClose, chartContext }) {
|
|
|
32544
32700
|
] });
|
|
32545
32701
|
}
|
|
32546
32702
|
|
|
32547
|
-
// src/react/agent/contractUtils.ts
|
|
32548
|
-
var MONTH_CODE_MAP = {
|
|
32549
|
-
F: "January",
|
|
32550
|
-
G: "February",
|
|
32551
|
-
H: "March",
|
|
32552
|
-
J: "April",
|
|
32553
|
-
K: "May",
|
|
32554
|
-
M: "June",
|
|
32555
|
-
N: "July",
|
|
32556
|
-
Q: "August",
|
|
32557
|
-
U: "September",
|
|
32558
|
-
V: "October",
|
|
32559
|
-
X: "November",
|
|
32560
|
-
Z: "December"
|
|
32561
|
-
};
|
|
32562
|
-
var PRODUCTS = {
|
|
32563
|
-
// CME Equity Index
|
|
32564
|
-
ES: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
32565
|
-
MES: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
32566
|
-
NQ: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
32567
|
-
MNQ: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
32568
|
-
RTY: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
32569
|
-
M2K: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
32570
|
-
NKD: { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
32571
|
-
// CBOT Equity Index
|
|
32572
|
-
YM: { exchange: "CBOT", months: ["H", "M", "U", "Z"] },
|
|
32573
|
-
MYM: { exchange: "CBOT", months: ["H", "M", "U", "Z"] },
|
|
32574
|
-
// CME FX
|
|
32575
|
-
"6E": { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
32576
|
-
"6B": { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
32577
|
-
"6J": { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
32578
|
-
"6A": { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
32579
|
-
"6C": { exchange: "CME", months: ["H", "M", "U", "Z"] },
|
|
32580
|
-
// NYMEX Energy
|
|
32581
|
-
CL: { exchange: "NYMEX", months: ["F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"] },
|
|
32582
|
-
QM: { exchange: "NYMEX", months: ["F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"] },
|
|
32583
|
-
MCL: { exchange: "NYMEX", months: ["F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"] },
|
|
32584
|
-
NG: { exchange: "NYMEX", months: ["F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"] },
|
|
32585
|
-
HO: { exchange: "NYMEX", months: ["F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"] },
|
|
32586
|
-
RB: { exchange: "NYMEX", months: ["F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"] },
|
|
32587
|
-
// COMEX Metals
|
|
32588
|
-
GC: { exchange: "COMEX", months: ["G", "J", "M", "Q", "V", "Z"] },
|
|
32589
|
-
MGC: { exchange: "COMEX", months: ["G", "J", "M", "Q", "V", "Z"] },
|
|
32590
|
-
SI: { exchange: "COMEX", months: ["H", "K", "N", "U", "Z"] },
|
|
32591
|
-
HG: { exchange: "COMEX", months: ["H", "K", "N", "U", "Z"] },
|
|
32592
|
-
// CBOT Grains
|
|
32593
|
-
ZC: { exchange: "CBOT", months: ["H", "K", "N", "U", "Z"] },
|
|
32594
|
-
ZS: { exchange: "CBOT", months: ["F", "H", "K", "N", "Q", "U", "X"] },
|
|
32595
|
-
ZW: { exchange: "CBOT", months: ["H", "K", "N", "U", "Z"] },
|
|
32596
|
-
// CBOT Interest Rates
|
|
32597
|
-
ZB: { exchange: "CBOT", months: ["H", "M", "U", "Z"] },
|
|
32598
|
-
ZN: { exchange: "CBOT", months: ["H", "M", "U", "Z"] },
|
|
32599
|
-
ZF: { exchange: "CBOT", months: ["H", "M", "U", "Z"] },
|
|
32600
|
-
ZT: { exchange: "CBOT", months: ["H", "M", "U", "Z"] }
|
|
32601
|
-
};
|
|
32602
|
-
var MC_INDEX = {
|
|
32603
|
-
F: 0,
|
|
32604
|
-
G: 1,
|
|
32605
|
-
H: 2,
|
|
32606
|
-
J: 3,
|
|
32607
|
-
K: 4,
|
|
32608
|
-
M: 5,
|
|
32609
|
-
N: 6,
|
|
32610
|
-
Q: 7,
|
|
32611
|
-
U: 8,
|
|
32612
|
-
V: 9,
|
|
32613
|
-
X: 10,
|
|
32614
|
-
Z: 11
|
|
32615
|
-
};
|
|
32616
|
-
function parseContractInfo(symbol) {
|
|
32617
|
-
let input = symbol.trim().toUpperCase();
|
|
32618
|
-
let exchangeHint;
|
|
32619
|
-
if (input.includes(":")) {
|
|
32620
|
-
const colon = input.indexOf(":");
|
|
32621
|
-
exchangeHint = input.slice(0, colon);
|
|
32622
|
-
input = input.slice(colon + 1);
|
|
32623
|
-
}
|
|
32624
|
-
const contMatch = input.match(/^([A-Z0-9]+?)(\d+)!$/);
|
|
32625
|
-
if (contMatch) {
|
|
32626
|
-
const product = contMatch[1];
|
|
32627
|
-
const info = PRODUCTS[product];
|
|
32628
|
-
if (!info) return null;
|
|
32629
|
-
const exchange = exchangeHint ?? info.exchange;
|
|
32630
|
-
const front = _guessFrontMonth(product, info.months);
|
|
32631
|
-
return {
|
|
32632
|
-
isContinuous: true,
|
|
32633
|
-
product,
|
|
32634
|
-
exchange,
|
|
32635
|
-
frontMonthContract: `${exchange}:${front}`,
|
|
32636
|
-
continuousSymbol: `${exchange}:${product}1!`,
|
|
32637
|
-
availableMonths: info.months
|
|
32638
|
-
};
|
|
32639
|
-
}
|
|
32640
|
-
const specificMatch = input.match(/^([A-Z0-9]+?)([FGHJKMNQUVXZ])(\d{1,4})$/);
|
|
32641
|
-
if (specificMatch) {
|
|
32642
|
-
const product = specificMatch[1];
|
|
32643
|
-
const info = PRODUCTS[product];
|
|
32644
|
-
if (!info) return null;
|
|
32645
|
-
const exchange = exchangeHint ?? info.exchange;
|
|
32646
|
-
const front = _guessFrontMonth(product, info.months);
|
|
32647
|
-
return {
|
|
32648
|
-
isContinuous: false,
|
|
32649
|
-
product,
|
|
32650
|
-
exchange,
|
|
32651
|
-
frontMonthContract: `${exchange}:${front}`,
|
|
32652
|
-
continuousSymbol: `${exchange}:${product}1!`,
|
|
32653
|
-
availableMonths: info.months
|
|
32654
|
-
};
|
|
32655
|
-
}
|
|
32656
|
-
if (PRODUCTS[input]) {
|
|
32657
|
-
const info = PRODUCTS[input];
|
|
32658
|
-
const exchange = exchangeHint ?? info.exchange;
|
|
32659
|
-
const front = _guessFrontMonth(input, info.months);
|
|
32660
|
-
return {
|
|
32661
|
-
isContinuous: false,
|
|
32662
|
-
product: input,
|
|
32663
|
-
exchange,
|
|
32664
|
-
frontMonthContract: `${exchange}:${front}`,
|
|
32665
|
-
continuousSymbol: `${exchange}:${input}1!`,
|
|
32666
|
-
availableMonths: info.months
|
|
32667
|
-
};
|
|
32668
|
-
}
|
|
32669
|
-
return null;
|
|
32670
|
-
}
|
|
32671
|
-
function getUpcomingContracts(product, exchange, months, count = 6) {
|
|
32672
|
-
const now = /* @__PURE__ */ new Date();
|
|
32673
|
-
const currentMonth = now.getMonth();
|
|
32674
|
-
const currentYear = now.getFullYear();
|
|
32675
|
-
const contracts = [];
|
|
32676
|
-
for (let yearOffset = 0; yearOffset <= 2 && contracts.length < count; yearOffset++) {
|
|
32677
|
-
const year = currentYear + yearOffset;
|
|
32678
|
-
for (const mc of months) {
|
|
32679
|
-
if (contracts.length >= count) break;
|
|
32680
|
-
const monthIdx = MC_INDEX[mc];
|
|
32681
|
-
if (monthIdx === void 0) continue;
|
|
32682
|
-
if (year === currentYear && monthIdx < currentMonth) continue;
|
|
32683
|
-
contracts.push(`${exchange}:${product}${mc}${year}`);
|
|
32684
|
-
}
|
|
32685
|
-
}
|
|
32686
|
-
return contracts;
|
|
32687
|
-
}
|
|
32688
|
-
function _guessFrontMonth(product, months) {
|
|
32689
|
-
const now = /* @__PURE__ */ new Date();
|
|
32690
|
-
const currentMonth = now.getMonth();
|
|
32691
|
-
const currentYear = now.getFullYear();
|
|
32692
|
-
for (const mc of months) {
|
|
32693
|
-
const monthIdx = MC_INDEX[mc];
|
|
32694
|
-
if (monthIdx === void 0) continue;
|
|
32695
|
-
if (monthIdx >= currentMonth) {
|
|
32696
|
-
return `${product}${mc}${currentYear}`;
|
|
32697
|
-
}
|
|
32698
|
-
}
|
|
32699
|
-
return `${product}${months[0]}${currentYear + 1}`;
|
|
32700
|
-
}
|
|
32701
|
-
|
|
32702
32703
|
// src/react/agent/CommandDispatcher.ts
|
|
32703
32704
|
var CommandDispatcher = class {
|
|
32704
32705
|
constructor(chart) {
|