fixparser-plugin-mcp 9.1.7-5c2fdc7a → 9.1.7-5f64f22e
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 +244 -93
- package/build/cjs/MCPLocal.js.map +2 -2
- package/build/esm/MCPLocal.mjs +245 -103
- package/build/esm/MCPLocal.mjs.map +2 -2
- package/build-examples/cjs/example_mcp_local.js +17 -4
- package/build-examples/cjs/example_mcp_local.js.map +3 -3
- package/build-examples/esm/example_mcp_local.mjs +17 -4
- package/build-examples/esm/example_mcp_local.mjs.map +3 -3
- package/package.json +3 -3
- package/types/MCPLocal.d.ts +1 -1
package/build/cjs/MCPLocal.js
CHANGED
|
@@ -47,7 +47,7 @@ var parseToJSONInputSchema = {
|
|
|
47
47
|
},
|
|
48
48
|
required: ["fixString"]
|
|
49
49
|
};
|
|
50
|
-
var
|
|
50
|
+
var orderSchema = {
|
|
51
51
|
type: "object",
|
|
52
52
|
properties: {
|
|
53
53
|
clOrdID: {
|
|
@@ -57,8 +57,7 @@ var newOrderSingleInputSchema = {
|
|
|
57
57
|
handlInst: {
|
|
58
58
|
type: "string",
|
|
59
59
|
enum: ["1", "2", "3"],
|
|
60
|
-
|
|
61
|
-
description: 'Handling instruction (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "1" for Manual, "2" for Automated, "3" for AutomatedNoIntervention)'
|
|
60
|
+
description: "Handling instruction (1=Manual, 2=Automated, 3=AutomatedNoIntervention)"
|
|
62
61
|
},
|
|
63
62
|
quantity: {
|
|
64
63
|
type: "number",
|
|
@@ -98,13 +97,12 @@ var newOrderSingleInputSchema = {
|
|
|
98
97
|
"R",
|
|
99
98
|
"S"
|
|
100
99
|
],
|
|
101
|
-
|
|
102
|
-
description: 'Order type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "1" for Market, "2" for Limit, "3" for Stop)'
|
|
100
|
+
description: "Order type (1=Market, 2=Limit, 3=Stop)"
|
|
103
101
|
},
|
|
104
102
|
side: {
|
|
105
103
|
type: "string",
|
|
106
104
|
enum: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H"],
|
|
107
|
-
description:
|
|
105
|
+
description: "Order side (1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed)"
|
|
108
106
|
},
|
|
109
107
|
symbol: {
|
|
110
108
|
type: "string",
|
|
@@ -113,11 +111,10 @@ var newOrderSingleInputSchema = {
|
|
|
113
111
|
timeInForce: {
|
|
114
112
|
type: "string",
|
|
115
113
|
enum: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C"],
|
|
116
|
-
|
|
117
|
-
description: 'Time in force (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for Day, "1" for Good Till Cancel, "2" for At Opening, "3" for Immediate or Cancel, "4" for Fill or Kill, "5" for Good Till Crossing, "6" for Good Till Date)'
|
|
114
|
+
description: "Time in force (0=Day, 1=Good Till Cancel, 2=At Opening, 3=Immediate or Cancel, 4=Fill or Kill, 5=Good Till Crossing, 6=Good Till Date)"
|
|
118
115
|
}
|
|
119
116
|
},
|
|
120
|
-
required: ["clOrdID", "quantity", "price", "side", "symbol"]
|
|
117
|
+
required: ["clOrdID", "handlInst", "quantity", "price", "ordType", "side", "symbol", "timeInForce"]
|
|
121
118
|
};
|
|
122
119
|
var marketDataRequestInputSchema = {
|
|
123
120
|
type: "object",
|
|
@@ -125,7 +122,6 @@ var marketDataRequestInputSchema = {
|
|
|
125
122
|
mdUpdateType: {
|
|
126
123
|
type: "string",
|
|
127
124
|
enum: ["0", "1"],
|
|
128
|
-
default: "0",
|
|
129
125
|
description: 'Market data update type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for FullRefresh, "1" for IncrementalRefresh)'
|
|
130
126
|
},
|
|
131
127
|
symbol: {
|
|
@@ -139,7 +135,6 @@ var marketDataRequestInputSchema = {
|
|
|
139
135
|
subscriptionRequestType: {
|
|
140
136
|
type: "string",
|
|
141
137
|
enum: ["0", "1", "2"],
|
|
142
|
-
default: import_fixparser.SubscriptionRequestType.SnapshotAndUpdates,
|
|
143
138
|
description: 'Subscription request type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for Snapshot + Updates, "1" for Snapshot, "2" for Unsubscribe)'
|
|
144
139
|
},
|
|
145
140
|
mdEntryType: {
|
|
@@ -190,14 +185,13 @@ var marketDataRequestInputSchema = {
|
|
|
190
185
|
"i",
|
|
191
186
|
"t"
|
|
192
187
|
],
|
|
193
|
-
default: import_fixparser.MDEntryType.Bid,
|
|
194
188
|
description: 'Market data entry type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for Bid, "1" for Offer, "2" for Trade, "3" for Index Value, "4" for Opening Price)'
|
|
195
189
|
}
|
|
196
190
|
},
|
|
197
191
|
required: ["symbol", "mdReqID"]
|
|
198
192
|
};
|
|
199
193
|
var MCPLocal = class {
|
|
200
|
-
logger;
|
|
194
|
+
// private logger: Logger | undefined;
|
|
201
195
|
parser;
|
|
202
196
|
server = new import_server.Server(
|
|
203
197
|
{
|
|
@@ -215,28 +209,34 @@ var MCPLocal = class {
|
|
|
215
209
|
transport = new import_stdio.StdioServerTransport();
|
|
216
210
|
onReady = void 0;
|
|
217
211
|
pendingRequests = /* @__PURE__ */ new Map();
|
|
212
|
+
verifiedOrders = /* @__PURE__ */ new Map();
|
|
218
213
|
constructor({ logger, onReady }) {
|
|
219
|
-
if (logger && !logger.silent) {
|
|
220
|
-
this.logger = logger;
|
|
221
|
-
}
|
|
222
214
|
if (onReady) this.onReady = onReady;
|
|
223
215
|
}
|
|
224
216
|
async register(parser) {
|
|
225
217
|
this.parser = parser;
|
|
226
|
-
if (parser.logger && !parser.logger.silent) {
|
|
227
|
-
this.logger = parser.logger;
|
|
228
|
-
}
|
|
229
218
|
this.parser.addOnMessageCallback((message) => {
|
|
230
219
|
const msgType = message.messageType;
|
|
231
|
-
if (msgType === import_fixparser.Messages.MarketDataSnapshotFullRefresh || msgType === import_fixparser.Messages.ExecutionReport) {
|
|
232
|
-
const idField = msgType === import_fixparser.Messages.MarketDataSnapshotFullRefresh ? message.getField(import_fixparser.Fields.MDReqID) : message.getField(import_fixparser.Fields.ClOrdID);
|
|
220
|
+
if (msgType === import_fixparser.Messages.MarketDataSnapshotFullRefresh || msgType === import_fixparser.Messages.ExecutionReport || msgType === import_fixparser.Messages.Reject) {
|
|
221
|
+
const idField = msgType === import_fixparser.Messages.MarketDataSnapshotFullRefresh ? message.getField(import_fixparser.Fields.MDReqID) : msgType === import_fixparser.Messages.Reject ? message.getField(import_fixparser.Fields.RefSeqNum) : message.getField(import_fixparser.Fields.ClOrdID);
|
|
233
222
|
if (idField) {
|
|
234
223
|
const id = idField.value;
|
|
235
224
|
if (typeof id === "string" || typeof id === "number") {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
225
|
+
if (msgType === import_fixparser.Messages.Reject) {
|
|
226
|
+
const refMsgType = message.getField(import_fixparser.Fields.RefMsgType);
|
|
227
|
+
if (refMsgType && refMsgType.value === import_fixparser.Messages.NewOrderSingle) {
|
|
228
|
+
const callback = this.pendingRequests.get(String(id));
|
|
229
|
+
if (callback) {
|
|
230
|
+
callback(message);
|
|
231
|
+
this.pendingRequests.delete(String(id));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
} else {
|
|
235
|
+
const callback = this.pendingRequests.get(String(id));
|
|
236
|
+
if (callback) {
|
|
237
|
+
callback(message);
|
|
238
|
+
this.pendingRequests.delete(String(id));
|
|
239
|
+
}
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
}
|
|
@@ -250,17 +250,9 @@ var MCPLocal = class {
|
|
|
250
250
|
}
|
|
251
251
|
addWorkflows() {
|
|
252
252
|
if (!this.parser) {
|
|
253
|
-
this.logger?.log({
|
|
254
|
-
level: "error",
|
|
255
|
-
message: "FIXParser (MCP): -- FIXParser instance not initialized. Ignoring setup of workflows..."
|
|
256
|
-
});
|
|
257
253
|
return;
|
|
258
254
|
}
|
|
259
255
|
if (!this.server) {
|
|
260
|
-
this.logger?.log({
|
|
261
|
-
level: "error",
|
|
262
|
-
message: "FIXParser (MCP): -- MCP Server not initialized. Ignoring setup of workflows..."
|
|
263
|
-
});
|
|
264
256
|
return;
|
|
265
257
|
}
|
|
266
258
|
const validateArgs = (args, schema) => {
|
|
@@ -298,13 +290,18 @@ var MCPLocal = class {
|
|
|
298
290
|
inputSchema: parseToJSONInputSchema
|
|
299
291
|
},
|
|
300
292
|
{
|
|
301
|
-
name: "
|
|
302
|
-
description: "
|
|
303
|
-
inputSchema:
|
|
293
|
+
name: "verifyOrder",
|
|
294
|
+
description: "Verifies all parameters for a New Order Single. This is the first step - verification only, no order is sent.",
|
|
295
|
+
inputSchema: orderSchema
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: "executeOrder",
|
|
299
|
+
description: "Executes a New Order Single after verification. This is the second step - only call after successful verification.",
|
|
300
|
+
inputSchema: orderSchema
|
|
304
301
|
},
|
|
305
302
|
{
|
|
306
303
|
name: "marketDataRequest",
|
|
307
|
-
description: "Sends a request for Market Data with the given symbol",
|
|
304
|
+
description: "Sends a request for Market Data with the given symbol. IMPORTANT: All parameters must be explicitly provided by the user - no assumptions will be made.",
|
|
308
305
|
inputSchema: marketDataRequestInputSchema
|
|
309
306
|
}
|
|
310
307
|
]
|
|
@@ -374,9 +371,77 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
374
371
|
};
|
|
375
372
|
}
|
|
376
373
|
}
|
|
377
|
-
case "
|
|
374
|
+
case "verifyOrder": {
|
|
375
|
+
try {
|
|
376
|
+
const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = validateArgs(args, orderSchema);
|
|
377
|
+
this.verifiedOrders.set(clOrdID, {
|
|
378
|
+
clOrdID,
|
|
379
|
+
handlInst,
|
|
380
|
+
quantity,
|
|
381
|
+
price,
|
|
382
|
+
ordType,
|
|
383
|
+
side,
|
|
384
|
+
symbol,
|
|
385
|
+
timeInForce
|
|
386
|
+
});
|
|
387
|
+
return {
|
|
388
|
+
content: [
|
|
389
|
+
{
|
|
390
|
+
type: "text",
|
|
391
|
+
text: `VERIFICATION: All parameters valid. Ready to proceed with order execution.
|
|
392
|
+
|
|
393
|
+
Parameters verified:
|
|
394
|
+
- ClOrdID: ${clOrdID}
|
|
395
|
+
- HandlInst: ${handlInst}
|
|
396
|
+
- Quantity: ${quantity}
|
|
397
|
+
- Price: ${price}
|
|
398
|
+
- OrdType: ${ordType}
|
|
399
|
+
- Side: ${side}
|
|
400
|
+
- Symbol: ${symbol}
|
|
401
|
+
- TimeInForce: ${timeInForce}
|
|
402
|
+
|
|
403
|
+
To execute this order, call the executeOrder tool with these exact same parameters.`
|
|
404
|
+
}
|
|
405
|
+
]
|
|
406
|
+
};
|
|
407
|
+
} catch (error) {
|
|
408
|
+
return {
|
|
409
|
+
isError: true,
|
|
410
|
+
content: [
|
|
411
|
+
{
|
|
412
|
+
type: "text",
|
|
413
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to verify order parameters"}`
|
|
414
|
+
}
|
|
415
|
+
]
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
case "executeOrder": {
|
|
378
420
|
try {
|
|
379
|
-
const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = validateArgs(args,
|
|
421
|
+
const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = validateArgs(args, orderSchema);
|
|
422
|
+
const verifiedOrder = this.verifiedOrders.get(clOrdID);
|
|
423
|
+
if (!verifiedOrder) {
|
|
424
|
+
return {
|
|
425
|
+
isError: true,
|
|
426
|
+
content: [
|
|
427
|
+
{
|
|
428
|
+
type: "text",
|
|
429
|
+
text: `Error: Order ${clOrdID} has not been verified. Please call verifyOrder first.`
|
|
430
|
+
}
|
|
431
|
+
]
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
if (verifiedOrder.handlInst !== handlInst || verifiedOrder.quantity !== quantity || verifiedOrder.price !== price || verifiedOrder.ordType !== ordType || verifiedOrder.side !== side || verifiedOrder.symbol !== symbol || verifiedOrder.timeInForce !== timeInForce) {
|
|
435
|
+
return {
|
|
436
|
+
isError: true,
|
|
437
|
+
content: [
|
|
438
|
+
{
|
|
439
|
+
type: "text",
|
|
440
|
+
text: "Error: Order parameters do not match the verified order. Please use the exact same parameters that were verified."
|
|
441
|
+
}
|
|
442
|
+
]
|
|
443
|
+
};
|
|
444
|
+
}
|
|
380
445
|
const response = new Promise((resolve) => {
|
|
381
446
|
this.pendingRequests.set(clOrdID, resolve);
|
|
382
447
|
});
|
|
@@ -397,10 +462,6 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
397
462
|
new import_fixparser.Field(import_fixparser.Fields.TransactTime, this.parser?.getTimestamp())
|
|
398
463
|
);
|
|
399
464
|
if (!this.parser?.connected) {
|
|
400
|
-
this.logger?.log({
|
|
401
|
-
level: "error",
|
|
402
|
-
message: "FIXParser (MCP): -- Not connected. Ignoring message."
|
|
403
|
-
});
|
|
404
465
|
return {
|
|
405
466
|
isError: true,
|
|
406
467
|
content: [
|
|
@@ -412,16 +473,13 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
412
473
|
};
|
|
413
474
|
}
|
|
414
475
|
this.parser?.send(order);
|
|
415
|
-
this.logger?.log({
|
|
416
|
-
level: "info",
|
|
417
|
-
message: `FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${order?.description}`
|
|
418
|
-
});
|
|
419
476
|
const fixData = await response;
|
|
477
|
+
this.verifiedOrders.delete(clOrdID);
|
|
420
478
|
return {
|
|
421
479
|
content: [
|
|
422
480
|
{
|
|
423
481
|
type: "text",
|
|
424
|
-
text: `Execution Report for order ${clOrdID}: ${JSON.stringify(fixData.toFIXJSON())}`
|
|
482
|
+
text: fixData.messageType === import_fixparser.Messages.Reject ? `Reject message for order ${clOrdID}: ${JSON.stringify(fixData.toFIXJSON())}` : `Execution Report for order ${clOrdID}: ${JSON.stringify(fixData.toFIXJSON())}`
|
|
425
483
|
}
|
|
426
484
|
]
|
|
427
485
|
};
|
|
@@ -431,7 +489,7 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
431
489
|
content: [
|
|
432
490
|
{
|
|
433
491
|
type: "text",
|
|
434
|
-
text: `Error: ${error instanceof Error ? error.message : "Failed to
|
|
492
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to execute order"}`
|
|
435
493
|
}
|
|
436
494
|
]
|
|
437
495
|
};
|
|
@@ -462,10 +520,6 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
462
520
|
new import_fixparser.Field(import_fixparser.Fields.MDEntryType, mdEntryType)
|
|
463
521
|
);
|
|
464
522
|
if (!this.parser?.connected) {
|
|
465
|
-
this.logger?.log({
|
|
466
|
-
level: "error",
|
|
467
|
-
message: "FIXParser (MCP): -- Not connected. Ignoring message."
|
|
468
|
-
});
|
|
469
523
|
return {
|
|
470
524
|
isError: true,
|
|
471
525
|
content: [
|
|
@@ -477,10 +531,6 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
477
531
|
};
|
|
478
532
|
}
|
|
479
533
|
this.parser?.send(marketDataRequest);
|
|
480
|
-
this.logger?.log({
|
|
481
|
-
level: "info",
|
|
482
|
-
message: `FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${marketDataRequest?.description}`
|
|
483
|
-
});
|
|
484
534
|
const fixData = await response;
|
|
485
535
|
return {
|
|
486
536
|
content: [
|
|
@@ -532,8 +582,8 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
532
582
|
]
|
|
533
583
|
},
|
|
534
584
|
{
|
|
535
|
-
name: "
|
|
536
|
-
description: "
|
|
585
|
+
name: "verifyOrder",
|
|
586
|
+
description: "Verifies all parameters for a New Order Single. This is the first step - verification only, no order is sent.",
|
|
537
587
|
arguments: [
|
|
538
588
|
{
|
|
539
589
|
name: "clOrdID",
|
|
@@ -542,8 +592,8 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
542
592
|
},
|
|
543
593
|
{
|
|
544
594
|
name: "handlInst",
|
|
545
|
-
description: "Handling instruction",
|
|
546
|
-
required:
|
|
595
|
+
description: "Handling instruction (1=Manual, 2=Automated, 3=AutomatedNoIntervention)",
|
|
596
|
+
required: true
|
|
547
597
|
},
|
|
548
598
|
{
|
|
549
599
|
name: "quantity",
|
|
@@ -557,8 +607,8 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
557
607
|
},
|
|
558
608
|
{
|
|
559
609
|
name: "ordType",
|
|
560
|
-
description: "Order type",
|
|
561
|
-
required:
|
|
610
|
+
description: "Order type (1=Market, 2=Limit, 3=Stop)",
|
|
611
|
+
required: true
|
|
562
612
|
},
|
|
563
613
|
{
|
|
564
614
|
name: "side",
|
|
@@ -572,19 +622,65 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
572
622
|
},
|
|
573
623
|
{
|
|
574
624
|
name: "timeInForce",
|
|
575
|
-
description: "Time in force",
|
|
576
|
-
required:
|
|
625
|
+
description: "Time in force (0=Day, 1=Good Till Cancel, 2=At Opening, 3=Immediate or Cancel, 4=Fill or Kill, 5=Good Till Crossing, 6=Good Till Date)",
|
|
626
|
+
required: true
|
|
627
|
+
}
|
|
628
|
+
]
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
name: "executeOrder",
|
|
632
|
+
description: "Executes a New Order Single after verification. This is the second step - only call after successful verification.",
|
|
633
|
+
arguments: [
|
|
634
|
+
{
|
|
635
|
+
name: "clOrdID",
|
|
636
|
+
description: "Client Order ID",
|
|
637
|
+
required: true
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
name: "handlInst",
|
|
641
|
+
description: "Handling instruction (1=Manual, 2=Automated, 3=AutomatedNoIntervention)",
|
|
642
|
+
required: true
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
name: "quantity",
|
|
646
|
+
description: "Order quantity",
|
|
647
|
+
required: true
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
name: "price",
|
|
651
|
+
description: "Order price",
|
|
652
|
+
required: true
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
name: "ordType",
|
|
656
|
+
description: "Order type (1=Market, 2=Limit, 3=Stop)",
|
|
657
|
+
required: true
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
name: "side",
|
|
661
|
+
description: "Order side (1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed)",
|
|
662
|
+
required: true
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
name: "symbol",
|
|
666
|
+
description: "Trading symbol",
|
|
667
|
+
required: true
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
name: "timeInForce",
|
|
671
|
+
description: "Time in force (0=Day, 1=Good Till Cancel, 2=At Opening, 3=Immediate or Cancel, 4=Fill or Kill, 5=Good Till Crossing, 6=Good Till Date)",
|
|
672
|
+
required: true
|
|
577
673
|
}
|
|
578
674
|
]
|
|
579
675
|
},
|
|
580
676
|
{
|
|
581
677
|
name: "marketDataRequest",
|
|
582
|
-
description: "Sends a request for Market Data with the given symbol",
|
|
678
|
+
description: "Sends a request for Market Data with the given symbol. IMPORTANT: All parameters must be explicitly provided by the user - no assumptions will be made.",
|
|
583
679
|
arguments: [
|
|
584
680
|
{
|
|
585
681
|
name: "mdUpdateType",
|
|
586
|
-
description: "Market data update type",
|
|
587
|
-
required:
|
|
682
|
+
description: "Market data update type (0=FullRefresh, 1=IncrementalRefresh)",
|
|
683
|
+
required: true
|
|
588
684
|
},
|
|
589
685
|
{
|
|
590
686
|
name: "symbol",
|
|
@@ -598,13 +694,13 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
598
694
|
},
|
|
599
695
|
{
|
|
600
696
|
name: "subscriptionRequestType",
|
|
601
|
-
description: "Subscription request type",
|
|
602
|
-
required:
|
|
697
|
+
description: "Subscription request type (0=Snapshot + Updates, 1=Snapshot, 2=Unsubscribe)",
|
|
698
|
+
required: true
|
|
603
699
|
},
|
|
604
700
|
{
|
|
605
701
|
name: "mdEntryType",
|
|
606
|
-
description: "Market data entry type",
|
|
607
|
-
required:
|
|
702
|
+
description: "Market data entry type (0=Bid, 1=Offer, 2=Trade, 3=Index Value, 4=Opening Price)",
|
|
703
|
+
required: true
|
|
608
704
|
}
|
|
609
705
|
]
|
|
610
706
|
}
|
|
@@ -642,7 +738,7 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
642
738
|
]
|
|
643
739
|
};
|
|
644
740
|
}
|
|
645
|
-
case "
|
|
741
|
+
case "verifyOrder": {
|
|
646
742
|
const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = args || {};
|
|
647
743
|
return {
|
|
648
744
|
messages: [
|
|
@@ -651,22 +747,68 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
651
747
|
content: {
|
|
652
748
|
type: "text",
|
|
653
749
|
text: [
|
|
654
|
-
"
|
|
750
|
+
"You are an AI assistant that helps users verify FIX New Order Single parameters.",
|
|
751
|
+
"This is STEP 1 of 2 - VERIFICATION ONLY. No order will be sent at this stage.",
|
|
752
|
+
"",
|
|
753
|
+
"You must verify that all required fields are provided and valid:",
|
|
754
|
+
"- ClOrdID (Client Order ID)",
|
|
755
|
+
"- HandlInst (1=Manual, 2=Automated, 3=AutomatedNoIntervention)",
|
|
756
|
+
"- Quantity (Order quantity)",
|
|
757
|
+
"- Price (Order price)",
|
|
758
|
+
"- OrdType (1=Market, 2=Limit, 3=Stop)",
|
|
759
|
+
"- Side (1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed)",
|
|
760
|
+
"- Symbol (Trading symbol)",
|
|
761
|
+
"- TimeInForce (0=Day, 1=Good Till Cancel, 2=At Opening, 3=Immediate or Cancel, 4=Fill or Kill, 5=Good Till Crossing, 6=Good Till Date)",
|
|
762
|
+
"",
|
|
763
|
+
"Current parameters to verify:",
|
|
655
764
|
`- ClOrdID: ${clOrdID}`,
|
|
656
|
-
`- HandlInst: ${handlInst
|
|
765
|
+
`- HandlInst: ${handlInst}`,
|
|
657
766
|
`- Quantity: ${quantity}`,
|
|
658
767
|
`- Price: ${price}`,
|
|
659
|
-
`- OrdType: ${ordType
|
|
660
|
-
`- Side: ${side}
|
|
768
|
+
`- OrdType: ${ordType}`,
|
|
769
|
+
`- Side: ${side}`,
|
|
661
770
|
`- Symbol: ${symbol}`,
|
|
662
|
-
`- TimeInForce: ${timeInForce
|
|
771
|
+
`- TimeInForce: ${timeInForce}`,
|
|
772
|
+
"",
|
|
773
|
+
"If all parameters are valid, respond with:",
|
|
774
|
+
"`VERIFICATION: All parameters valid. Ready to proceed.`",
|
|
663
775
|
"",
|
|
664
|
-
"
|
|
776
|
+
"Otherwise, list the missing or invalid ones.",
|
|
665
777
|
"",
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
778
|
+
"IMPORTANT: This is only verification. To actually send the order, the user must call the executeOrder tool with the same parameters."
|
|
779
|
+
].join("\n")
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
]
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
case "executeOrder": {
|
|
786
|
+
const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = args || {};
|
|
787
|
+
return {
|
|
788
|
+
messages: [
|
|
789
|
+
{
|
|
790
|
+
role: "user",
|
|
791
|
+
content: {
|
|
792
|
+
type: "text",
|
|
793
|
+
text: [
|
|
794
|
+
"You are an AI assistant that helps users execute FIX New Order Single messages.",
|
|
795
|
+
"This is STEP 2 of 2 - EXECUTION. This will send the order to the market.",
|
|
796
|
+
"",
|
|
797
|
+
"IMPORTANT: This tool should only be called after successful verification of all parameters.",
|
|
798
|
+
"",
|
|
799
|
+
"Parameters to execute:",
|
|
800
|
+
`- ClOrdID: ${clOrdID}`,
|
|
801
|
+
`- HandlInst: ${handlInst}`,
|
|
802
|
+
`- Quantity: ${quantity}`,
|
|
803
|
+
`- Price: ${price}`,
|
|
804
|
+
`- OrdType: ${ordType}`,
|
|
805
|
+
`- Side: ${side}`,
|
|
806
|
+
`- Symbol: ${symbol}`,
|
|
807
|
+
`- TimeInForce: ${timeInForce}`,
|
|
808
|
+
"",
|
|
809
|
+
"IMPORTANT: The response will be either:",
|
|
810
|
+
"1. An Execution Report (MsgType=8) if the order was successfully placed",
|
|
811
|
+
"2. A Reject message (MsgType=3) if the order failed to execute (e.g., due to missing or invalid parameters)"
|
|
670
812
|
].join("\n")
|
|
671
813
|
}
|
|
672
814
|
}
|
|
@@ -682,18 +824,27 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
682
824
|
content: {
|
|
683
825
|
type: "text",
|
|
684
826
|
text: [
|
|
685
|
-
"
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
827
|
+
"You are an AI assistant that helps users create FIX Market Data Request messages.",
|
|
828
|
+
"You must **first verify** that all required fields are provided:",
|
|
829
|
+
"- MDUpdateType (0=FullRefresh, 1=IncrementalRefresh)",
|
|
830
|
+
"- Symbol (Trading symbol)",
|
|
831
|
+
"- MDReqID (Market data request ID)",
|
|
832
|
+
"- SubscriptionRequestType (0=Snapshot + Updates, 1=Snapshot, 2=Unsubscribe)",
|
|
833
|
+
"- MDEntryType (0=Bid, 1=Offer, 2=Trade, 3=Index Value, 4=Opening Price)",
|
|
834
|
+
"",
|
|
835
|
+
"Only when all fields are present and valid, respond with:",
|
|
836
|
+
"`VERIFICATION: All parameters valid. Ready to proceed.`",
|
|
691
837
|
"",
|
|
692
|
-
"
|
|
838
|
+
"Otherwise, list the missing or invalid ones.",
|
|
693
839
|
"",
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
840
|
+
"Do not create the FIX message until verification is complete.",
|
|
841
|
+
"",
|
|
842
|
+
"Current parameters:",
|
|
843
|
+
`- MDUpdateType: ${mdUpdateType}`,
|
|
844
|
+
`- Symbol: ${symbol}`,
|
|
845
|
+
`- MDReqID: ${mdReqID}`,
|
|
846
|
+
`- SubscriptionRequestType: ${subscriptionRequestType}`,
|
|
847
|
+
`- MDEntryType: ${mdEntryType}`
|
|
697
848
|
].join("\n")
|
|
698
849
|
}
|
|
699
850
|
}
|