fixparser-plugin-mcp 9.1.7-c415bb75 → 9.1.7-c6228661

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.
Files changed (35) hide show
  1. package/build/cjs/MCPLocal.js +422 -10
  2. package/build/cjs/MCPLocal.js.map +4 -4
  3. package/build/cjs/MCPRemote.js +422 -66
  4. package/build/cjs/MCPRemote.js.map +4 -4
  5. package/build/cjs/index.js +422 -66
  6. package/build/cjs/index.js.map +4 -4
  7. package/build/esm/MCPLocal.mjs +422 -10
  8. package/build/esm/MCPLocal.mjs.map +4 -4
  9. package/build/esm/MCPRemote.mjs +422 -66
  10. package/build/esm/MCPRemote.mjs.map +4 -4
  11. package/build/esm/index.mjs +422 -66
  12. package/build/esm/index.mjs.map +4 -4
  13. package/build-examples/cjs/example_mcp_local.js +9 -7
  14. package/build-examples/cjs/example_mcp_local.js.map +4 -4
  15. package/build-examples/cjs/example_mcp_remote.js +9 -7
  16. package/build-examples/cjs/example_mcp_remote.js.map +4 -4
  17. package/build-examples/esm/example_mcp_local.mjs +9 -7
  18. package/build-examples/esm/example_mcp_local.mjs.map +4 -4
  19. package/build-examples/esm/example_mcp_remote.mjs +9 -7
  20. package/build-examples/esm/example_mcp_remote.mjs.map +4 -4
  21. package/package.json +2 -2
  22. package/types/MCPBase.d.ts +0 -49
  23. package/types/MCPLocal.d.ts +0 -32
  24. package/types/MCPRemote.d.ts +0 -58
  25. package/types/PluginOptions.d.ts +0 -6
  26. package/types/index.d.ts +0 -3
  27. package/types/schemas/index.d.ts +0 -15
  28. package/types/schemas/marketData.d.ts +0 -48
  29. package/types/schemas/schemas.d.ts +0 -168
  30. package/types/tools/index.d.ts +0 -17
  31. package/types/tools/marketData.d.ts +0 -40
  32. package/types/tools/order.d.ts +0 -12
  33. package/types/tools/parse.d.ts +0 -5
  34. package/types/tools/parseToJSON.d.ts +0 -5
  35. package/types/utils/messageHandler.d.ts +0 -12
@@ -307,8 +307,331 @@ var toolSchemas = {
307
307
  },
308
308
  required: ["symbol"]
309
309
  }
