fixparser-plugin-mcp 9.1.7-4e8fe3d5 → 9.1.7-52ccb1d5
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 +315 -33
- package/build/cjs/MCPLocal.js.map +2 -2
- package/build/cjs/MCPRemote.js +316 -58
- package/build/cjs/MCPRemote.js.map +2 -2
- package/build/cjs/index.js +317 -59
- package/build/cjs/index.js.map +2 -2
- package/build/esm/MCPLocal.mjs +315 -33
- package/build/esm/MCPLocal.mjs.map +2 -2
- package/build/esm/MCPRemote.mjs +316 -58
- package/build/esm/MCPRemote.mjs.map +2 -2
- package/build/esm/index.mjs +317 -59
- 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 +7 -7
- 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 +7 -7
- package/build-examples/esm/example_mcp_remote.mjs.map +3 -3
- package/package.json +2 -2
- package/types/MCPLocal.d.ts +3 -11
- package/types/MCPRemote.d.ts +3 -11
- package/types/schemas/index.d.ts +1 -0
- package/types/schemas/marketData.d.ts +48 -0
- package/types/tools/index.d.ts +2 -11
- package/types/tools/marketData.d.ts +3 -24
- package/types/utils/messageHandler.d.ts +2 -8
package/build/cjs/MCPLocal.js
CHANGED
|
@@ -319,7 +319,52 @@ var createMarketDataRequestHandler = (parser, pendingRequests) => {
|
|
|
319
319
|
const response = new Promise((resolve) => {
|
|
320
320
|
pendingRequests.set(args.mdReqID, resolve);
|
|
321
321
|
});
|
|
322
|
-
const entryTypes = args.mdEntryTypes || [
|
|
322
|
+
const entryTypes = args.mdEntryTypes || [
|
|
323
|
+
import_fixparser.MDEntryType.Bid,
|
|
324
|
+
import_fixparser.MDEntryType.Offer,
|
|
325
|
+
import_fixparser.MDEntryType.Trade,
|
|
326
|
+
import_fixparser.MDEntryType.IndexValue,
|
|
327
|
+
import_fixparser.MDEntryType.OpeningPrice,
|
|
328
|
+
import_fixparser.MDEntryType.ClosingPrice,
|
|
329
|
+
import_fixparser.MDEntryType.SettlementPrice,
|
|
330
|
+
import_fixparser.MDEntryType.TradingSessionHighPrice,
|
|
331
|
+
import_fixparser.MDEntryType.TradingSessionLowPrice,
|
|
332
|
+
import_fixparser.MDEntryType.VWAP,
|
|
333
|
+
import_fixparser.MDEntryType.Imbalance,
|
|
334
|
+
import_fixparser.MDEntryType.TradeVolume,
|
|
335
|
+
import_fixparser.MDEntryType.OpenInterest,
|
|
336
|
+
import_fixparser.MDEntryType.CompositeUnderlyingPrice,
|
|
337
|
+
import_fixparser.MDEntryType.SimulatedSellPrice,
|
|
338
|
+
import_fixparser.MDEntryType.SimulatedBuyPrice,
|
|
339
|
+
import_fixparser.MDEntryType.MarginRate,
|
|
340
|
+
import_fixparser.MDEntryType.MidPrice,
|
|
341
|
+
import_fixparser.MDEntryType.EmptyBook,
|
|
342
|
+
import_fixparser.MDEntryType.SettleHighPrice,
|
|
343
|
+
import_fixparser.MDEntryType.SettleLowPrice,
|
|
344
|
+
import_fixparser.MDEntryType.PriorSettlePrice,
|
|
345
|
+
import_fixparser.MDEntryType.SessionHighBid,
|
|
346
|
+
import_fixparser.MDEntryType.SessionLowOffer,
|
|
347
|
+
import_fixparser.MDEntryType.EarlyPrices,
|
|
348
|
+
import_fixparser.MDEntryType.AuctionClearingPrice,
|
|
349
|
+
import_fixparser.MDEntryType.SwapValueFactor,
|
|
350
|
+
import_fixparser.MDEntryType.DailyValueAdjustmentForLongPositions,
|
|
351
|
+
import_fixparser.MDEntryType.CumulativeValueAdjustmentForLongPositions,
|
|
352
|
+
import_fixparser.MDEntryType.DailyValueAdjustmentForShortPositions,
|
|
353
|
+
import_fixparser.MDEntryType.CumulativeValueAdjustmentForShortPositions,
|
|
354
|
+
import_fixparser.MDEntryType.FixingPrice,
|
|
355
|
+
import_fixparser.MDEntryType.CashRate,
|
|
356
|
+
import_fixparser.MDEntryType.RecoveryRate,
|
|
357
|
+
import_fixparser.MDEntryType.RecoveryRateForLong,
|
|
358
|
+
import_fixparser.MDEntryType.RecoveryRateForShort,
|
|
359
|
+
import_fixparser.MDEntryType.MarketBid,
|
|
360
|
+
import_fixparser.MDEntryType.MarketOffer,
|
|
361
|
+
import_fixparser.MDEntryType.ShortSaleMinPrice,
|
|
362
|
+
import_fixparser.MDEntryType.PreviousClosingPrice,
|
|
363
|
+
import_fixparser.MDEntryType.ThresholdLimitPriceBanding,
|
|
364
|
+
import_fixparser.MDEntryType.DailyFinancingValue,
|
|
365
|
+
import_fixparser.MDEntryType.AccruedFinancingValue,
|
|
366
|
+
import_fixparser.MDEntryType.TWAP
|
|
367
|
+
];
|
|
323
368
|
const messageFields = [
|
|
324
369
|
new import_fixparser.Field(import_fixparser.Fields.MsgType, import_fixparser.Messages.MarketDataRequest),
|
|
325
370
|
new import_fixparser.Field(import_fixparser.Fields.SenderCompID, parser.sender),
|
|
@@ -402,6 +447,9 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
402
447
|
const offerData = priceHistory.map((point) => point.offer);
|
|
403
448
|
const spreadData = priceHistory.map((point) => point.spread);
|
|
404
449
|
const volumeData = priceHistory.map((point) => point.volume);
|
|
450
|
+
const tradeData = priceHistory.map((point) => point.trade);
|
|
451
|
+
const vwapData = priceHistory.map((point) => point.vwap);
|
|
452
|
+
const twapData = priceHistory.map((point) => point.twap);
|
|
405
453
|
const config = {
|
|
406
454
|
type: "line",
|
|
407
455
|
data: {
|
|
@@ -431,6 +479,30 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
431
479
|
fill: false,
|
|
432
480
|
tension: 0.4
|
|
433
481
|
},
|
|
482
|
+
{
|
|
483
|
+
label: "Trade",
|
|
484
|
+
data: tradeData,
|
|
485
|
+
borderColor: "#ffc107",
|
|
486
|
+
backgroundColor: "rgba(255, 193, 7, 0.1)",
|
|
487
|
+
fill: false,
|
|
488
|
+
tension: 0.4
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
label: "VWAP",
|
|
492
|
+
data: vwapData,
|
|
493
|
+
borderColor: "#17a2b8",
|
|
494
|
+
backgroundColor: "rgba(23, 162, 184, 0.1)",
|
|
495
|
+
fill: false,
|
|
496
|
+
tension: 0.4
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
label: "TWAP",
|
|
500
|
+
data: twapData,
|
|
501
|
+
borderColor: "#6610f2",
|
|
502
|
+
backgroundColor: "rgba(102, 16, 242, 0.1)",
|
|
503
|
+
fill: false,
|
|
504
|
+
tension: 0.4
|
|
505
|
+
},
|
|
434
506
|
{
|
|
435
507
|
label: "Volume",
|
|
436
508
|
data: volumeData,
|
|
@@ -476,7 +548,7 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
476
548
|
content: [
|
|
477
549
|
{
|
|
478
550
|
type: "text",
|
|
479
|
-
text: `Error: ${error instanceof Error ? error.message : "Failed to generate
|
|
551
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to generate graph"}`,
|
|
480
552
|
uri: "getStockGraph"
|
|
481
553
|
}
|
|
482
554
|
],
|
|
@@ -514,7 +586,48 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
|
|
|
514
586
|
bid: point.bid,
|
|
515
587
|
offer: point.offer,
|
|
516
588
|
spread: point.spread,
|
|
517
|
-
volume: point.volume
|
|
589
|
+
volume: point.volume,
|
|
590
|
+
trade: point.trade,
|
|
591
|
+
indexValue: point.indexValue,
|
|
592
|
+
openingPrice: point.openingPrice,
|
|
593
|
+
closingPrice: point.closingPrice,
|
|
594
|
+
settlementPrice: point.settlementPrice,
|
|
595
|
+
tradingSessionHighPrice: point.tradingSessionHighPrice,
|
|
596
|
+
tradingSessionLowPrice: point.tradingSessionLowPrice,
|
|
597
|
+
vwap: point.vwap,
|
|
598
|
+
imbalance: point.imbalance,
|
|
599
|
+
openInterest: point.openInterest,
|
|
600
|
+
compositeUnderlyingPrice: point.compositeUnderlyingPrice,
|
|
601
|
+
simulatedSellPrice: point.simulatedSellPrice,
|
|
602
|
+
simulatedBuyPrice: point.simulatedBuyPrice,
|
|
603
|
+
marginRate: point.marginRate,
|
|
604
|
+
midPrice: point.midPrice,
|
|
605
|
+
emptyBook: point.emptyBook,
|
|
606
|
+
settleHighPrice: point.settleHighPrice,
|
|
607
|
+
settleLowPrice: point.settleLowPrice,
|
|
608
|
+
priorSettlePrice: point.priorSettlePrice,
|
|
609
|
+
sessionHighBid: point.sessionHighBid,
|
|
610
|
+
sessionLowOffer: point.sessionLowOffer,
|
|
611
|
+
earlyPrices: point.earlyPrices,
|
|
612
|
+
auctionClearingPrice: point.auctionClearingPrice,
|
|
613
|
+
swapValueFactor: point.swapValueFactor,
|
|
614
|
+
dailyValueAdjustmentForLongPositions: point.dailyValueAdjustmentForLongPositions,
|
|
615
|
+
cumulativeValueAdjustmentForLongPositions: point.cumulativeValueAdjustmentForLongPositions,
|
|
616
|
+
dailyValueAdjustmentForShortPositions: point.dailyValueAdjustmentForShortPositions,
|
|
617
|
+
cumulativeValueAdjustmentForShortPositions: point.cumulativeValueAdjustmentForShortPositions,
|
|
618
|
+
fixingPrice: point.fixingPrice,
|
|
619
|
+
cashRate: point.cashRate,
|
|
620
|
+
recoveryRate: point.recoveryRate,
|
|
621
|
+
recoveryRateForLong: point.recoveryRateForLong,
|
|
622
|
+
recoveryRateForShort: point.recoveryRateForShort,
|
|
623
|
+
marketBid: point.marketBid,
|
|
624
|
+
marketOffer: point.marketOffer,
|
|
625
|
+
shortSaleMinPrice: point.shortSaleMinPrice,
|
|
626
|
+
previousClosingPrice: point.previousClosingPrice,
|
|
627
|
+
thresholdLimitPriceBanding: point.thresholdLimitPriceBanding,
|
|
628
|
+
dailyFinancingValue: point.dailyFinancingValue,
|
|
629
|
+
accruedFinancingValue: point.accruedFinancingValue,
|
|
630
|
+
twap: point.twap
|
|
518
631
|
}))
|
|
519
632
|
},
|
|
520
633
|
null,
|
|
@@ -529,7 +642,7 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
|
|
|
529
642
|
content: [
|
|
530
643
|
{
|
|
531
644
|
type: "text",
|
|
532
|
-
text: `Error: ${error instanceof Error ? error.message : "Failed to get
|
|
645
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to get price history"}`,
|
|
533
646
|
uri: "getStockPriceHistory"
|
|
534
647
|
}
|
|
535
648
|
],
|
|
@@ -844,37 +957,198 @@ function handleMessage(message, parser, pendingRequests, marketDataPrices, maxPr
|
|
|
844
957
|
message: `MCP Server received message: ${message.messageType}: ${message.description}`
|
|
845
958
|
});
|
|
846
959
|
const msgType = message.messageType;
|
|
847
|
-
if (msgType === import_fixparser3.Messages.MarketDataSnapshotFullRefresh) {
|
|
960
|
+
if (msgType === import_fixparser3.Messages.MarketDataSnapshotFullRefresh || msgType === import_fixparser3.Messages.MarketDataIncrementalRefresh) {
|
|
848
961
|
const symbol = message.getField(import_fixparser3.Fields.Symbol)?.value;
|
|
849
|
-
const
|
|
850
|
-
|
|
851
|
-
let offer = 0;
|
|
852
|
-
let volume = 0;
|
|
853
|
-
const entryTypes = message.getFields(import_fixparser3.Fields.MDEntryType);
|
|
854
|
-
const entryPrices = message.getFields(import_fixparser3.Fields.MDEntryPx);
|
|
855
|
-
const entrySizes = message.getFields(import_fixparser3.Fields.MDEntrySize);
|
|
856
|
-
if (entryTypes && entryPrices && entrySizes) {
|
|
857
|
-
for (let i = 0; i < entries; i++) {
|
|
858
|
-
const entryType = entryTypes[i]?.value;
|
|
859
|
-
const entryPrice = Number.parseFloat(entryPrices[i]?.value);
|
|
860
|
-
const entrySize = Number.parseFloat(entrySizes[i]?.value);
|
|
861
|
-
if (entryType === import_fixparser3.MDEntryType.Bid) {
|
|
862
|
-
bid = entryPrice;
|
|
863
|
-
} else if (entryType === import_fixparser3.MDEntryType.Offer) {
|
|
864
|
-
offer = entryPrice;
|
|
865
|
-
}
|
|
866
|
-
volume += entrySize;
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
const spread = offer - bid;
|
|
870
|
-
const timestamp = Date.now();
|
|
962
|
+
const fixJson = message.toFIXJSON();
|
|
963
|
+
const entries = fixJson.Body?.NoMDEntries || [];
|
|
871
964
|
const data = {
|
|
872
|
-
timestamp,
|
|
873
|
-
bid,
|
|
874
|
-
offer,
|
|
875
|
-
spread,
|
|
876
|
-
volume
|
|
965
|
+
timestamp: Date.now(),
|
|
966
|
+
bid: 0,
|
|
967
|
+
offer: 0,
|
|
968
|
+
spread: 0,
|
|
969
|
+
volume: 0,
|
|
970
|
+
trade: 0,
|
|
971
|
+
indexValue: 0,
|
|
972
|
+
openingPrice: 0,
|
|
973
|
+
closingPrice: 0,
|
|
974
|
+
settlementPrice: 0,
|
|
975
|
+
tradingSessionHighPrice: 0,
|
|
976
|
+
tradingSessionLowPrice: 0,
|
|
977
|
+
vwap: 0,
|
|
978
|
+
imbalance: 0,
|
|
979
|
+
openInterest: 0,
|
|
980
|
+
compositeUnderlyingPrice: 0,
|
|
981
|
+
simulatedSellPrice: 0,
|
|
982
|
+
simulatedBuyPrice: 0,
|
|
983
|
+
marginRate: 0,
|
|
984
|
+
midPrice: 0,
|
|
985
|
+
emptyBook: 0,
|
|
986
|
+
settleHighPrice: 0,
|
|
987
|
+
settleLowPrice: 0,
|
|
988
|
+
priorSettlePrice: 0,
|
|
989
|
+
sessionHighBid: 0,
|
|
990
|
+
sessionLowOffer: 0,
|
|
991
|
+
earlyPrices: 0,
|
|
992
|
+
auctionClearingPrice: 0,
|
|
993
|
+
swapValueFactor: 0,
|
|
994
|
+
dailyValueAdjustmentForLongPositions: 0,
|
|
995
|
+
cumulativeValueAdjustmentForLongPositions: 0,
|
|
996
|
+
dailyValueAdjustmentForShortPositions: 0,
|
|
997
|
+
cumulativeValueAdjustmentForShortPositions: 0,
|
|
998
|
+
fixingPrice: 0,
|
|
999
|
+
cashRate: 0,
|
|
1000
|
+
recoveryRate: 0,
|
|
1001
|
+
recoveryRateForLong: 0,
|
|
1002
|
+
recoveryRateForShort: 0,
|
|
1003
|
+
marketBid: 0,
|
|
1004
|
+
marketOffer: 0,
|
|
1005
|
+
shortSaleMinPrice: 0,
|
|
1006
|
+
previousClosingPrice: 0,
|
|
1007
|
+
thresholdLimitPriceBanding: 0,
|
|
1008
|
+
dailyFinancingValue: 0,
|
|
1009
|
+
accruedFinancingValue: 0,
|
|
1010
|
+
twap: 0
|
|
877
1011
|
};
|
|
1012
|
+
for (const entry of entries) {
|
|
1013
|
+
const entryType = entry.MDEntryType;
|
|
1014
|
+
const price = entry.MDEntryPx ? Number.parseFloat(entry.MDEntryPx) : 0;
|
|
1015
|
+
const size = entry.MDEntrySize ? Number.parseFloat(entry.MDEntrySize) : 0;
|
|
1016
|
+
switch (entryType) {
|
|
1017
|
+
case import_fixparser3.MDEntryType.Bid:
|
|
1018
|
+
data.bid = price;
|
|
1019
|
+
break;
|
|
1020
|
+
case import_fixparser3.MDEntryType.Offer:
|
|
1021
|
+
data.offer = price;
|
|
1022
|
+
break;
|
|
1023
|
+
case import_fixparser3.MDEntryType.Trade:
|
|
1024
|
+
data.trade = price;
|
|
1025
|
+
break;
|
|
1026
|
+
case import_fixparser3.MDEntryType.IndexValue:
|
|
1027
|
+
data.indexValue = price;
|
|
1028
|
+
break;
|
|
1029
|
+
case import_fixparser3.MDEntryType.OpeningPrice:
|
|
1030
|
+
data.openingPrice = price;
|
|
1031
|
+
break;
|
|
1032
|
+
case import_fixparser3.MDEntryType.ClosingPrice:
|
|
1033
|
+
data.closingPrice = price;
|
|
1034
|
+
break;
|
|
1035
|
+
case import_fixparser3.MDEntryType.SettlementPrice:
|
|
1036
|
+
data.settlementPrice = price;
|
|
1037
|
+
break;
|
|
1038
|
+
case import_fixparser3.MDEntryType.TradingSessionHighPrice:
|
|
1039
|
+
data.tradingSessionHighPrice = price;
|
|
1040
|
+
break;
|
|
1041
|
+
case import_fixparser3.MDEntryType.TradingSessionLowPrice:
|
|
1042
|
+
data.tradingSessionLowPrice = price;
|
|
1043
|
+
break;
|
|
1044
|
+
case import_fixparser3.MDEntryType.VWAP:
|
|
1045
|
+
data.vwap = price;
|
|
1046
|
+
break;
|
|
1047
|
+
case import_fixparser3.MDEntryType.Imbalance:
|
|
1048
|
+
data.imbalance = size;
|
|
1049
|
+
break;
|
|
1050
|
+
case import_fixparser3.MDEntryType.TradeVolume:
|
|
1051
|
+
data.volume = size;
|
|
1052
|
+
break;
|
|
1053
|
+
case import_fixparser3.MDEntryType.OpenInterest:
|
|
1054
|
+
data.openInterest = size;
|
|
1055
|
+
break;
|
|
1056
|
+
case import_fixparser3.MDEntryType.CompositeUnderlyingPrice:
|
|
1057
|
+
data.compositeUnderlyingPrice = price;
|
|
1058
|
+
break;
|
|
1059
|
+
case import_fixparser3.MDEntryType.SimulatedSellPrice:
|
|
1060
|
+
data.simulatedSellPrice = price;
|
|
1061
|
+
break;
|
|
1062
|
+
case import_fixparser3.MDEntryType.SimulatedBuyPrice:
|
|
1063
|
+
data.simulatedBuyPrice = price;
|
|
1064
|
+
break;
|
|
1065
|
+
case import_fixparser3.MDEntryType.MarginRate:
|
|
1066
|
+
data.marginRate = price;
|
|
1067
|
+
break;
|
|
1068
|
+
case import_fixparser3.MDEntryType.MidPrice:
|
|
1069
|
+
data.midPrice = price;
|
|
1070
|
+
break;
|
|
1071
|
+
case import_fixparser3.MDEntryType.EmptyBook:
|
|
1072
|
+
data.emptyBook = 1;
|
|
1073
|
+
break;
|
|
1074
|
+
case import_fixparser3.MDEntryType.SettleHighPrice:
|
|
1075
|
+
data.settleHighPrice = price;
|
|
1076
|
+
break;
|
|
1077
|
+
case import_fixparser3.MDEntryType.SettleLowPrice:
|
|
1078
|
+
data.settleLowPrice = price;
|
|
1079
|
+
break;
|
|
1080
|
+
case import_fixparser3.MDEntryType.PriorSettlePrice:
|
|
1081
|
+
data.priorSettlePrice = price;
|
|
1082
|
+
break;
|
|
1083
|
+
case import_fixparser3.MDEntryType.SessionHighBid:
|
|
1084
|
+
data.sessionHighBid = price;
|
|
1085
|
+
break;
|
|
1086
|
+
case import_fixparser3.MDEntryType.SessionLowOffer:
|
|
1087
|
+
data.sessionLowOffer = price;
|
|
1088
|
+
break;
|
|
1089
|
+
case import_fixparser3.MDEntryType.EarlyPrices:
|
|
1090
|
+
data.earlyPrices = price;
|
|
1091
|
+
break;
|
|
1092
|
+
case import_fixparser3.MDEntryType.AuctionClearingPrice:
|
|
1093
|
+
data.auctionClearingPrice = price;
|
|
1094
|
+
break;
|
|
1095
|
+
case import_fixparser3.MDEntryType.SwapValueFactor:
|
|
1096
|
+
data.swapValueFactor = price;
|
|
1097
|
+
break;
|
|
1098
|
+
case import_fixparser3.MDEntryType.DailyValueAdjustmentForLongPositions:
|
|
1099
|
+
data.dailyValueAdjustmentForLongPositions = price;
|
|
1100
|
+
break;
|
|
1101
|
+
case import_fixparser3.MDEntryType.CumulativeValueAdjustmentForLongPositions:
|
|
1102
|
+
data.cumulativeValueAdjustmentForLongPositions = price;
|
|
1103
|
+
break;
|
|
1104
|
+
case import_fixparser3.MDEntryType.DailyValueAdjustmentForShortPositions:
|
|
1105
|
+
data.dailyValueAdjustmentForShortPositions = price;
|
|
1106
|
+
break;
|
|
1107
|
+
case import_fixparser3.MDEntryType.CumulativeValueAdjustmentForShortPositions:
|
|
1108
|
+
data.cumulativeValueAdjustmentForShortPositions = price;
|
|
1109
|
+
break;
|
|
1110
|
+
case import_fixparser3.MDEntryType.FixingPrice:
|
|
1111
|
+
data.fixingPrice = price;
|
|
1112
|
+
break;
|
|
1113
|
+
case import_fixparser3.MDEntryType.CashRate:
|
|
1114
|
+
data.cashRate = price;
|
|
1115
|
+
break;
|
|
1116
|
+
case import_fixparser3.MDEntryType.RecoveryRate:
|
|
1117
|
+
data.recoveryRate = price;
|
|
1118
|
+
break;
|
|
1119
|
+
case import_fixparser3.MDEntryType.RecoveryRateForLong:
|
|
1120
|
+
data.recoveryRateForLong = price;
|
|
1121
|
+
break;
|
|
1122
|
+
case import_fixparser3.MDEntryType.RecoveryRateForShort:
|
|
1123
|
+
data.recoveryRateForShort = price;
|
|
1124
|
+
break;
|
|
1125
|
+
case import_fixparser3.MDEntryType.MarketBid:
|
|
1126
|
+
data.marketBid = price;
|
|
1127
|
+
break;
|
|
1128
|
+
case import_fixparser3.MDEntryType.MarketOffer:
|
|
1129
|
+
data.marketOffer = price;
|
|
1130
|
+
break;
|
|
1131
|
+
case import_fixparser3.MDEntryType.ShortSaleMinPrice:
|
|
1132
|
+
data.shortSaleMinPrice = price;
|
|
1133
|
+
break;
|
|
1134
|
+
case import_fixparser3.MDEntryType.PreviousClosingPrice:
|
|
1135
|
+
data.previousClosingPrice = price;
|
|
1136
|
+
break;
|
|
1137
|
+
case import_fixparser3.MDEntryType.ThresholdLimitPriceBanding:
|
|
1138
|
+
data.thresholdLimitPriceBanding = price;
|
|
1139
|
+
break;
|
|
1140
|
+
case import_fixparser3.MDEntryType.DailyFinancingValue:
|
|
1141
|
+
data.dailyFinancingValue = price;
|
|
1142
|
+
break;
|
|
1143
|
+
case import_fixparser3.MDEntryType.AccruedFinancingValue:
|
|
1144
|
+
data.accruedFinancingValue = price;
|
|
1145
|
+
break;
|
|
1146
|
+
case import_fixparser3.MDEntryType.TWAP:
|
|
1147
|
+
data.twap = price;
|
|
1148
|
+
break;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
data.spread = data.offer - data.bid;
|
|
878
1152
|
if (!marketDataPrices.has(symbol)) {
|
|
879
1153
|
marketDataPrices.set(symbol, []);
|
|
880
1154
|
}
|
|
@@ -884,6 +1158,14 @@ function handleMessage(message, parser, pendingRequests, marketDataPrices, maxPr
|
|
|
884
1158
|
prices.splice(0, prices.length - maxPriceHistory);
|
|
885
1159
|
}
|
|
886
1160
|
onPriceUpdate?.(symbol, data);
|
|
1161
|
+
const mdReqID = message.getField(import_fixparser3.Fields.MDReqID)?.value;
|
|
1162
|
+
if (mdReqID) {
|
|
1163
|
+
const callback = pendingRequests.get(mdReqID);
|
|
1164
|
+
if (callback) {
|
|
1165
|
+
callback(message);
|
|
1166
|
+
pendingRequests.delete(mdReqID);
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
887
1169
|
} else if (msgType === import_fixparser3.Messages.ExecutionReport) {
|
|
888
1170
|
const reqId = message.getField(import_fixparser3.Fields.ClOrdID)?.value;
|
|
889
1171
|
const callback = pendingRequests.get(reqId);
|
|
@@ -912,7 +1194,7 @@ var MCPLocal = class extends MCPBase {
|
|
|
912
1194
|
*/
|
|
913
1195
|
marketDataPrices = /* @__PURE__ */ new Map();
|
|
914
1196
|
/**
|
|
915
|
-
* Maximum number of price
|
|
1197
|
+
* Maximum number of price history entries to keep per symbol
|
|
916
1198
|
* @private
|
|
917
1199
|
*/
|
|
918
1200
|
MAX_PRICE_HISTORY = 1e5;
|