fixparser-plugin-mcp 9.1.7-70d519a1 → 9.1.7-74db6dbc
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/build/cjs/MCPLocal.js +251 -20
- package/build/cjs/MCPLocal.js.map +2 -2
- package/build/cjs/MCPRemote.js +251 -20
- package/build/cjs/MCPRemote.js.map +2 -2
- package/build/cjs/index.js +251 -20
- package/build/cjs/index.js.map +2 -2
- package/build/esm/MCPLocal.mjs +251 -20
- package/build/esm/MCPLocal.mjs.map +2 -2
- package/build/esm/MCPRemote.mjs +251 -20
- package/build/esm/MCPRemote.mjs.map +2 -2
- package/build/esm/index.mjs +251 -20
- package/build/esm/index.mjs.map +2 -2
- package/build-examples/cjs/example_mcp_local.js +7 -7
- package/build-examples/cjs/example_mcp_local.js.map +3 -3
- package/build-examples/cjs/example_mcp_remote.js +4 -4
- package/build-examples/cjs/example_mcp_remote.js.map +3 -3
- package/build-examples/esm/example_mcp_local.mjs +7 -7
- package/build-examples/esm/example_mcp_local.mjs.map +3 -3
- package/build-examples/esm/example_mcp_remote.mjs +6 -6
- package/build-examples/esm/example_mcp_remote.mjs.map +3 -3
- package/package.json +2 -2
package/build/cjs/MCPRemote.js
CHANGED
|
@@ -417,7 +417,7 @@ var TechnicalAnalyzer = class {
|
|
|
417
417
|
return maxDrawdown;
|
|
418
418
|
}
|
|
419
419
|
// Calculate Average True Range (ATR)
|
|
420
|
-
calculateAtr(prices, highs, lows
|
|
420
|
+
calculateAtr(prices, highs, lows) {
|
|
421
421
|
if (prices.length < 2) return [];
|
|
422
422
|
const trueRanges = [];
|
|
423
423
|
for (let i = 1; i < prices.length; i++) {
|
|
@@ -528,45 +528,272 @@ var TechnicalAnalyzer = class {
|
|
|
528
528
|
}
|
|
529
529
|
return macd;
|
|
530
530
|
}
|
|
531
|
-
// Calculate ADX
|
|
531
|
+
// Calculate ADX (Average Directional Index)
|
|
532
532
|
calculateAdx(prices, highs, lows) {
|
|
533
|
+
if (prices.length < 14) return [];
|
|
534
|
+
const period = 14;
|
|
533
535
|
const adx = [];
|
|
534
|
-
|
|
535
|
-
|
|
536
|
+
const trueRanges = [];
|
|
537
|
+
const plusDM = [];
|
|
538
|
+
const minusDM = [];
|
|
539
|
+
trueRanges.push(highs[0] - lows[0]);
|
|
540
|
+
plusDM.push(0);
|
|
541
|
+
minusDM.push(0);
|
|
542
|
+
for (let i = 1; i < prices.length; i++) {
|
|
543
|
+
const high = highs[i] || prices[i];
|
|
544
|
+
const low = lows[i] || prices[i];
|
|
545
|
+
const prevHigh = highs[i - 1] || prices[i - 1];
|
|
546
|
+
const prevLow = lows[i - 1] || prices[i - 1];
|
|
547
|
+
const prevClose = prices[i - 1];
|
|
548
|
+
const tr1 = high - low;
|
|
549
|
+
const tr2 = Math.abs(high - prevClose);
|
|
550
|
+
const tr3 = Math.abs(low - prevClose);
|
|
551
|
+
trueRanges.push(Math.max(tr1, tr2, tr3));
|
|
552
|
+
const upMove = high - prevHigh;
|
|
553
|
+
const downMove = prevLow - low;
|
|
554
|
+
if (upMove > downMove && upMove > 0) {
|
|
555
|
+
plusDM.push(upMove);
|
|
556
|
+
minusDM.push(0);
|
|
557
|
+
} else if (downMove > upMove && downMove > 0) {
|
|
558
|
+
plusDM.push(0);
|
|
559
|
+
minusDM.push(downMove);
|
|
560
|
+
} else {
|
|
561
|
+
plusDM.push(0);
|
|
562
|
+
minusDM.push(0);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
const smoothedTR = [];
|
|
566
|
+
const smoothedPlusDM = [];
|
|
567
|
+
const smoothedMinusDM = [];
|
|
568
|
+
let sumTR = 0;
|
|
569
|
+
let sumPlusDM = 0;
|
|
570
|
+
let sumMinusDM = 0;
|
|
571
|
+
for (let i = 0; i < period; i++) {
|
|
572
|
+
sumTR += trueRanges[i];
|
|
573
|
+
sumPlusDM += plusDM[i];
|
|
574
|
+
sumMinusDM += minusDM[i];
|
|
575
|
+
}
|
|
576
|
+
smoothedTR.push(sumTR);
|
|
577
|
+
smoothedPlusDM.push(sumPlusDM);
|
|
578
|
+
smoothedMinusDM.push(sumMinusDM);
|
|
579
|
+
for (let i = period; i < trueRanges.length; i++) {
|
|
580
|
+
const newTR = smoothedTR[smoothedTR.length - 1] - smoothedTR[smoothedTR.length - 1] / period + trueRanges[i];
|
|
581
|
+
const newPlusDM = smoothedPlusDM[smoothedPlusDM.length - 1] - smoothedPlusDM[smoothedPlusDM.length - 1] / period + plusDM[i];
|
|
582
|
+
const newMinusDM = smoothedMinusDM[smoothedMinusDM.length - 1] - smoothedMinusDM[smoothedMinusDM.length - 1] / period + minusDM[i];
|
|
583
|
+
smoothedTR.push(newTR);
|
|
584
|
+
smoothedPlusDM.push(newPlusDM);
|
|
585
|
+
smoothedMinusDM.push(newMinusDM);
|
|
586
|
+
}
|
|
587
|
+
const plusDI = [];
|
|
588
|
+
const minusDI = [];
|
|
589
|
+
for (let i = 0; i < smoothedTR.length; i++) {
|
|
590
|
+
plusDI.push(smoothedPlusDM[i] / smoothedTR[i] * 100);
|
|
591
|
+
minusDI.push(smoothedMinusDM[i] / smoothedTR[i] * 100);
|
|
592
|
+
}
|
|
593
|
+
const dx = [];
|
|
594
|
+
for (let i = 0; i < plusDI.length; i++) {
|
|
595
|
+
const diSum = plusDI[i] + minusDI[i];
|
|
596
|
+
const diDiff = Math.abs(plusDI[i] - minusDI[i]);
|
|
597
|
+
dx.push(diSum > 0 ? diDiff / diSum * 100 : 0);
|
|
598
|
+
}
|
|
599
|
+
if (dx.length < period) return [];
|
|
600
|
+
let sumDX = 0;
|
|
601
|
+
for (let i = 0; i < period; i++) {
|
|
602
|
+
sumDX += dx[i];
|
|
603
|
+
}
|
|
604
|
+
adx.push(sumDX / period);
|
|
605
|
+
for (let i = period; i < dx.length; i++) {
|
|
606
|
+
const newADX = adx[adx.length - 1] - adx[adx.length - 1] / period + dx[i];
|
|
607
|
+
adx.push(newADX);
|
|
536
608
|
}
|
|
537
609
|
return adx;
|
|
538
610
|
}
|
|
539
|
-
// Calculate DMI
|
|
611
|
+
// Calculate DMI (Directional Movement Index)
|
|
540
612
|
calculateDmi(prices, highs, lows) {
|
|
613
|
+
if (prices.length < 14) return [];
|
|
614
|
+
const period = 14;
|
|
541
615
|
const dmi = [];
|
|
542
|
-
|
|
616
|
+
const trueRanges = [];
|
|
617
|
+
const plusDM = [];
|
|
618
|
+
const minusDM = [];
|
|
619
|
+
trueRanges.push(highs[0] - lows[0]);
|
|
620
|
+
plusDM.push(0);
|
|
621
|
+
minusDM.push(0);
|
|
622
|
+
for (let i = 1; i < prices.length; i++) {
|
|
623
|
+
const high = highs[i] || prices[i];
|
|
624
|
+
const low = lows[i] || prices[i];
|
|
625
|
+
const prevHigh = highs[i - 1] || prices[i - 1];
|
|
626
|
+
const prevLow = lows[i - 1] || prices[i - 1];
|
|
627
|
+
const prevClose = prices[i - 1];
|
|
628
|
+
const tr1 = high - low;
|
|
629
|
+
const tr2 = Math.abs(high - prevClose);
|
|
630
|
+
const tr3 = Math.abs(low - prevClose);
|
|
631
|
+
trueRanges.push(Math.max(tr1, tr2, tr3));
|
|
632
|
+
const upMove = high - prevHigh;
|
|
633
|
+
const downMove = prevLow - low;
|
|
634
|
+
if (upMove > downMove && upMove > 0) {
|
|
635
|
+
plusDM.push(upMove);
|
|
636
|
+
minusDM.push(0);
|
|
637
|
+
} else if (downMove > upMove && downMove > 0) {
|
|
638
|
+
plusDM.push(0);
|
|
639
|
+
minusDM.push(downMove);
|
|
640
|
+
} else {
|
|
641
|
+
plusDM.push(0);
|
|
642
|
+
minusDM.push(0);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
const smoothedTR = [];
|
|
646
|
+
const smoothedPlusDM = [];
|
|
647
|
+
const smoothedMinusDM = [];
|
|
648
|
+
let sumTR = 0;
|
|
649
|
+
let sumPlusDM = 0;
|
|
650
|
+
let sumMinusDM = 0;
|
|
651
|
+
for (let i = 0; i < period; i++) {
|
|
652
|
+
sumTR += trueRanges[i];
|
|
653
|
+
sumPlusDM += plusDM[i];
|
|
654
|
+
sumMinusDM += minusDM[i];
|
|
655
|
+
}
|
|
656
|
+
smoothedTR.push(sumTR);
|
|
657
|
+
smoothedPlusDM.push(sumPlusDM);
|
|
658
|
+
smoothedMinusDM.push(sumMinusDM);
|
|
659
|
+
for (let i = period; i < trueRanges.length; i++) {
|
|
660
|
+
const newTR = smoothedTR[smoothedTR.length - 1] - smoothedTR[smoothedTR.length - 1] / period + trueRanges[i];
|
|
661
|
+
const newPlusDM = smoothedPlusDM[smoothedPlusDM.length - 1] - smoothedPlusDM[smoothedPlusDM.length - 1] / period + plusDM[i];
|
|
662
|
+
const newMinusDM = smoothedMinusDM[smoothedMinusDM.length - 1] - smoothedMinusDM[smoothedMinusDM.length - 1] / period + minusDM[i];
|
|
663
|
+
smoothedTR.push(newTR);
|
|
664
|
+
smoothedPlusDM.push(newPlusDM);
|
|
665
|
+
smoothedMinusDM.push(newMinusDM);
|
|
666
|
+
}
|
|
667
|
+
const plusDI = [];
|
|
668
|
+
const minusDI = [];
|
|
669
|
+
for (let i = 0; i < smoothedTR.length; i++) {
|
|
670
|
+
plusDI.push(smoothedPlusDM[i] / smoothedTR[i] * 100);
|
|
671
|
+
minusDI.push(smoothedMinusDM[i] / smoothedTR[i] * 100);
|
|
672
|
+
}
|
|
673
|
+
const dx = [];
|
|
674
|
+
for (let i = 0; i < plusDI.length; i++) {
|
|
675
|
+
const diSum = plusDI[i] + minusDI[i];
|
|
676
|
+
const diDiff = Math.abs(plusDI[i] - minusDI[i]);
|
|
677
|
+
dx.push(diSum > 0 ? diDiff / diSum * 100 : 0);
|
|
678
|
+
}
|
|
679
|
+
if (dx.length < period) return [];
|
|
680
|
+
const adx = [];
|
|
681
|
+
let sumDX = 0;
|
|
682
|
+
for (let i = 0; i < period; i++) {
|
|
683
|
+
sumDX += dx[i];
|
|
684
|
+
}
|
|
685
|
+
adx.push(sumDX / period);
|
|
686
|
+
for (let i = period; i < dx.length; i++) {
|
|
687
|
+
const newADX = adx[adx.length - 1] - adx[adx.length - 1] / period + dx[i];
|
|
688
|
+
adx.push(newADX);
|
|
689
|
+
}
|
|
690
|
+
for (let i = 0; i < adx.length; i++) {
|
|
543
691
|
dmi.push({
|
|
544
|
-
plusDI:
|
|
545
|
-
minusDI:
|
|
546
|
-
adx:
|
|
692
|
+
plusDI: plusDI[i + period - 1] || 0,
|
|
693
|
+
minusDI: minusDI[i + period - 1] || 0,
|
|
694
|
+
adx: adx[i]
|
|
547
695
|
});
|
|
548
696
|
}
|
|
549
697
|
return dmi;
|
|
550
698
|
}
|
|
551
699
|
// Calculate Ichimoku Cloud
|
|
552
700
|
calculateIchimoku(prices, highs, lows) {
|
|
701
|
+
if (prices.length < 52) return [];
|
|
553
702
|
const ichimoku = [];
|
|
703
|
+
const tenkanSen = [];
|
|
704
|
+
for (let i = 8; i < prices.length; i++) {
|
|
705
|
+
const periodHigh = Math.max(...highs.slice(i - 8, i + 1));
|
|
706
|
+
const periodLow = Math.min(...lows.slice(i - 8, i + 1));
|
|
707
|
+
tenkanSen.push((periodHigh + periodLow) / 2);
|
|
708
|
+
}
|
|
709
|
+
const kijunSen = [];
|
|
710
|
+
for (let i = 25; i < prices.length; i++) {
|
|
711
|
+
const periodHigh = Math.max(...highs.slice(i - 25, i + 1));
|
|
712
|
+
const periodLow = Math.min(...lows.slice(i - 25, i + 1));
|
|
713
|
+
kijunSen.push((periodHigh + periodLow) / 2);
|
|
714
|
+
}
|
|
715
|
+
const senkouSpanA = [];
|
|
716
|
+
for (let i = 0; i < Math.min(tenkanSen.length, kijunSen.length); i++) {
|
|
717
|
+
senkouSpanA.push((tenkanSen[i] + kijunSen[i]) / 2);
|
|
718
|
+
}
|
|
719
|
+
const senkouSpanB = [];
|
|
720
|
+
for (let i = 51; i < prices.length; i++) {
|
|
721
|
+
const periodHigh = Math.max(...highs.slice(i - 51, i + 1));
|
|
722
|
+
const periodLow = Math.min(...lows.slice(i - 51, i + 1));
|
|
723
|
+
senkouSpanB.push((periodHigh + periodLow) / 2);
|
|
724
|
+
}
|
|
725
|
+
const chikouSpan = [];
|
|
554
726
|
for (let i = 26; i < prices.length; i++) {
|
|
727
|
+
chikouSpan.push(prices[i - 26]);
|
|
728
|
+
}
|
|
729
|
+
const minLength = Math.min(
|
|
730
|
+
tenkanSen.length,
|
|
731
|
+
kijunSen.length,
|
|
732
|
+
senkouSpanA.length,
|
|
733
|
+
senkouSpanB.length,
|
|
734
|
+
chikouSpan.length
|
|
735
|
+
);
|
|
736
|
+
for (let i = 0; i < minLength; i++) {
|
|
555
737
|
ichimoku.push({
|
|
556
|
-
tenkan:
|
|
557
|
-
kijun:
|
|
558
|
-
senkouA:
|
|
559
|
-
senkouB:
|
|
560
|
-
chikou:
|
|
738
|
+
tenkan: tenkanSen[i],
|
|
739
|
+
kijun: kijunSen[i],
|
|
740
|
+
senkouA: senkouSpanA[i],
|
|
741
|
+
senkouB: senkouSpanB[i],
|
|
742
|
+
chikou: chikouSpan[i]
|
|
561
743
|
});
|
|
562
744
|
}
|
|
563
745
|
return ichimoku;
|
|
564
746
|
}
|
|
565
747
|
// Calculate Parabolic SAR
|
|
566
748
|
calculateParabolicSAR(prices, highs, lows) {
|
|
749
|
+
if (prices.length < 2) return [];
|
|
567
750
|
const sar = [];
|
|
568
|
-
|
|
569
|
-
|
|
751
|
+
const accelerationFactor = 0.02;
|
|
752
|
+
const maximumAcceleration = 0.2;
|
|
753
|
+
let currentSAR = lows[0];
|
|
754
|
+
let isLong = true;
|
|
755
|
+
let af = accelerationFactor;
|
|
756
|
+
let ep = highs[0];
|
|
757
|
+
sar.push(currentSAR);
|
|
758
|
+
for (let i = 1; i < prices.length; i++) {
|
|
759
|
+
const high = highs[i] || prices[i];
|
|
760
|
+
const low = lows[i] || prices[i];
|
|
761
|
+
if (isLong) {
|
|
762
|
+
if (low < currentSAR) {
|
|
763
|
+
isLong = false;
|
|
764
|
+
currentSAR = ep;
|
|
765
|
+
ep = low;
|
|
766
|
+
af = accelerationFactor;
|
|
767
|
+
} else {
|
|
768
|
+
if (high > ep) {
|
|
769
|
+
ep = high;
|
|
770
|
+
af = Math.min(af + accelerationFactor, maximumAcceleration);
|
|
771
|
+
}
|
|
772
|
+
currentSAR = currentSAR + af * (ep - currentSAR);
|
|
773
|
+
if (i > 0) {
|
|
774
|
+
const prevLow = lows[i - 1] || prices[i - 1];
|
|
775
|
+
currentSAR = Math.min(currentSAR, prevLow);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
} else {
|
|
779
|
+
if (high > currentSAR) {
|
|
780
|
+
isLong = true;
|
|
781
|
+
currentSAR = ep;
|
|
782
|
+
ep = high;
|
|
783
|
+
af = accelerationFactor;
|
|
784
|
+
} else {
|
|
785
|
+
if (low < ep) {
|
|
786
|
+
ep = low;
|
|
787
|
+
af = Math.min(af + accelerationFactor, maximumAcceleration);
|
|
788
|
+
}
|
|
789
|
+
currentSAR = currentSAR + af * (ep - currentSAR);
|
|
790
|
+
if (i > 0) {
|
|
791
|
+
const prevHigh = highs[i - 1] || prices[i - 1];
|
|
792
|
+
currentSAR = Math.max(currentSAR, prevHigh);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
sar.push(currentSAR);
|
|
570
797
|
}
|
|
571
798
|
return sar;
|
|
572
799
|
}
|
|
@@ -909,7 +1136,7 @@ var TechnicalAnalyzer = class {
|
|
|
909
1136
|
const momentum5 = this.prices.length > 5 ? (currentPrice - this.prices[Math.max(0, this.prices.length - 6)]) / this.prices[Math.max(0, this.prices.length - 6)] * 100 : 0;
|
|
910
1137
|
const momentum10 = this.prices.length > 10 ? (currentPrice - this.prices[Math.max(0, this.prices.length - 11)]) / this.prices[Math.max(0, this.prices.length - 11)] * 100 : 0;
|
|
911
1138
|
const maxDrawdown = this.calculateMaxDrawdown(this.prices);
|
|
912
|
-
const atrValues = this.calculateAtr(this.prices, this.highs, this.lows
|
|
1139
|
+
const atrValues = this.calculateAtr(this.prices, this.highs, this.lows);
|
|
913
1140
|
const atr = atrValues.length > 0 ? atrValues[atrValues.length - 1] : 0;
|
|
914
1141
|
const impliedVolatility = volatility;
|
|
915
1142
|
const realizedVolatility = volatility;
|
|
@@ -970,7 +1197,7 @@ var TechnicalAnalyzer = class {
|
|
|
970
1197
|
williamsR: this.calculateWilliamsR(this.prices),
|
|
971
1198
|
momentum: this.calculateMomentum(this.prices),
|
|
972
1199
|
bollinger: this.calculateBollingerBands(this.prices, 20, 2),
|
|
973
|
-
atr: this.calculateAtr(this.prices, this.highs, this.lows
|
|
1200
|
+
atr: this.calculateAtr(this.prices, this.highs, this.lows),
|
|
974
1201
|
keltner: this.calculateKeltnerChannels(this.prices, this.highs, this.lows),
|
|
975
1202
|
donchian: this.calculateDonchianChannels(this.prices, this.highs, this.lows),
|
|
976
1203
|
chaikinVolatility: this.calculateChaikinVolatility(this.prices, this.highs, this.lows),
|
|
@@ -1669,6 +1896,7 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
|
|
|
1669
1896
|
]
|
|
1670
1897
|
};
|
|
1671
1898
|
}
|
|
1899
|
+
const aggregatedData = aggregateMarketData(priceHistory, 500);
|
|
1672
1900
|
return {
|
|
1673
1901
|
content: [
|
|
1674
1902
|
{
|
|
@@ -1676,8 +1904,9 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
|
|
|
1676
1904
|
text: JSON.stringify(
|
|
1677
1905
|
{
|
|
1678
1906
|
symbol,
|
|
1679
|
-
count:
|
|
1680
|
-
|
|
1907
|
+
count: aggregatedData.length,
|
|
1908
|
+
originalCount: priceHistory.length,
|
|
1909
|
+
data: aggregatedData.map((point) => ({
|
|
1681
1910
|
timestamp: new Date(point.timestamp).toISOString(),
|
|
1682
1911
|
bid: point.bid,
|
|
1683
1912
|
offer: point.offer,
|
|
@@ -1819,6 +2048,7 @@ var handlInstNames = {
|
|
|
1819
2048
|
};
|
|
1820
2049
|
var createVerifyOrderHandler = (parser, verifiedOrders) => {
|
|
1821
2050
|
return async (args) => {
|
|
2051
|
+
void parser;
|
|
1822
2052
|
try {
|
|
1823
2053
|
verifiedOrders.set(args.clOrdID, {
|
|
1824
2054
|
clOrdID: args.clOrdID,
|
|
@@ -2052,6 +2282,7 @@ function getEnumValue(enumObj, name) {
|
|
|
2052
2282
|
return enumObj[name] || name;
|
|
2053
2283
|
}
|
|
2054
2284
|
function handleMessage(message, parser, pendingRequests, marketDataPrices, maxPriceHistory, onPriceUpdate) {
|
|
2285
|
+
void parser;
|
|
2055
2286
|
const msgType = message.messageType;
|
|
2056
2287
|
if (msgType === import_fixparser3.Messages.MarketDataSnapshotFullRefresh || msgType === import_fixparser3.Messages.MarketDataIncrementalRefresh) {
|
|
2057
2288
|
const symbol = message.getField(import_fixparser3.Fields.Symbol)?.value;
|