310
+ },
311
+ technicalAnalysis: {
312
+ description: "Performs comprehensive technical analysis on market data for a given symbol, including indicators like SMA, EMA, RSI, Bollinger Bands, and trading signals",
313
+ schema: {
314
+ type: "object",
315
+ properties: {
316
+ symbol: {
317
+ type: "string",
318
+ description: "The trading symbol to analyze (e.g., AAPL, MSFT, EURUSD)"
319
+ }
320
+ },
321
+ required: ["symbol"]
322
+ }
323
+ }
324
+ };
325
+
326
+ // src/tools/analytics.ts
327
+ function sum(numbers) {
328
+ return numbers.reduce((acc, val) => acc + val, 0);
329
+ }
330
+ var TechnicalAnalyzer = class {
331
+ prices;
332
+ volumes;
333
+ highs;
334
+ lows;
335
+ constructor(data) {
336
+ this.prices = data.map((d) => d.trade > 0 ? d.trade : d.midPrice);
337
+ this.volumes = data.map((d) => d.volume);
338
+ this.highs = data.map((d) => d.tradingSessionHighPrice > 0 ? d.tradingSessionHighPrice : d.trade);
339
+ this.lows = data.map((d) => d.tradingSessionLowPrice > 0 ? d.tradingSessionLowPrice : d.trade);
340
+ }
341
+ // Calculate Simple Moving Average
342
+ calculateSMA(data, period) {
343
+ const sma = [];
344
+ for (let i = period - 1; i < data.length; i++) {
345
+ const sum2 = data.slice(i - period + 1, i + 1).reduce((a, b) => a + b, 0);
346
+ sma.push(sum2 / period);
347
+ }
348
+ return sma;
349
+ }
350
+ // Calculate Exponential Moving Average
351
+ calculateEMA(data, period) {
352
+ const multiplier = 2 / (period + 1);
353
+ const ema = [data[0]];
354
+ for (let i = 1; i < data.length; i++) {
355
+ ema.push(data[i] * multiplier + ema[i - 1] * (1 - multiplier));
356
+ }
357
+ return ema;
358
+ }
359
+ // Calculate RSI
360
+ calculateRSI(data, period = 14) {
361
+ if (data.length < period + 1) return [];
362
+ const changes = [];
363
+ for (let i = 1; i < data.length; i++) {
364
+ changes.push(data[i] - data[i - 1]);
365
+ }
366
+ const gains = changes.map((change) => change > 0 ? change : 0);
367
+ const losses = changes.map((change) => change < 0 ? Math.abs(change) : 0);
368
+ let avgGain = gains.slice(0, period).reduce((a, b) => a + b, 0) / period;
369
+ let avgLoss = losses.slice(0, period).reduce((a, b) => a + b, 0) / period;
370
+ const rsi = [];
371
+ for (let i = period; i < changes.length; i++) {
372
+ const rs = avgGain / avgLoss;
373
+ rsi.push(100 - 100 / (1 + rs));
374
+ avgGain = (avgGain * (period - 1) + gains[i]) / period;
375
+ avgLoss = (avgLoss * (period - 1) + losses[i]) / period;
376
+ }
377
+ return rsi;
378
+ }
379
+ // Calculate Bollinger Bands
380
+ calculateBollingerBands(data, period = 20, stdDev = 2) {
381
+ if (data.length < period) return [];
382
+ const sma = this.calculateSMA(data, period);
383
+ const bands = [];
384
+ for (let i = 0; i < sma.length; i++) {
385
+ const dataSlice = data.slice(i, i + period);
386
+ const mean = sma[i];
387
+ const variance = dataSlice.reduce((sum2, price) => sum2 + (price - mean) ** 2, 0) / period;
388
+ const standardDeviation = Math.sqrt(variance);
389
+ bands.push({
390
+ upper: mean + standardDeviation * stdDev,
391
+ middle: mean,
392
+ lower: mean - standardDeviation * stdDev
393
+ });
394
+ }
395
+ return bands;
396
+ }
397
+ // Calculate maximum drawdown
398
+ calculateMaxDrawdown(prices) {
399
+ let maxPrice = prices[0];
400
+ let maxDrawdown = 0;
401
+ for (let i = 1; i < prices.length; i++) {
402
+ if (prices[i] > maxPrice) {
403
+ maxPrice = prices[i];
404
+ }
405
+ const drawdown = (maxPrice - prices[i]) / maxPrice;
406
+ if (drawdown > maxDrawdown) {
407
+ maxDrawdown = drawdown;
408
+ }
409
+ }
410
+ return maxDrawdown;
411
+ }
412
+ // Calculate price changes for volatility
413
+ calculatePriceChanges() {
414
+ const changes = [];
415
+ for (let i = 1; i < this.prices.length; i++) {
416
+ changes.push((this.prices[i] - this.prices[i - 1]) / this.prices[i - 1]);
417
+ }
418
+ return changes;
419
+ }
420
+ // Generate comprehensive market analysis
421
+ analyze() {
422
+ const currentPrice = this.prices[this.prices.length - 1];
423
+ const startPrice = this.prices[0];
424
+ const sessionHigh = Math.max(...this.highs);
425
+ const sessionLow = Math.min(...this.lows);
426
+ const totalVolume = sum(this.volumes);
427
+ const avgVolume = totalVolume / this.volumes.length;
428
+ const priceChanges = this.calculatePriceChanges();
429
+ const volatility = priceChanges.length > 0 ? Math.sqrt(
430
+ priceChanges.reduce((sum2, change) => sum2 + change ** 2, 0) / priceChanges.length
431
+ ) * Math.sqrt(252) * 100 : 0;
432
+ const sessionReturn = (currentPrice - startPrice) / startPrice * 100;
433
+ const pricePosition = (currentPrice - sessionLow) / (sessionHigh - sessionLow) * 100;
434
+ const trueVWAP = this.prices.reduce((sum2, price, i) => sum2 + price * this.volumes[i], 0) / totalVolume;
435
+ 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;
436
+ 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;
437
+ const maxDrawdown = this.calculateMaxDrawdown(this.prices);
438
+ return {
439
+ currentPrice,
440
+ startPrice,
441
+ sessionHigh,
442
+ sessionLow,
443
+ totalVolume,
444
+ avgVolume,
445
+ volatility,
446
+ sessionReturn,
447
+ pricePosition,
448
+ trueVWAP,
449
+ momentum5,
450
+ momentum10,
451
+ maxDrawdown
452
+ };
453
+ }
454
+ // Generate technical indicators
455
+ getTechnicalIndicators() {
456
+ return {
457
+ sma5: this.calculateSMA(this.prices, 5),
458
+ sma10: this.calculateSMA(this.prices, 10),
459
+ ema8: this.calculateEMA(this.prices, 8),
460
+ ema21: this.calculateEMA(this.prices, 21),
461
+ rsi: this.calculateRSI(this.prices, 14),
462
+ bollinger: this.calculateBollingerBands(this.prices, 20, 2)
463
+ };
464
+ }
465
+ // Generate trading signals
466
+ generateSignals() {
467
+ const analysis = this.analyze();
468
+ let bullishSignals = 0;
469
+ let bearishSignals = 0;
470
+ const signals = [];
471
+ if (analysis.currentPrice > analysis.trueVWAP) {
472
+ signals.push(
473
+ `\u2713 BULLISH: Price above VWAP (+${((analysis.currentPrice - analysis.trueVWAP) / analysis.trueVWAP * 100).toFixed(2)}%)`
474
+ );
475
+ bullishSignals++;
476
+ } else {
477
+ signals.push(
478
+ `\u2717 BEARISH: Price below VWAP (${((analysis.currentPrice - analysis.trueVWAP) / analysis.trueVWAP * 100).toFixed(2)}%)`
479
+ );
480
+ bearishSignals++;
481
+ }
482
+ if (analysis.momentum5 > 0 && analysis.momentum10 > 0) {
483
+ signals.push("\u2713 BULLISH: Positive momentum on both timeframes");
484
+ bullishSignals++;
485
+ } else if (analysis.momentum5 < 0 && analysis.momentum10 < 0) {
486
+ signals.push("\u2717 BEARISH: Negative momentum on both timeframes");
487
+ bearishSignals++;
488
+ } else {
489
+ signals.push("\u25D0 MIXED: Conflicting momentum signals");
490
+ }
491
+ const currentVolume = this.volumes[this.volumes.length - 1];
492
+ const volumeRatio = currentVolume / analysis.avgVolume;
493
+ if (volumeRatio > 1.2 && analysis.sessionReturn > 0) {
494
+ signals.push("\u2713 BULLISH: Above-average volume supporting upward move");
495
+ bullishSignals++;
496
+ } else if (volumeRatio > 1.2 && analysis.sessionReturn < 0) {
497
+ signals.push("\u2717 BEARISH: Above-average volume supporting downward move");
498
+ bearishSignals++;
499
+ } else {
500
+ signals.push("\u25D0 NEUTRAL: Volume not providing clear direction");
501
+ }
502
+ if (analysis.pricePosition > 65 && analysis.volatility > 30) {
503
+ signals.push("\u2717 BEARISH: High in range with elevated volatility - reversal risk");
504
+ bearishSignals++;
505
+ } else if (analysis.pricePosition < 35 && analysis.volatility > 30) {
506
+ signals.push("\u2713 BULLISH: Low in range with volatility - potential bounce");
507
+ bullishSignals++;
508
+ } else {
509
+ signals.push("\u25D0 NEUTRAL: Price position and volatility not extreme");
510
+ }
511
+ return { bullishSignals, bearishSignals, signals };
512
+ }
513
+ // Generate comprehensive JSON analysis
514
+ generateJSONAnalysis(symbol) {
515
+ const analysis = this.analyze();
516
+ const indicators = this.getTechnicalIndicators();
517
+ const signals = this.generateSignals();
518
+ const currentSMA5 = indicators.sma5.length > 0 ? indicators.sma5[indicators.sma5.length - 1] : null;
519
+ const currentSMA10 = indicators.sma10.length > 0 ? indicators.sma10[indicators.sma10.length - 1] : null;
520
+ const currentEMA8 = indicators.ema8[indicators.ema8.length - 1];
521
+ const currentEMA21 = indicators.ema21[indicators.ema21.length - 1];
522
+ const currentRSI = indicators.rsi.length > 0 ? indicators.rsi[indicators.rsi.length - 1] : null;
523
+ const currentBB = indicators.bollinger.length > 0 ? indicators.bollinger[indicators.bollinger.length - 1] : null;
524
+ const currentVolume = this.volumes[this.volumes.length - 1];
525
+ const volumeRatio = currentVolume / analysis.avgVolume;
526
+ const currentDrawdown = (analysis.sessionHigh - analysis.currentPrice) / analysis.sessionHigh * 100;
527
+ const rangeWidth = (analysis.sessionHigh - analysis.sessionLow) / analysis.sessionLow * 100;
528
+ const priceVsVWAP = (analysis.currentPrice - analysis.trueVWAP) / analysis.trueVWAP * 100;
529
+ const totalScore = signals.bullishSignals - signals.bearishSignals;
530
+ const overallSignal = totalScore > 0 ? "BULLISH_BIAS" : totalScore < 0 ? "BEARISH_BIAS" : "NEUTRAL";
531
+ const targetEntry = Math.max(analysis.sessionLow * 1.005, analysis.trueVWAP * 0.998);
532
+ const stopLoss = analysis.sessionLow * 0.995;
533
+ const profitTarget = analysis.sessionHigh * 0.995;
534
+ const riskRewardRatio = (profitTarget - analysis.currentPrice) / (analysis.currentPrice - stopLoss);
535
+ return {
536
+ symbol,
537
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
538
+ marketStructure: {
539
+ currentPrice: analysis.currentPrice,
540
+ startPrice: analysis.startPrice,
541
+ sessionHigh: analysis.sessionHigh,
542
+ sessionLow: analysis.sessionLow,
543
+ rangeWidth,
544
+ totalVolume: analysis.totalVolume,
545
+ sessionPerformance: analysis.sessionReturn,
546
+ positionInRange: analysis.pricePosition
547
+ },
548
+ volatility: {
549
+ impliedVolatility: analysis.volatility,
550
+ maxDrawdown: analysis.maxDrawdown * 100,
551
+ currentDrawdown
552
+ },
553
+ technicalIndicators: {
554
+ sma5: currentSMA5,
555
+ sma10: currentSMA10,
556
+ ema8: currentEMA8,
557
+ ema21: currentEMA21,
558
+ rsi: currentRSI,
559
+ bollingerBands: currentBB ? {
560
+ upper: currentBB.upper,
561
+ middle: currentBB.middle,
562
+ lower: currentBB.lower,
563
+ position: (analysis.currentPrice - currentBB.lower) / (currentBB.upper - currentBB.lower) * 100
564
+ } : null
565
+ },
566
+ volumeAnalysis: {
567
+ currentVolume,
568
+ averageVolume: Math.round(analysis.avgVolume),
569
+ volumeRatio,
570
+ trueVWAP: analysis.trueVWAP,
571
+ priceVsVWAP
572
+ },
573
+ momentum: {
574
+ momentum5: analysis.momentum5,
575
+ momentum10: analysis.momentum10,
576
+ sessionROC: analysis.sessionReturn
577
+ },
578
+ tradingSignals: {
579
+ ...signals,
580
+ overallSignal,
581
+ signalScore: totalScore
582
+ },
583
+ riskManagement: {
584
+ targetEntry,
585
+ stopLoss,
586
+ profitTarget,
587
+ riskRewardRatio
588
+ }
589
+ };
310
590
  }
311
591
  };
