fixparser-plugin-mcp 9.1.7-63c797c5 → 9.1.7-67ba45e9
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 +372 -35
- package/build/cjs/MCPLocal.js.map +2 -2
- package/build/cjs/MCPRemote.js +440 -176
- package/build/cjs/MCPRemote.js.map +2 -2
- package/build/cjs/index.js +441 -177
- package/build/cjs/index.js.map +2 -2
- package/build/esm/MCPLocal.mjs +372 -35
- package/build/esm/MCPLocal.mjs.map +2 -2
- package/build/esm/MCPRemote.mjs +440 -176
- package/build/esm/MCPRemote.mjs.map +2 -2
- package/build/esm/index.mjs +441 -177
- 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 +1 -1
- package/types/MCPBase.d.ts +0 -49
- package/types/MCPLocal.d.ts +0 -40
- package/types/MCPRemote.d.ts +0 -66
- package/types/PluginOptions.d.ts +0 -6
- package/types/index.d.ts +0 -3
- package/types/schemas/index.d.ts +0 -15
- package/types/schemas/schemas.d.ts +0 -168
- package/types/tools/index.d.ts +0 -17
- package/types/tools/marketData.d.ts +0 -40
- package/types/tools/order.d.ts +0 -12
- package/types/tools/parse.d.ts +0 -5
- package/types/tools/parseToJSON.d.ts +0 -5
- package/types/utils/messageHandler.d.ts +0 -18
package/build/cjs/MCPLocal.js
CHANGED
|
@@ -163,7 +163,7 @@ var toolSchemas = {
|
|
|
163
163
|
}
|
|
164
164
|
},
|
|
165
165
|
executeOrder: {
|
|
166
|
-
description: "Executes a verified order. verifyOrder must be called before executeOrder.
|
|
166
|
+
description: "Executes a verified order. verifyOrder must be called before executeOrder.",
|
|
167
167
|
schema: {
|
|
168
168
|
type: "object",
|
|
169
169
|
properties: {
|
|
@@ -316,10 +316,63 @@ var import_quickchart_js = __toESM(require("quickchart-js"), 1);
|
|
|
316
316
|
var createMarketDataRequestHandler = (parser, pendingRequests) => {
|
|
317
317
|
return async (args) => {
|
|
318
318
|
try {
|
|
319
|
+
parser.logger.log({
|
|
320
|
+
level: "info",
|
|
321
|
+
message: `Sending market data request for symbols: ${args.symbols.join(", ")}`
|
|
322
|
+
});
|
|
319
323
|
const response = new Promise((resolve) => {
|
|
320
324
|
pendingRequests.set(args.mdReqID, resolve);
|
|
325
|
+
parser.logger.log({
|
|
326
|
+
level: "info",
|
|
327
|
+
message: `Registered callback for market data request ID: ${args.mdReqID}`
|
|
328
|
+
});
|
|
321
329
|
});
|
|
322
|
-
const entryTypes = args.mdEntryTypes || [
|
|
330
|
+
const entryTypes = args.mdEntryTypes || [
|
|
331
|
+
import_fixparser.MDEntryType.Bid,
|
|
332
|
+
import_fixparser.MDEntryType.Offer,
|
|
333
|
+
import_fixparser.MDEntryType.Trade,
|
|
334
|
+
import_fixparser.MDEntryType.IndexValue,
|
|
335
|
+
import_fixparser.MDEntryType.OpeningPrice,
|
|
336
|
+
import_fixparser.MDEntryType.ClosingPrice,
|
|
337
|
+
import_fixparser.MDEntryType.SettlementPrice,
|
|
338
|
+
import_fixparser.MDEntryType.TradingSessionHighPrice,
|
|
339
|
+
import_fixparser.MDEntryType.TradingSessionLowPrice,
|
|
340
|
+
import_fixparser.MDEntryType.VWAP,
|
|
341
|
+
import_fixparser.MDEntryType.Imbalance,
|
|
342
|
+
import_fixparser.MDEntryType.TradeVolume,
|
|
343
|
+
import_fixparser.MDEntryType.OpenInterest,
|
|
344
|
+
import_fixparser.MDEntryType.CompositeUnderlyingPrice,
|
|
345
|
+
import_fixparser.MDEntryType.SimulatedSellPrice,
|
|
346
|
+
import_fixparser.MDEntryType.SimulatedBuyPrice,
|
|
347
|
+
import_fixparser.MDEntryType.MarginRate,
|
|
348
|
+
import_fixparser.MDEntryType.MidPrice,
|
|
349
|
+
import_fixparser.MDEntryType.EmptyBook,
|
|
350
|
+
import_fixparser.MDEntryType.SettleHighPrice,
|
|
351
|
+
import_fixparser.MDEntryType.SettleLowPrice,
|
|
352
|
+
import_fixparser.MDEntryType.PriorSettlePrice,
|
|
353
|
+
import_fixparser.MDEntryType.SessionHighBid,
|
|
354
|
+
import_fixparser.MDEntryType.SessionLowOffer,
|
|
355
|
+
import_fixparser.MDEntryType.EarlyPrices,
|
|
356
|
+
import_fixparser.MDEntryType.AuctionClearingPrice,
|
|
357
|
+
import_fixparser.MDEntryType.SwapValueFactor,
|
|
358
|
+
import_fixparser.MDEntryType.DailyValueAdjustmentForLongPositions,
|
|
359
|
+
import_fixparser.MDEntryType.CumulativeValueAdjustmentForLongPositions,
|
|
360
|
+
import_fixparser.MDEntryType.DailyValueAdjustmentForShortPositions,
|
|
361
|
+
import_fixparser.MDEntryType.CumulativeValueAdjustmentForShortPositions,
|
|
362
|
+
import_fixparser.MDEntryType.FixingPrice,
|
|
363
|
+
import_fixparser.MDEntryType.CashRate,
|
|
364
|
+
import_fixparser.MDEntryType.RecoveryRate,
|
|
365
|
+
import_fixparser.MDEntryType.RecoveryRateForLong,
|
|
366
|
+
import_fixparser.MDEntryType.RecoveryRateForShort,
|
|
367
|
+
import_fixparser.MDEntryType.MarketBid,
|
|
368
|
+
import_fixparser.MDEntryType.MarketOffer,
|
|
369
|
+
import_fixparser.MDEntryType.ShortSaleMinPrice,
|
|
370
|
+
import_fixparser.MDEntryType.PreviousClosingPrice,
|
|
371
|
+
import_fixparser.MDEntryType.ThresholdLimitPriceBanding,
|
|
372
|
+
import_fixparser.MDEntryType.DailyFinancingValue,
|
|
373
|
+
import_fixparser.MDEntryType.AccruedFinancingValue,
|
|
374
|
+
import_fixparser.MDEntryType.TWAP
|
|
375
|
+
];
|
|
323
376
|
const messageFields = [
|
|
324
377
|
new import_fixparser.Field(import_fixparser.Fields.MsgType, import_fixparser.Messages.MarketDataRequest),
|
|
325
378
|
new import_fixparser.Field(import_fixparser.Fields.SenderCompID, parser.sender),
|
|
@@ -341,6 +394,10 @@ var createMarketDataRequestHandler = (parser, pendingRequests) => {
|
|
|
341
394
|
});
|
|
342
395
|
const mdr = parser.createMessage(...messageFields);
|
|
343
396
|
if (!parser.connected) {
|
|
397
|
+
parser.logger.log({
|
|
398
|
+
level: "error",
|
|
399
|
+
message: "Not connected. Cannot send market data request."
|
|
400
|
+
});
|
|
344
401
|
return {
|
|
345
402
|
content: [
|
|
346
403
|
{
|
|
@@ -352,8 +409,16 @@ var createMarketDataRequestHandler = (parser, pendingRequests) => {
|
|
|
352
409
|
isError: true
|
|
353
410
|
};
|
|
354
411
|
}
|
|
412
|
+
parser.logger.log({
|
|
413
|
+
level: "info",
|
|
414
|
+
message: `Sending market data request message: ${JSON.stringify(mdr?.toFIXJSON())}`
|
|
415
|
+
});
|
|
355
416
|
parser.send(mdr);
|
|
356
417
|
const fixData = await response;
|
|
418
|
+
parser.logger.log({
|
|
419
|
+
level: "info",
|
|
420
|
+
message: `Received market data response for request ID: ${args.mdReqID}`
|
|
421
|
+
});
|
|
357
422
|
return {
|
|
358
423
|
content: [
|
|
359
424
|
{
|
|
@@ -402,6 +467,9 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
402
467
|
const offerData = priceHistory.map((point) => point.offer);
|
|
403
468
|
const spreadData = priceHistory.map((point) => point.spread);
|
|
404
469
|
const volumeData = priceHistory.map((point) => point.volume);
|
|
470
|
+
const tradeData = priceHistory.map((point) => point.trade);
|
|
471
|
+
const vwapData = priceHistory.map((point) => point.vwap);
|
|
472
|
+
const twapData = priceHistory.map((point) => point.twap);
|
|
405
473
|
const config = {
|
|
406
474
|
type: "line",
|
|
407
475
|
data: {
|
|
@@ -431,6 +499,30 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
431
499
|
fill: false,
|
|
432
500
|
tension: 0.4
|
|
433
501
|
},
|
|
502
|
+
{
|
|
503
|
+
label: "Trade",
|
|
504
|
+
data: tradeData,
|
|
505
|
+
borderColor: "#ffc107",
|
|
506
|
+
backgroundColor: "rgba(255, 193, 7, 0.1)",
|
|
507
|
+
fill: false,
|
|
508
|
+
tension: 0.4
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
label: "VWAP",
|
|
512
|
+
data: vwapData,
|
|
513
|
+
borderColor: "#17a2b8",
|
|
514
|
+
backgroundColor: "rgba(23, 162, 184, 0.1)",
|
|
515
|
+
fill: false,
|
|
516
|
+
tension: 0.4
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
label: "TWAP",
|
|
520
|
+
data: twapData,
|
|
521
|
+
borderColor: "#6610f2",
|
|
522
|
+
backgroundColor: "rgba(102, 16, 242, 0.1)",
|
|
523
|
+
fill: false,
|
|
524
|
+
tension: 0.4
|
|
525
|
+
},
|
|
434
526
|
{
|
|
435
527
|
label: "Volume",
|
|
436
528
|
data: volumeData,
|
|
@@ -476,7 +568,7 @@ var createGetStockGraphHandler = (marketDataPrices) => {
|
|
|
476
568
|
content: [
|
|
477
569
|
{
|
|
478
570
|
type: "text",
|
|
479
|
-
text: `Error: ${error instanceof Error ? error.message : "Failed to generate
|
|
571
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to generate graph"}`,
|
|
480
572
|
uri: "getStockGraph"
|
|
481
573
|
}
|
|
482
574
|
],
|
|
@@ -514,7 +606,48 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
|
|
|
514
606
|
bid: point.bid,
|
|
515
607
|
offer: point.offer,
|
|
516
608
|
spread: point.spread,
|
|
517
|
-
volume: point.volume
|
|
609
|
+
volume: point.volume,
|
|
610
|
+
trade: point.trade,
|
|
611
|
+
indexValue: point.indexValue,
|
|
612
|
+
openingPrice: point.openingPrice,
|
|
613
|
+
closingPrice: point.closingPrice,
|
|
614
|
+
settlementPrice: point.settlementPrice,
|
|
615
|
+
tradingSessionHighPrice: point.tradingSessionHighPrice,
|
|
616
|
+
tradingSessionLowPrice: point.tradingSessionLowPrice,
|
|
617
|
+
vwap: point.vwap,
|
|
618
|
+
imbalance: point.imbalance,
|
|
619
|
+
openInterest: point.openInterest,
|
|
620
|
+
compositeUnderlyingPrice: point.compositeUnderlyingPrice,
|
|
621
|
+
simulatedSellPrice: point.simulatedSellPrice,
|
|
622
|
+
simulatedBuyPrice: point.simulatedBuyPrice,
|
|
623
|
+
marginRate: point.marginRate,
|
|
624
|
+
midPrice: point.midPrice,
|
|
625
|
+
emptyBook: point.emptyBook,
|
|
626
|
+
settleHighPrice: point.settleHighPrice,
|
|
627
|
+
settleLowPrice: point.settleLowPrice,
|
|
628
|
+
priorSettlePrice: point.priorSettlePrice,
|
|
629
|
+
sessionHighBid: point.sessionHighBid,
|
|
630
|
+
sessionLowOffer: point.sessionLowOffer,
|
|
631
|
+
earlyPrices: point.earlyPrices,
|
|
632
|
+
auctionClearingPrice: point.auctionClearingPrice,
|
|
633
|
+
swapValueFactor: point.swapValueFactor,
|
|
634
|
+
dailyValueAdjustmentForLongPositions: point.dailyValueAdjustmentForLongPositions,
|
|
635
|
+
cumulativeValueAdjustmentForLongPositions: point.cumulativeValueAdjustmentForLongPositions,
|
|
636
|
+
dailyValueAdjustmentForShortPositions: point.dailyValueAdjustmentForShortPositions,
|
|
637
|
+
cumulativeValueAdjustmentForShortPositions: point.cumulativeValueAdjustmentForShortPositions,
|
|
638
|
+
fixingPrice: point.fixingPrice,
|
|
639
|
+
cashRate: point.cashRate,
|
|
640
|
+
recoveryRate: point.recoveryRate,
|
|
641
|
+
recoveryRateForLong: point.recoveryRateForLong,
|
|
642
|
+
recoveryRateForShort: point.recoveryRateForShort,
|
|
643
|
+
marketBid: point.marketBid,
|
|
644
|
+
marketOffer: point.marketOffer,
|
|
645
|
+
shortSaleMinPrice: point.shortSaleMinPrice,
|
|
646
|
+
previousClosingPrice: point.previousClosingPrice,
|
|
647
|
+
thresholdLimitPriceBanding: point.thresholdLimitPriceBanding,
|
|
648
|
+
dailyFinancingValue: point.dailyFinancingValue,
|
|
649
|
+
accruedFinancingValue: point.accruedFinancingValue,
|
|
650
|
+
twap: point.twap
|
|
518
651
|
}))
|
|
519
652
|
},
|
|
520
653
|
null,
|
|
@@ -529,7 +662,7 @@ var createGetStockPriceHistoryHandler = (marketDataPrices) => {
|
|
|
529
662
|
content: [
|
|
530
663
|
{
|
|
531
664
|
type: "text",
|
|
532
|
-
text: `Error: ${error instanceof Error ? error.message : "Failed to get
|
|
665
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to get price history"}`,
|
|
533
666
|
uri: "getStockPriceHistory"
|
|
534
667
|
}
|
|
535
668
|
],
|
|
@@ -637,7 +770,7 @@ Parameters verified:
|
|
|
637
770
|
- Symbol: ${args.symbol}
|
|
638
771
|
- TimeInForce: ${args.timeInForce} (${timeInForceNames[args.timeInForce]})
|
|
639
772
|
|
|
640
|
-
To execute this order, call the executeOrder tool with these exact same parameters
|
|
773
|
+
To execute this order, call the executeOrder tool with these exact same parameters. Important: The user has to explicitly confirm before executeOrder is called!`,
|
|
641
774
|
uri: "verifyOrder"
|
|
642
775
|
}
|
|
643
776
|
]
|
|
@@ -838,52 +971,256 @@ var createToolHandlers = (parser, verifiedOrders, pendingRequests, marketDataPri
|
|
|
838
971
|
|
|
839
972
|
// src/utils/messageHandler.ts
|
|
840
973
|
var import_fixparser3 = require("fixparser");
|
|
974
|
+
function getEnumValue(enumObj, name) {
|
|
975
|
+
return enumObj[name] || name;
|
|
976
|
+
}
|
|
841
977
|
function handleMessage(message, parser, pendingRequests, marketDataPrices, maxPriceHistory, onPriceUpdate) {
|
|
842
978
|
parser.logger.log({
|
|
843
979
|
level: "info",
|
|
844
980
|
message: `MCP Server received message: ${message.messageType}: ${message.description}`
|
|
845
981
|
});
|
|
846
982
|
const msgType = message.messageType;
|
|
847
|
-
if (msgType === import_fixparser3.Messages.MarketDataSnapshotFullRefresh) {
|
|
983
|
+
if (msgType === import_fixparser3.Messages.MarketDataSnapshotFullRefresh || msgType === import_fixparser3.Messages.MarketDataIncrementalRefresh) {
|
|
848
984
|
const symbol = message.getField(import_fixparser3.Fields.Symbol)?.value;
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
const
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
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();
|
|
985
|
+
parser.logger.log({
|
|
986
|
+
level: "info",
|
|
987
|
+
message: `Processing market data for symbol: ${symbol}`
|
|
988
|
+
});
|
|
989
|
+
const fixJson = message.toFIXJSON();
|
|
990
|
+
const entries = fixJson.Body?.NoMDEntries || [];
|
|
991
|
+
parser.logger.log({
|
|
992
|
+
level: "info",
|
|
993
|
+
message: `Found ${entries.length} market data entries`
|
|
994
|
+
});
|
|
871
995
|
const data = {
|
|
872
|
-
timestamp,
|
|
873
|
-
bid,
|
|
874
|
-
offer,
|
|
875
|
-
spread,
|
|
876
|
-
volume
|
|
996
|
+
timestamp: Date.now(),
|
|
997
|
+
bid: 0,
|
|
998
|
+
offer: 0,
|
|
999
|
+
spread: 0,
|
|
1000
|
+
volume: 0,
|
|
1001
|
+
trade: 0,
|
|
1002
|
+
indexValue: 0,
|
|
1003
|
+
openingPrice: 0,
|
|
1004
|
+
closingPrice: 0,
|
|
1005
|
+
settlementPrice: 0,
|
|
1006
|
+
tradingSessionHighPrice: 0,
|
|
1007
|
+
tradingSessionLowPrice: 0,
|
|
1008
|
+
vwap: 0,
|
|
1009
|
+
imbalance: 0,
|
|
1010
|
+
openInterest: 0,
|
|
1011
|
+
compositeUnderlyingPrice: 0,
|
|
1012
|
+
simulatedSellPrice: 0,
|
|
1013
|
+
simulatedBuyPrice: 0,
|
|
1014
|
+
marginRate: 0,
|
|
1015
|
+
midPrice: 0,
|
|
1016
|
+
emptyBook: 0,
|
|
1017
|
+
settleHighPrice: 0,
|
|
1018
|
+
settleLowPrice: 0,
|
|
1019
|
+
priorSettlePrice: 0,
|
|
1020
|
+
sessionHighBid: 0,
|
|
1021
|
+
sessionLowOffer: 0,
|
|
1022
|
+
earlyPrices: 0,
|
|
1023
|
+
auctionClearingPrice: 0,
|
|
1024
|
+
swapValueFactor: 0,
|
|
1025
|
+
dailyValueAdjustmentForLongPositions: 0,
|
|
1026
|
+
cumulativeValueAdjustmentForLongPositions: 0,
|
|
1027
|
+
dailyValueAdjustmentForShortPositions: 0,
|
|
1028
|
+
cumulativeValueAdjustmentForShortPositions: 0,
|
|
1029
|
+
fixingPrice: 0,
|
|
1030
|
+
cashRate: 0,
|
|
1031
|
+
recoveryRate: 0,
|
|
1032
|
+
recoveryRateForLong: 0,
|
|
1033
|
+
recoveryRateForShort: 0,
|
|
1034
|
+
marketBid: 0,
|
|
1035
|
+
marketOffer: 0,
|
|
1036
|
+
shortSaleMinPrice: 0,
|
|
1037
|
+
previousClosingPrice: 0,
|
|
1038
|
+
thresholdLimitPriceBanding: 0,
|
|
1039
|
+
dailyFinancingValue: 0,
|
|
1040
|
+
accruedFinancingValue: 0,
|
|
1041
|
+
twap: 0
|
|
877
1042
|
};
|
|
1043
|
+
for (const entry of entries) {
|
|
1044
|
+
const entryType = entry.MDEntryType;
|
|
1045
|
+
const price = entry.MDEntryPx ? Number.parseFloat(entry.MDEntryPx) : 0;
|
|
1046
|
+
const size = entry.MDEntrySize ? Number.parseFloat(entry.MDEntrySize) : 0;
|
|
1047
|
+
if (entryType === import_fixparser3.MDEntryType.Bid || entryType === import_fixparser3.MDEntryType.Offer || entryType === import_fixparser3.MDEntryType.TradeVolume) {
|
|
1048
|
+
parser.logger.log({
|
|
1049
|
+
level: "info",
|
|
1050
|
+
message: `Market Data Entry - Type: ${entryType}, Price: ${price}, Size: ${size}`
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
const enumValue = getEnumValue(import_fixparser3.MDEntryType, entryType);
|
|
1054
|
+
switch (enumValue) {
|
|
1055
|
+
case import_fixparser3.MDEntryType.Bid:
|
|
1056
|
+
data.bid = price;
|
|
1057
|
+
break;
|
|
1058
|
+
case import_fixparser3.MDEntryType.Offer:
|
|
1059
|
+
data.offer = price;
|
|
1060
|
+
break;
|
|
1061
|
+
case import_fixparser3.MDEntryType.Trade:
|
|
1062
|
+
data.trade = price;
|
|
1063
|
+
break;
|
|
1064
|
+
case import_fixparser3.MDEntryType.IndexValue:
|
|
1065
|
+
data.indexValue = price;
|
|
1066
|
+
break;
|
|
1067
|
+
case import_fixparser3.MDEntryType.OpeningPrice:
|
|
1068
|
+
data.openingPrice = price;
|
|
1069
|
+
break;
|
|
1070
|
+
case import_fixparser3.MDEntryType.ClosingPrice:
|
|
1071
|
+
data.closingPrice = price;
|
|
1072
|
+
break;
|
|
1073
|
+
case import_fixparser3.MDEntryType.SettlementPrice:
|
|
1074
|
+
data.settlementPrice = price;
|
|
1075
|
+
break;
|
|
1076
|
+
case import_fixparser3.MDEntryType.TradingSessionHighPrice:
|
|
1077
|
+
data.tradingSessionHighPrice = price;
|
|
1078
|
+
break;
|
|
1079
|
+
case import_fixparser3.MDEntryType.TradingSessionLowPrice:
|
|
1080
|
+
data.tradingSessionLowPrice = price;
|
|
1081
|
+
break;
|
|
1082
|
+
case import_fixparser3.MDEntryType.VWAP:
|
|
1083
|
+
data.vwap = price;
|
|
1084
|
+
break;
|
|
1085
|
+
case import_fixparser3.MDEntryType.Imbalance:
|
|
1086
|
+
data.imbalance = size;
|
|
1087
|
+
break;
|
|
1088
|
+
case import_fixparser3.MDEntryType.TradeVolume:
|
|
1089
|
+
data.volume = size;
|
|
1090
|
+
break;
|
|
1091
|
+
case import_fixparser3.MDEntryType.OpenInterest:
|
|
1092
|
+
data.openInterest = size;
|
|
1093
|
+
break;
|
|
1094
|
+
case import_fixparser3.MDEntryType.CompositeUnderlyingPrice:
|
|
1095
|
+
data.compositeUnderlyingPrice = price;
|
|
1096
|
+
break;
|
|
1097
|
+
case import_fixparser3.MDEntryType.SimulatedSellPrice:
|
|
1098
|
+
data.simulatedSellPrice = price;
|
|
1099
|
+
break;
|
|
1100
|
+
case import_fixparser3.MDEntryType.SimulatedBuyPrice:
|
|
1101
|
+
data.simulatedBuyPrice = price;
|
|
1102
|
+
break;
|
|
1103
|
+
case import_fixparser3.MDEntryType.MarginRate:
|
|
1104
|
+
data.marginRate = price;
|
|
1105
|
+
break;
|
|
1106
|
+
case import_fixparser3.MDEntryType.MidPrice:
|
|
1107
|
+
data.midPrice = price;
|
|
1108
|
+
break;
|
|
1109
|
+
case import_fixparser3.MDEntryType.EmptyBook:
|
|
1110
|
+
data.emptyBook = 1;
|
|
1111
|
+
break;
|
|
1112
|
+
case import_fixparser3.MDEntryType.SettleHighPrice:
|
|
1113
|
+
data.settleHighPrice = price;
|
|
1114
|
+
break;
|
|
1115
|
+
case import_fixparser3.MDEntryType.SettleLowPrice:
|
|
1116
|
+
data.settleLowPrice = price;
|
|
1117
|
+
break;
|
|
1118
|
+
case import_fixparser3.MDEntryType.PriorSettlePrice:
|
|
1119
|
+
data.priorSettlePrice = price;
|
|
1120
|
+
break;
|
|
1121
|
+
case import_fixparser3.MDEntryType.SessionHighBid:
|
|
1122
|
+
data.sessionHighBid = price;
|
|
1123
|
+
break;
|
|
1124
|
+
case import_fixparser3.MDEntryType.SessionLowOffer:
|
|
1125
|
+
data.sessionLowOffer = price;
|
|
1126
|
+
break;
|
|
1127
|
+
case import_fixparser3.MDEntryType.EarlyPrices:
|
|
1128
|
+
data.earlyPrices = price;
|
|
1129
|
+
break;
|
|
1130
|
+
case import_fixparser3.MDEntryType.AuctionClearingPrice:
|
|
1131
|
+
data.auctionClearingPrice = price;
|
|
1132
|
+
break;
|
|
1133
|
+
case import_fixparser3.MDEntryType.SwapValueFactor:
|
|
1134
|
+
data.swapValueFactor = price;
|
|
1135
|
+
break;
|
|
1136
|
+
case import_fixparser3.MDEntryType.DailyValueAdjustmentForLongPositions:
|
|
1137
|
+
data.dailyValueAdjustmentForLongPositions = price;
|
|
1138
|
+
break;
|
|
1139
|
+
case import_fixparser3.MDEntryType.CumulativeValueAdjustmentForLongPositions:
|
|
1140
|
+
data.cumulativeValueAdjustmentForLongPositions = price;
|
|
1141
|
+
break;
|
|
1142
|
+
case import_fixparser3.MDEntryType.DailyValueAdjustmentForShortPositions:
|
|
1143
|
+
data.dailyValueAdjustmentForShortPositions = price;
|
|
1144
|
+
break;
|
|
1145
|
+
case import_fixparser3.MDEntryType.CumulativeValueAdjustmentForShortPositions:
|
|
1146
|
+
data.cumulativeValueAdjustmentForShortPositions = price;
|
|
1147
|
+
break;
|
|
1148
|
+
case import_fixparser3.MDEntryType.FixingPrice:
|
|
1149
|
+
data.fixingPrice = price;
|
|
1150
|
+
break;
|
|
1151
|
+
case import_fixparser3.MDEntryType.CashRate:
|
|
1152
|
+
data.cashRate = price;
|
|
1153
|
+
break;
|
|
1154
|
+
case import_fixparser3.MDEntryType.RecoveryRate:
|
|
1155
|
+
data.recoveryRate = price;
|
|
1156
|
+
break;
|
|
1157
|
+
case import_fixparser3.MDEntryType.RecoveryRateForLong:
|
|
1158
|
+
data.recoveryRateForLong = price;
|
|
1159
|
+
break;
|
|
1160
|
+
case import_fixparser3.MDEntryType.RecoveryRateForShort:
|
|
1161
|
+
data.recoveryRateForShort = price;
|
|
1162
|
+
break;
|
|
1163
|
+
case import_fixparser3.MDEntryType.MarketBid:
|
|
1164
|
+
data.marketBid = price;
|
|
1165
|
+
break;
|
|
1166
|
+
case import_fixparser3.MDEntryType.MarketOffer:
|
|
1167
|
+
data.marketOffer = price;
|
|
1168
|
+
break;
|
|
1169
|
+
case import_fixparser3.MDEntryType.ShortSaleMinPrice:
|
|
1170
|
+
data.shortSaleMinPrice = price;
|
|
1171
|
+
break;
|
|
1172
|
+
case import_fixparser3.MDEntryType.PreviousClosingPrice:
|
|
1173
|
+
data.previousClosingPrice = price;
|
|
1174
|
+
break;
|
|
1175
|
+
case import_fixparser3.MDEntryType.ThresholdLimitPriceBanding:
|
|
1176
|
+
data.thresholdLimitPriceBanding = price;
|
|
1177
|
+
break;
|
|
1178
|
+
case import_fixparser3.MDEntryType.DailyFinancingValue:
|
|
1179
|
+
data.dailyFinancingValue = price;
|
|
1180
|
+
break;
|
|
1181
|
+
case import_fixparser3.MDEntryType.AccruedFinancingValue:
|
|
1182
|
+
data.accruedFinancingValue = price;
|
|
1183
|
+
break;
|
|
1184
|
+
case import_fixparser3.MDEntryType.TWAP:
|
|
1185
|
+
data.twap = price;
|
|
1186
|
+
break;
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
data.spread = data.offer - data.bid;
|
|
1190
|
+
console.log(">>>>>>>>>>>>>>>>>>>>", data);
|
|
878
1191
|
if (!marketDataPrices.has(symbol)) {
|
|
1192
|
+
parser.logger.log({
|
|
1193
|
+
level: "info",
|
|
1194
|
+
message: `Creating new price history array for symbol: ${symbol}`
|
|
1195
|
+
});
|
|
879
1196
|
marketDataPrices.set(symbol, []);
|
|
880
1197
|
}
|
|
881
1198
|
const prices = marketDataPrices.get(symbol);
|
|
882
1199
|
prices.push(data);
|
|
1200
|
+
parser.logger.log({
|
|
1201
|
+
level: "info",
|
|
1202
|
+
message: `Updated price history for ${symbol}. Current size: ${prices.length}`
|
|
1203
|
+
});
|
|
883
1204
|
if (prices.length > maxPriceHistory) {
|
|
884
1205
|
prices.splice(0, prices.length - maxPriceHistory);
|
|
1206
|
+
parser.logger.log({
|
|
1207
|
+
level: "info",
|
|
1208
|
+
message: `Trimmed price history for ${symbol} to ${maxPriceHistory} entries`
|
|
1209
|
+
});
|
|
885
1210
|
}
|
|
886
1211
|
onPriceUpdate?.(symbol, data);
|
|
1212
|
+
const mdReqID = message.getField(import_fixparser3.Fields.MDReqID)?.value;
|
|
1213
|
+
if (mdReqID) {
|
|
1214
|
+
const callback = pendingRequests.get(mdReqID);
|
|
1215
|
+
if (callback) {
|
|
1216
|
+
callback(message);
|
|
1217
|
+
pendingRequests.delete(mdReqID);
|
|
1218
|
+
parser.logger.log({
|
|
1219
|
+
level: "info",
|
|
1220
|
+
message: `Resolved market data request for ID: ${mdReqID}`
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
887
1224
|
} else if (msgType === import_fixparser3.Messages.ExecutionReport) {
|
|
888
1225
|
const reqId = message.getField(import_fixparser3.Fields.ClOrdID)?.value;
|
|
889
1226
|
const callback = pendingRequests.get(reqId);
|
|
@@ -912,7 +1249,7 @@ var MCPLocal = class extends MCPBase {
|
|
|
912
1249
|
*/
|
|
913
1250
|
marketDataPrices = /* @__PURE__ */ new Map();
|
|
914
1251
|
/**
|
|
915
|
-
* Maximum number of price
|
|
1252
|
+
* Maximum number of price history entries to keep per symbol
|
|
916
1253
|
* @private
|
|
917
1254
|
*/
|
|
918
1255
|
MAX_PRICE_HISTORY = 1e5;
|