592
+ var createTechnicalAnalysisHandler = (marketDataPrices) => {
593
+ return async (args) => {
594
+ try {
595
+ const symbol = args.symbol;
596
+ const priceHistory = marketDataPrices.get(symbol) || [];
597
+ if (priceHistory.length === 0) {
598
+ return {
599
+ content: [
600
+ {
601
+ type: "text",
602
+ text: `No price data available for ${symbol}. Please request market data first.`,
603
+ uri: "technicalAnalysis"
604
+ }
605
+ ]
606
+ };
607
+ }
608
+ const analyzer = new TechnicalAnalyzer(priceHistory);
609
+ const analysis = analyzer.generateJSONAnalysis(symbol);
610
+ return {
611
+ content: [
612
+ {
613
+ type: "text",
614
+ text: `Technical Analysis for ${symbol}:
615
+
616
+ ${JSON.stringify(analysis, null, 2)}`,
617
+ uri: "technicalAnalysis"
618
+ }
619
+ ]
620
+ };
621
+ } catch (error) {
622
+ return {
623
+ content: [
624
+ {
625
+ type: "text",
626
+ text: `Error performing technical analysis: ${error instanceof Error ? error.message : "Unknown error"}`,
627
+ uri: "technicalAnalysis"
628
+ }
629
+ ],
630
+ isError: true
631
+ };
632
+ }
633
+ };
634
+ };
312
635
 
313
636
  // src/tools/marketData.ts
314
637
  var import_fixparser = require("fixparser");
@@ -316,8 +639,16 @@ var import_quickchart_js = __toESM(require("quickchart-js"), 1);
316
639
  var createMarketDataRequestHandler = (parser, pendingRequests) => {
317
640
  return async (args) => {
318
641
  try {
642
+ parser.logger.log({
643
+ level: "info",
644
+ message: `Sending market data request for symbols: ${args.symbols.join(", ")}`
645
+ });
319
646
  const response = new Promise((resolve) => {
320
647
  pendingRequests.set(args.mdReqID, resolve);
648
+ parser.logger.log({
649
+ level: "info",
650
+ message: `Registered callback for market data request ID: ${args.mdReqID}`
651
+ });
321
652
  });
322
653
  const entryTypes = args.mdEntryTypes || [
323
654
  import_fixparser.MDEntryType.Bid,
@@ -386,6 +717,10 @@ var createMarketDataRequestHandler = (parser, pendingRequests) => {
386
717
  });
387
718
  const mdr = parser.createMessage(...messageFields);
388
719
  if (!parser.connected) {
720
+ parser.logger.log({
721
+ level: "error",
722
+ message: "Not connected. Cannot send market data request."
723
+ });
389
724
  return {
390
725
  content: [
391
726
  {
@@ -397,8 +732,16 @@ var createMarketDataRequestHandler = (parser, pendingRequests) => {
397
732
  isError: true
398
733
  };
399
734
  }
735
+ parser.logger.log({
736
+ level: "info",
737
+ message: `Sending market data request message: ${JSON.stringify(mdr?.toFIXJSON())}`
738
+ });
400
739
  parser.send(mdr);
401
740
  const fixData = await response;
741
+ parser.logger.log({
742
+ level: "info",
743
+ message: `Received market data response for request ID: ${args.mdReqID}`
744
+ });
402
745
  return {
403
746
  content: [
404
747
  {
@@ -447,6 +790,9 @@ var createGetStockGraphHandler = (marketDataPrices) => {
447
790
  const offerData = priceHistory.map((point) => point.offer);
448
791
  const spreadData = priceHistory.map((point) => point.spread);
449
792
  const volumeData = priceHistory.map((point) => point.volume);
793
+ const tradeData = priceHistory.map((point) => point.trade);
794
+ const vwapData = priceHistory.map((point) => point.vwap);
795
+ const twapData = priceHistory.map((point) => point.twap);
450
796
  const config = {
451
797
  type: "line",
452
798
  data: {
@@ -476,6 +822,30 @@ var createGetStockGraphHandler = (marketDataPrices) => {
476
822
  fill: false,
477
823
  tension: 0.4
478
824
  },
825
+ {
826
+ label: "Trade",
827
+ data: tradeData,
828
+ borderColor: "#ffc107",
829
+ backgroundColor: "rgba(255, 193, 7, 0.1)",
830
+ fill: false,
831
+ tension: 0.4
832
+ },
833
+ {
834
+ label: "VWAP",
835
+ data: vwapData,
836
+ borderColor: "#17a2b8",
837
+ backgroundColor: "rgba(23, 162, 184, 0.1)",
838
+ fill: false,
839
+ tension: 0.4
840
+ },
841
+ {
842
+ label: "TWAP",
843
+ data: twapData,
844
+ borderColor: "#6610f2",
845
+ backgroundColor: "rgba(102, 16, 242, 0.1)",
846
+ fill: false,
847
+ tension: 0.4
848
+ },
479
849
  {
480
850
  label: "Volume",
481
851
  data: volumeData,
@@ -521,7 +891,7 @@ var createGetStockGraphHandler = (marketDataPrices) => {
521
891
  content: [
522
892
  {
523
893
  type: "text",
524
- text: `Error: ${error instanceof Error ? error.message : "Failed to generate chart"}`,
894
+ text: `Error: ${error instanceof Error ? error.message : "Failed to generate graph"}`,
525
895
  uri: "getStockGraph"
526
896
  }
527
897
  ],
@@ -559,7 +929,48 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
559
929
  bid: point.bid,
560
930
  offer: point.offer,
561
931
  spread: point.spread,
562
- volume: point.volume
932
+ volume: point.volume,
933
+ trade: point.trade,
934
+ indexValue: point.indexValue,
935
+ openingPrice: point.openingPrice,
936
+ closingPrice: point.closingPrice,
937
+ settlementPrice: point.settlementPrice,
938
+ tradingSessionHighPrice: point.tradingSessionHighPrice,
939
+ tradingSessionLowPrice: point.tradingSessionLowPrice,
940
+ vwap: point.vwap,
941
+ imbalance: point.imbalance,
942
+ openInterest: point.openInterest,
943
+ compositeUnderlyingPrice: point.compositeUnderlyingPrice,
944
+ simulatedSellPrice: point.simulatedSellPrice,
945
+ simulatedBuyPrice: point.simulatedBuyPrice,
946
+ marginRate: point.marginRate,
947
+ midPrice: point.midPrice,
948
+ emptyBook: point.emptyBook,
949
+ settleHighPrice: point.settleHighPrice,
950
+ settleLowPrice: point.settleLowPrice,
951
+ priorSettlePrice: point.priorSettlePrice,
952
+ sessionHighBid: point.sessionHighBid,
953
+ sessionLowOffer: point.sessionLowOffer,
954
+ earlyPrices: point.earlyPrices,
955
+ auctionClearingPrice: point.auctionClearingPrice,
956
+ swapValueFactor: point.swapValueFactor,
957
+ dailyValueAdjustmentForLongPositions: point.dailyValueAdjustmentForLongPositions,
958
+ cumulativeValueAdjustmentForLongPositions: point.cumulativeValueAdjustmentForLongPositions,
959
+ dailyValueAdjustmentForShortPositions: point.dailyValueAdjustmentForShortPositions,
960
+ cumulativeValueAdjustmentForShortPositions: point.cumulativeValueAdjustmentForShortPositions,
961
+ fixingPrice: point.fixingPrice,
962
+ cashRate: point.cashRate,
963
+ recoveryRate: point.recoveryRate,
964
+ recoveryRateForLong: point.recoveryRateForLong,
965
+ recoveryRateForShort: point.recoveryRateForShort,
966
+ marketBid: point.marketBid,
967
+ marketOffer: point.marketOffer,
968
+ shortSaleMinPrice: point.shortSaleMinPrice,
969
+ previousClosingPrice: point.previousClosingPrice,
970
+ thresholdLimitPriceBanding: point.thresholdLimitPriceBanding,
971
+ dailyFinancingValue: point.dailyFinancingValue,
972
+ accruedFinancingValue: point.accruedFinancingValue,
973
+ twap: point.twap
563
974
  }))
564
975
  },
565
976
  null,
@@ -574,7 +985,7 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
574
985
  content: [
575
986
  {
576
987
  type: "text",
577
- text: `Error: ${error instanceof Error ? error.message : "Failed to get stock price history"}`,
988
+ text: `Error: ${error instanceof Error ? error.message : "Failed to get price history"}`,
578
989
  uri: "getStockPriceHistory"
579
990
  }
580
991
  ],
@@ -682,7 +1093,7 @@ Parameters verified:
682
1093
  - Symbol: ${args.symbol}
683
1094
  - TimeInForce: ${args.timeInForce} (${timeInForceNames[args.timeInForce]})
684
1095
 
685
- To execute this order, call the executeOrder tool with these exact same parameters.`,
1096
+ To execute this order, call the executeOrder tool with these exact same parameters. Important: The user has to explicitly confirm before executeOrder is called!`,
686
1097
  uri: "verifyOrder"
687
1098
  }
688
1099
  ]
@@ -878,16 +1289,16 @@ var createToolHandlers = (parser, verifiedOrders, pendingRequests, marketDataPri
878
1289
  executeOrder: createExecuteOrderHandler(parser, verifiedOrders, pendingRequests),
879
1290
  marketDataRequest: createMarketDataRequestHandler(parser, pendingRequests),
880
1291
  getStockGraph: createGetStockGraphHandler(marketDataPrices),
881
- getStockPriceHistory: createGetStockPriceHistoryHandler(marketDataPrices)
1292
+ getStockPriceHistory: createGetStockPriceHistoryHandler(marketDataPrices),
1293
+ technicalAnalysis: createTechnicalAnalysisHandler(marketDataPrices)
882
1294
  });
883
1295
 
884
1296
  // src/utils/messageHandler.ts
885
1297
  var import_fixparser3 = require("fixparser");
1298
+ function getEnumValue(enumObj, name) {
1299
+ return enumObj[name] || name;
1300
+ }
886
1301
  function handleMessage(message, parser, pendingRequests, marketDataPrices, maxPriceHistory, onPriceUpdate) {
887
- parser.logger.log({
888
- level: "info",
889
- message: `MCP Server received message: ${message.messageType}: ${message.description}`
890
- });
891
1302
  const msgType = message.messageType;
892
1303
  if (msgType === import_fixparser3.Messages.MarketDataSnapshotFullRefresh || msgType === import_fixparser3.Messages.MarketDataIncrementalRefresh) {
893
1304
  const symbol = message.getField(import_fixparser3.Fields.Symbol)?.value;
@@ -945,7 +1356,8 @@ function handleMessage(message, parser, pendingRequests, marketDataPrices, maxPr
945
1356
  const entryType = entry.MDEntryType;
946
1357
  const price = entry.MDEntryPx ? Number.parseFloat(entry.MDEntryPx) : 0;
947
1358
  const size = entry.MDEntrySize ? Number.parseFloat(entry.MDEntrySize) : 0;
948
- switch (entryType) {
1359
+ const enumValue = getEnumValue(import_fixparser3.MDEntryType, entryType);
1360
+ switch (enumValue) {
949
1361
  case import_fixparser3.MDEntryType.Bid:
950
1362
  data.bid = price;
951
1363
  break;