fixparser-plugin-mcp 9.1.7-a24bdbec → 9.1.7-a9d84740
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 +903 -567
- package/build/cjs/MCPLocal.js.map +2 -2
- package/build/esm/MCPLocal.mjs +903 -573
- package/build/esm/MCPLocal.mjs.map +2 -2
- package/build-examples/cjs/example_mcp_local.js +49 -4
- package/build-examples/cjs/example_mcp_local.js.map +4 -4
- package/build-examples/esm/example_mcp_local.mjs +49 -4
- package/build-examples/esm/example_mcp_local.mjs.map +4 -4
- package/package.json +4 -5
- package/types/MCPLocal.d.ts +3 -0
package/build/esm/MCPLocal.mjs
CHANGED
|
@@ -1,179 +1,9 @@
|
|
|
1
1
|
// src/MCPLocal.ts
|
|
2
2
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
-
import {
|
|
5
|
-
CallToolRequestSchema,
|
|
6
|
-
GetPromptRequestSchema,
|
|
7
|
-
ListPromptsRequestSchema,
|
|
8
|
-
ListResourcesRequestSchema,
|
|
9
|
-
ListToolsRequestSchema
|
|
10
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
11
4
|
import { Field, Fields, Messages } from "fixparser";
|
|
12
|
-
|
|
13
|
-
type: "object",
|
|
14
|
-
properties: {
|
|
15
|
-
fixString: {
|
|
16
|
-
type: "string",
|
|
17
|
-
description: "FIX message string to parse"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
required: ["fixString"]
|
|
21
|
-
};
|
|
22
|
-
var parseToJSONInputSchema = {
|
|
23
|
-
type: "object",
|
|
24
|
-
properties: {
|
|
25
|
-
fixString: {
|
|
26
|
-
type: "string",
|
|
27
|
-
description: "FIX message string to parse"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
required: ["fixString"]
|
|
31
|
-
};
|
|
32
|
-
var newOrderSingleInputSchema = {
|
|
33
|
-
type: "object",
|
|
34
|
-
properties: {
|
|
35
|
-
clOrdID: {
|
|
36
|
-
type: "string",
|
|
37
|
-
description: "Client Order ID"
|
|
38
|
-
},
|
|
39
|
-
handlInst: {
|
|
40
|
-
type: "string",
|
|
41
|
-
enum: ["1", "2", "3"],
|
|
42
|
-
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)'
|
|
43
|
-
},
|
|
44
|
-
quantity: {
|
|
45
|
-
type: "number",
|
|
46
|
-
description: "Order quantity"
|
|
47
|
-
},
|
|
48
|
-
price: {
|
|
49
|
-
type: "number",
|
|
50
|
-
description: "Order price"
|
|
51
|
-
},
|
|
52
|
-
ordType: {
|
|
53
|
-
type: "string",
|
|
54
|
-
enum: [
|
|
55
|
-
"1",
|
|
56
|
-
"2",
|
|
57
|
-
"3",
|
|
58
|
-
"4",
|
|
59
|
-
"5",
|
|
60
|
-
"6",
|
|
61
|
-
"7",
|
|
62
|
-
"8",
|
|
63
|
-
"9",
|
|
64
|
-
"A",
|
|
65
|
-
"B",
|
|
66
|
-
"C",
|
|
67
|
-
"D",
|
|
68
|
-
"E",
|
|
69
|
-
"F",
|
|
70
|
-
"G",
|
|
71
|
-
"H",
|
|
72
|
-
"I",
|
|
73
|
-
"J",
|
|
74
|
-
"K",
|
|
75
|
-
"L",
|
|
76
|
-
"M",
|
|
77
|
-
"P",
|
|
78
|
-
"Q",
|
|
79
|
-
"R",
|
|
80
|
-
"S"
|
|
81
|
-
],
|
|
82
|
-
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)'
|
|
83
|
-
},
|
|
84
|
-
side: {
|
|
85
|
-
type: "string",
|
|
86
|
-
enum: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H"],
|
|
87
|
-
description: 'Order side (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "1" for Buy, "2" for Sell, "3" for BuyMinus, "4" for SellPlus, "5" for SellShort, "6" for SellShortExempt, "7" for Undisclosed, "8" for Cross, "9" for CrossShort, "A" for CrossShortExempt, "B" for AsDefined, "C" for Opposite, "D" for Subscribe, "E" for Redeem, "F" for Lend, "G" for Borrow, "H" for SellUndisclosed)'
|
|
88
|
-
},
|
|
89
|
-
symbol: {
|
|
90
|
-
type: "string",
|
|
91
|
-
description: "Trading symbol"
|
|
92
|
-
},
|
|
93
|
-
timeInForce: {
|
|
94
|
-
type: "string",
|
|
95
|
-
enum: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C"],
|
|
96
|
-
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)'
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
required: ["clOrdID", "quantity", "price", "side", "symbol", "handlInst", "ordType", "timeInForce"]
|
|
100
|
-
};
|
|
101
|
-
var marketDataRequestInputSchema = {
|
|
102
|
-
type: "object",
|
|
103
|
-
properties: {
|
|
104
|
-
mdUpdateType: {
|
|
105
|
-
type: "string",
|
|
106
|
-
enum: ["0", "1"],
|
|
107
|
-
description: 'Market data update type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for FullRefresh, "1" for IncrementalRefresh)'
|
|
108
|
-
},
|
|
109
|
-
symbol: {
|
|
110
|
-
type: "string",
|
|
111
|
-
description: "Trading symbol"
|
|
112
|
-
},
|
|
113
|
-
mdReqID: {
|
|
114
|
-
type: "string",
|
|
115
|
-
description: "Market data request ID"
|
|
116
|
-
},
|
|
117
|
-
subscriptionRequestType: {
|
|
118
|
-
type: "string",
|
|
119
|
-
enum: ["0", "1", "2"],
|
|
120
|
-
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)'
|
|
121
|
-
},
|
|
122
|
-
mdEntryType: {
|
|
123
|
-
type: "string",
|
|
124
|
-
enum: [
|
|
125
|
-
"0",
|
|
126
|
-
"1",
|
|
127
|
-
"2",
|
|
128
|
-
"3",
|
|
129
|
-
"4",
|
|
130
|
-
"5",
|
|
131
|
-
"6",
|
|
132
|
-
"7",
|
|
133
|
-
"8",
|
|
134
|
-
"9",
|
|
135
|
-
"A",
|
|
136
|
-
"B",
|
|
137
|
-
"C",
|
|
138
|
-
"D",
|
|
139
|
-
"E",
|
|
140
|
-
"F",
|
|
141
|
-
"G",
|
|
142
|
-
"H",
|
|
143
|
-
"J",
|
|
144
|
-
"K",
|
|
145
|
-
"L",
|
|
146
|
-
"M",
|
|
147
|
-
"N",
|
|
148
|
-
"O",
|
|
149
|
-
"P",
|
|
150
|
-
"Q",
|
|
151
|
-
"S",
|
|
152
|
-
"R",
|
|
153
|
-
"T",
|
|
154
|
-
"U",
|
|
155
|
-
"V",
|
|
156
|
-
"W",
|
|
157
|
-
"X",
|
|
158
|
-
"Y",
|
|
159
|
-
"Z",
|
|
160
|
-
"a",
|
|
161
|
-
"b",
|
|
162
|
-
"c",
|
|
163
|
-
"d",
|
|
164
|
-
"e",
|
|
165
|
-
"g",
|
|
166
|
-
"h",
|
|
167
|
-
"i",
|
|
168
|
-
"t"
|
|
169
|
-
],
|
|
170
|
-
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)'
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
required: ["symbol", "mdReqID"]
|
|
174
|
-
};
|
|
5
|
+
import { z } from "zod";
|
|
175
6
|
var MCPLocal = class {
|
|
176
|
-
// private logger: Logger | undefined;
|
|
177
7
|
parser;
|
|
178
8
|
server = new Server(
|
|
179
9
|
{
|
|
@@ -182,43 +12,235 @@ var MCPLocal = class {
|
|
|
182
12
|
},
|
|
183
13
|
{
|
|
184
14
|
capabilities: {
|
|
185
|
-
tools: {
|
|
186
|
-
|
|
187
|
-
|
|
15
|
+
tools: {
|
|
16
|
+
parse: {
|
|
17
|
+
description: "Parses a FIX message and describes it in plain language",
|
|
18
|
+
parameters: {
|
|
19
|
+
type: "object",
|
|
20
|
+
properties: {
|
|
21
|
+
fixString: { type: "string" }
|
|
22
|
+
},
|
|
23
|
+
required: ["fixString"]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
parseToJSON: {
|
|
27
|
+
description: "Parses a FIX message into JSON",
|
|
28
|
+
parameters: {
|
|
29
|
+
type: "object",
|
|
30
|
+
properties: {
|
|
31
|
+
fixString: { type: "string" }
|
|
32
|
+
},
|
|
33
|
+
required: ["fixString"]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
verifyOrder: {
|
|
37
|
+
description: "Verifies order parameters before execution",
|
|
38
|
+
parameters: {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {
|
|
41
|
+
clOrdID: { type: "string" },
|
|
42
|
+
handlInst: { type: "string", enum: ["1", "2", "3"] },
|
|
43
|
+
quantity: { type: "string" },
|
|
44
|
+
price: { type: "string" },
|
|
45
|
+
ordType: {
|
|
46
|
+
type: "string",
|
|
47
|
+
enum: [
|
|
48
|
+
"1",
|
|
49
|
+
"2",
|
|
50
|
+
"3",
|
|
51
|
+
"4",
|
|
52
|
+
"5",
|
|
53
|
+
"6",
|
|
54
|
+
"7",
|
|
55
|
+
"8",
|
|
56
|
+
"9",
|
|
57
|
+
"A",
|
|
58
|
+
"B",
|
|
59
|
+
"C",
|
|
60
|
+
"D",
|
|
61
|
+
"E",
|
|
62
|
+
"F",
|
|
63
|
+
"G",
|
|
64
|
+
"H",
|
|
65
|
+
"I",
|
|
66
|
+
"J",
|
|
67
|
+
"K",
|
|
68
|
+
"L",
|
|
69
|
+
"M",
|
|
70
|
+
"P",
|
|
71
|
+
"Q",
|
|
72
|
+
"R",
|
|
73
|
+
"S"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
side: {
|
|
77
|
+
type: "string",
|
|
78
|
+
enum: [
|
|
79
|
+
"1",
|
|
80
|
+
"2",
|
|
81
|
+
"3",
|
|
82
|
+
"4",
|
|
83
|
+
"5",
|
|
84
|
+
"6",
|
|
85
|
+
"7",
|
|
86
|
+
"8",
|
|
87
|
+
"9",
|
|
88
|
+
"A",
|
|
89
|
+
"B",
|
|
90
|
+
"C",
|
|
91
|
+
"D",
|
|
92
|
+
"E",
|
|
93
|
+
"F",
|
|
94
|
+
"G",
|
|
95
|
+
"H"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
symbol: { type: "string" },
|
|
99
|
+
timeInForce: {
|
|
100
|
+
type: "string",
|
|
101
|
+
enum: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C"]
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
required: [
|
|
105
|
+
"clOrdID",
|
|
106
|
+
"handlInst",
|
|
107
|
+
"quantity",
|
|
108
|
+
"price",
|
|
109
|
+
"ordType",
|
|
110
|
+
"side",
|
|
111
|
+
"symbol",
|
|
112
|
+
"timeInForce"
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
executeOrder: {
|
|
117
|
+
description: "Executes a verified order",
|
|
118
|
+
parameters: {
|
|
119
|
+
type: "object",
|
|
120
|
+
properties: {
|
|
121
|
+
clOrdID: { type: "string" },
|
|
122
|
+
handlInst: { type: "string", enum: ["1", "2", "3"] },
|
|
123
|
+
quantity: { type: "string" },
|
|
124
|
+
price: { type: "string" },
|
|
125
|
+
ordType: { type: "string" },
|
|
126
|
+
side: { type: "string" },
|
|
127
|
+
symbol: { type: "string" },
|
|
128
|
+
timeInForce: { type: "string" }
|
|
129
|
+
},
|
|
130
|
+
required: [
|
|
131
|
+
"clOrdID",
|
|
132
|
+
"handlInst",
|
|
133
|
+
"quantity",
|
|
134
|
+
"price",
|
|
135
|
+
"ordType",
|
|
136
|
+
"side",
|
|
137
|
+
"symbol",
|
|
138
|
+
"timeInForce"
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
marketDataRequest: {
|
|
143
|
+
description: "Requests market data for specified symbols",
|
|
144
|
+
parameters: {
|
|
145
|
+
type: "object",
|
|
146
|
+
properties: {
|
|
147
|
+
mdUpdateType: { type: "string", enum: ["0", "1"] },
|
|
148
|
+
symbols: { type: "array", items: { type: "string" } },
|
|
149
|
+
mdReqID: { type: "string" },
|
|
150
|
+
subscriptionRequestType: { type: "string", enum: ["0", "1", "2"] },
|
|
151
|
+
mdEntryTypes: { type: "array", items: { type: "string" } }
|
|
152
|
+
},
|
|
153
|
+
required: ["mdUpdateType", "symbols", "mdReqID", "subscriptionRequestType", "mdEntryTypes"]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
resources: {
|
|
158
|
+
greeting: {
|
|
159
|
+
description: "A simple greeting resource",
|
|
160
|
+
uri: "greeting-resource"
|
|
161
|
+
},
|
|
162
|
+
stockGraph: {
|
|
163
|
+
description: "Generates a price chart for a given symbol",
|
|
164
|
+
uri: "stockGraph/{symbol}"
|
|
165
|
+
},
|
|
166
|
+
stockPriceHistory: {
|
|
167
|
+
description: "Returns price history for a given symbol",
|
|
168
|
+
uri: "stockPriceHistory/{symbol}"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
188
171
|
}
|
|
189
172
|
}
|
|
190
173
|
);
|
|
191
174
|
transport = new StdioServerTransport();
|
|
192
175
|
onReady = void 0;
|
|
193
176
|
pendingRequests = /* @__PURE__ */ new Map();
|
|
177
|
+
verifiedOrders = /* @__PURE__ */ new Map();
|
|
178
|
+
// Store market data prices with timestamps
|
|
179
|
+
marketDataPrices = /* @__PURE__ */ new Map();
|
|
180
|
+
MAX_PRICE_HISTORY = 1e5;
|
|
181
|
+
// Maximum number of price points to store per symbol
|
|
194
182
|
constructor({ logger, onReady }) {
|
|
195
183
|
if (onReady) this.onReady = onReady;
|
|
196
184
|
}
|
|
197
185
|
async register(parser) {
|
|
198
186
|
this.parser = parser;
|
|
199
187
|
this.parser.addOnMessageCallback((message) => {
|
|
188
|
+
this.parser?.logger.log({
|
|
189
|
+
level: "info",
|
|
190
|
+
message: `MCP Server received message: ${message.messageType}: ${message.description}`
|
|
191
|
+
});
|
|
200
192
|
const msgType = message.messageType;
|
|
201
|
-
if (msgType === Messages.MarketDataSnapshotFullRefresh || msgType === Messages.ExecutionReport || msgType === Messages.Reject) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
193
|
+
if (msgType === Messages.MarketDataSnapshotFullRefresh || msgType === Messages.ExecutionReport || msgType === Messages.Reject || msgType === Messages.MarketDataIncrementalRefresh) {
|
|
194
|
+
this.parser?.logger.log({
|
|
195
|
+
level: "info",
|
|
196
|
+
message: `MCP Server handling message type: ${msgType}`
|
|
197
|
+
});
|
|
198
|
+
let id;
|
|
199
|
+
if (msgType === Messages.MarketDataIncrementalRefresh || msgType === Messages.MarketDataSnapshotFullRefresh) {
|
|
200
|
+
const symbol = message.getField(Fields.Symbol);
|
|
201
|
+
const price = message.getField(Fields.MDEntryPx);
|
|
202
|
+
const timestamp = message.getField(Fields.MDEntryTime)?.value || Date.now();
|
|
203
|
+
if (symbol?.value && price?.value) {
|
|
204
|
+
const symbolStr = String(symbol.value);
|
|
205
|
+
const priceNum = Number(price.value);
|
|
206
|
+
const priceHistory = this.marketDataPrices.get(symbolStr) || [];
|
|
207
|
+
priceHistory.push({
|
|
208
|
+
timestamp: Number(timestamp),
|
|
209
|
+
price: priceNum
|
|
210
|
+
});
|
|
211
|
+
if (priceHistory.length > this.MAX_PRICE_HISTORY) {
|
|
212
|
+
priceHistory.shift();
|
|
221
213
|
}
|
|
214
|
+
this.marketDataPrices.set(symbolStr, priceHistory);
|
|
215
|
+
this.parser?.logger.log({
|
|
216
|
+
level: "info",
|
|
217
|
+
message: `MCP Server added ${symbol}: ${priceNum}`
|
|
218
|
+
});
|
|
219
|
+
this.server.notification({
|
|
220
|
+
method: "priceUpdate",
|
|
221
|
+
params: {
|
|
222
|
+
symbol: symbolStr,
|
|
223
|
+
price: priceNum,
|
|
224
|
+
timestamp: Number(timestamp)
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (msgType === Messages.MarketDataSnapshotFullRefresh) {
|
|
230
|
+
const mdReqID = message.getField(Fields.MDReqID);
|
|
231
|
+
if (mdReqID) id = String(mdReqID.value);
|
|
232
|
+
} else if (msgType === Messages.ExecutionReport) {
|
|
233
|
+
const clOrdID = message.getField(Fields.ClOrdID);
|
|
234
|
+
if (clOrdID) id = String(clOrdID.value);
|
|
235
|
+
} else if (msgType === Messages.Reject) {
|
|
236
|
+
const refSeqNum = message.getField(Fields.RefSeqNum);
|
|
237
|
+
if (refSeqNum) id = String(refSeqNum.value);
|
|
238
|
+
}
|
|
239
|
+
if (id) {
|
|
240
|
+
const callback = this.pendingRequests.get(id);
|
|
241
|
+
if (callback) {
|
|
242
|
+
callback(message);
|
|
243
|
+
this.pendingRequests.delete(id);
|
|
222
244
|
}
|
|
223
245
|
}
|
|
224
246
|
}
|
|
@@ -236,433 +258,741 @@ var MCPLocal = class {
|
|
|
236
258
|
if (!this.server) {
|
|
237
259
|
return;
|
|
238
260
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}
|
|
261
|
+
this.server.setRequestHandler(
|
|
262
|
+
z.object({ method: z.literal("resources/list") }),
|
|
263
|
+
async (request, extra) => {
|
|
264
|
+
return {
|
|
265
|
+
resources: [
|
|
266
|
+
{
|
|
267
|
+
name: "greeting",
|
|
268
|
+
description: "A simple greeting resource",
|
|
269
|
+
uri: "greeting-resource"
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
};
|
|
252
273
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
274
|
+
);
|
|
275
|
+
this.server.setRequestHandler(
|
|
276
|
+
z.object({ method: z.literal("resources/templates/list") }),
|
|
277
|
+
async (request, extra) => {
|
|
278
|
+
return {
|
|
279
|
+
resourceTemplates: [
|
|
280
|
+
{
|
|
281
|
+
name: "stockGraph",
|
|
282
|
+
description: "Generates a price chart for a given symbol",
|
|
283
|
+
uriTemplate: "stockGraph/{symbol}",
|
|
284
|
+
parameters: {
|
|
285
|
+
type: "object",
|
|
286
|
+
properties: {
|
|
287
|
+
symbol: { type: "string" }
|
|
288
|
+
},
|
|
289
|
+
required: ["symbol"]
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
name: "stockPriceHistory",
|
|
294
|
+
description: "Returns price history for a given symbol",
|
|
295
|
+
uriTemplate: "stockPriceHistory/{symbol}",
|
|
296
|
+
parameters: {
|
|
297
|
+
type: "object",
|
|
298
|
+
properties: {
|
|
299
|
+
symbol: { type: "string" }
|
|
300
|
+
},
|
|
301
|
+
required: ["symbol"]
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
]
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
);
|
|
308
|
+
this.server.setRequestHandler(
|
|
309
|
+
z.object({ method: z.literal("tools/list") }),
|
|
310
|
+
async (request, extra) => {
|
|
311
|
+
return {
|
|
312
|
+
tools: [
|
|
313
|
+
{
|
|
314
|
+
name: "parse",
|
|
315
|
+
description: "Parses a FIX message and describes it in plain language",
|
|
316
|
+
inputSchema: {
|
|
317
|
+
type: "object",
|
|
318
|
+
properties: {
|
|
319
|
+
fixString: { type: "string" }
|
|
320
|
+
},
|
|
321
|
+
required: ["fixString"]
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: "parseToJSON",
|
|
326
|
+
description: "Parses a FIX message into JSON",
|
|
327
|
+
inputSchema: {
|
|
328
|
+
type: "object",
|
|
329
|
+
properties: {
|
|
330
|
+
fixString: { type: "string" }
|
|
331
|
+
},
|
|
332
|
+
required: ["fixString"]
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
name: "verifyOrder",
|
|
337
|
+
description: "Verifies order parameters before execution",
|
|
338
|
+
inputSchema: {
|
|
339
|
+
type: "object",
|
|
340
|
+
properties: {
|
|
341
|
+
clOrdID: { type: "string" },
|
|
342
|
+
handlInst: { type: "string", enum: ["1", "2", "3"] },
|
|
343
|
+
quantity: { type: "string" },
|
|
344
|
+
price: { type: "string" },
|
|
345
|
+
ordType: {
|
|
346
|
+
type: "string",
|
|
347
|
+
enum: [
|
|
348
|
+
"1",
|
|
349
|
+
"2",
|
|
350
|
+
"3",
|
|
351
|
+
"4",
|
|
352
|
+
"5",
|
|
353
|
+
"6",
|
|
354
|
+
"7",
|
|
355
|
+
"8",
|
|
356
|
+
"9",
|
|
357
|
+
"A",
|
|
358
|
+
"B",
|
|
359
|
+
"C",
|
|
360
|
+
"D",
|
|
361
|
+
"E",
|
|
362
|
+
"F",
|
|
363
|
+
"G",
|
|
364
|
+
"H",
|
|
365
|
+
"I",
|
|
366
|
+
"J",
|
|
367
|
+
"K",
|
|
368
|
+
"L",
|
|
369
|
+
"M",
|
|
370
|
+
"P",
|
|
371
|
+
"Q",
|
|
372
|
+
"R",
|
|
373
|
+
"S"
|
|
374
|
+
]
|
|
375
|
+
},
|
|
376
|
+
side: {
|
|
377
|
+
type: "string",
|
|
378
|
+
enum: [
|
|
379
|
+
"1",
|
|
380
|
+
"2",
|
|
381
|
+
"3",
|
|
382
|
+
"4",
|
|
383
|
+
"5",
|
|
384
|
+
"6",
|
|
385
|
+
"7",
|
|
386
|
+
"8",
|
|
387
|
+
"9",
|
|
388
|
+
"A",
|
|
389
|
+
"B",
|
|
390
|
+
"C",
|
|
391
|
+
"D",
|
|
392
|
+
"E",
|
|
393
|
+
"F",
|
|
394
|
+
"G",
|
|
395
|
+
"H"
|
|
396
|
+
]
|
|
397
|
+
},
|
|
398
|
+
symbol: { type: "string" },
|
|
399
|
+
timeInForce: {
|
|
400
|
+
type: "string",
|
|
401
|
+
enum: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C"]
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
required: [
|
|
405
|
+
"clOrdID",
|
|
406
|
+
"handlInst",
|
|
407
|
+
"quantity",
|
|
408
|
+
"price",
|
|
409
|
+
"ordType",
|
|
410
|
+
"side",
|
|
411
|
+
"symbol",
|
|
412
|
+
"timeInForce"
|
|
413
|
+
]
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
name: "executeOrder",
|
|
418
|
+
description: "Executes a verified order",
|
|
419
|
+
inputSchema: {
|
|
420
|
+
type: "object",
|
|
421
|
+
properties: {
|
|
422
|
+
clOrdID: { type: "string" },
|
|
423
|
+
handlInst: { type: "string", enum: ["1", "2", "3"] },
|
|
424
|
+
quantity: { type: "string" },
|
|
425
|
+
price: { type: "string" },
|
|
426
|
+
ordType: { type: "string" },
|
|
427
|
+
side: { type: "string" },
|
|
428
|
+
symbol: { type: "string" },
|
|
429
|
+
timeInForce: { type: "string" }
|
|
430
|
+
},
|
|
431
|
+
required: [
|
|
432
|
+
"clOrdID",
|
|
433
|
+
"handlInst",
|
|
434
|
+
"quantity",
|
|
435
|
+
"price",
|
|
436
|
+
"ordType",
|
|
437
|
+
"side",
|
|
438
|
+
"symbol",
|
|
439
|
+
"timeInForce"
|
|
440
|
+
]
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
name: "marketDataRequest",
|
|
445
|
+
description: "Requests market data for specified symbols",
|
|
446
|
+
inputSchema: {
|
|
447
|
+
type: "object",
|
|
448
|
+
properties: {
|
|
449
|
+
mdUpdateType: { type: "string", enum: ["0", "1"] },
|
|
450
|
+
symbols: { type: "array", items: { type: "string" } },
|
|
451
|
+
mdReqID: { type: "string" },
|
|
452
|
+
subscriptionRequestType: { type: "string", enum: ["0", "1", "2"] },
|
|
453
|
+
mdEntryTypes: { type: "array", items: { type: "string" } }
|
|
454
|
+
},
|
|
455
|
+
required: [
|
|
456
|
+
"mdUpdateType",
|
|
457
|
+
"symbols",
|
|
458
|
+
"mdReqID",
|
|
459
|
+
"subscriptionRequestType",
|
|
460
|
+
"mdEntryTypes"
|
|
461
|
+
]
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
]
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
);
|
|
468
|
+
this.server.setRequestHandler(
|
|
469
|
+
z.object({
|
|
470
|
+
method: z.literal("tools/call"),
|
|
471
|
+
params: z.object({
|
|
472
|
+
name: z.string(),
|
|
473
|
+
arguments: z.any(),
|
|
474
|
+
_meta: z.object({
|
|
475
|
+
progressToken: z.number()
|
|
476
|
+
})
|
|
477
|
+
})
|
|
478
|
+
}),
|
|
479
|
+
async (request, extra) => {
|
|
480
|
+
const { name, arguments: args } = request.params;
|
|
481
|
+
switch (name) {
|
|
482
|
+
case "parse":
|
|
483
|
+
try {
|
|
484
|
+
const parsedMessage = this.parser?.parse(args.fixString);
|
|
485
|
+
if (!parsedMessage || parsedMessage.length === 0) {
|
|
486
|
+
return {
|
|
487
|
+
contents: [
|
|
488
|
+
{
|
|
489
|
+
type: "text",
|
|
490
|
+
text: "Error: Failed to parse FIX string",
|
|
491
|
+
uri: "parse"
|
|
492
|
+
}
|
|
493
|
+
],
|
|
494
|
+
isError: true
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
return {
|
|
498
|
+
contents: [
|
|
499
|
+
{
|
|
500
|
+
type: "text",
|
|
501
|
+
text: `${parsedMessage[0].description}
|
|
502
|
+
${parsedMessage[0].messageTypeDescription}`,
|
|
503
|
+
uri: "parse"
|
|
504
|
+
}
|
|
505
|
+
]
|
|
506
|
+
};
|
|
507
|
+
} catch (error) {
|
|
508
|
+
return {
|
|
509
|
+
contents: [
|
|
510
|
+
{
|
|
511
|
+
type: "text",
|
|
512
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to parse FIX string"}`,
|
|
513
|
+
uri: "parse"
|
|
514
|
+
}
|
|
515
|
+
],
|
|
516
|
+
isError: true
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
case "parseToJSON":
|
|
520
|
+
try {
|
|
521
|
+
const parsedMessage = this.parser?.parse(args.fixString);
|
|
522
|
+
if (!parsedMessage || parsedMessage.length === 0) {
|
|
523
|
+
return {
|
|
524
|
+
contents: [
|
|
525
|
+
{
|
|
526
|
+
type: "text",
|
|
527
|
+
text: "Error: Failed to parse FIX string",
|
|
528
|
+
uri: "parseToJSON"
|
|
529
|
+
}
|
|
530
|
+
],
|
|
531
|
+
isError: true
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
return {
|
|
535
|
+
contents: [
|
|
536
|
+
{
|
|
537
|
+
type: "text",
|
|
538
|
+
text: `${parsedMessage[0].toFIXJSON()}`,
|
|
539
|
+
uri: "parseToJSON"
|
|
540
|
+
}
|
|
541
|
+
]
|
|
542
|
+
};
|
|
543
|
+
} catch (error) {
|
|
294
544
|
return {
|
|
295
|
-
|
|
296
|
-
|
|
545
|
+
contents: [
|
|
546
|
+
{
|
|
547
|
+
type: "text",
|
|
548
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to parse FIX string"}`,
|
|
549
|
+
uri: "parseToJSON"
|
|
550
|
+
}
|
|
551
|
+
],
|
|
552
|
+
isError: true
|
|
297
553
|
};
|
|
298
554
|
}
|
|
555
|
+
case "verifyOrder":
|
|
556
|
+
try {
|
|
557
|
+
this.verifiedOrders.set(args.clOrdID, {
|
|
558
|
+
clOrdID: args.clOrdID,
|
|
559
|
+
handlInst: args.handlInst,
|
|
560
|
+
quantity: Number.parseFloat(args.quantity),
|
|
561
|
+
price: Number.parseFloat(args.price),
|
|
562
|
+
ordType: args.ordType,
|
|
563
|
+
side: args.side,
|
|
564
|
+
symbol: args.symbol,
|
|
565
|
+
timeInForce: args.timeInForce
|
|
566
|
+
});
|
|
567
|
+
const ordTypeNames = {
|
|
568
|
+
"1": "Market",
|
|
569
|
+
"2": "Limit",
|
|
570
|
+
"3": "Stop",
|
|
571
|
+
"4": "StopLimit",
|
|
572
|
+
"5": "MarketOnClose",
|
|
573
|
+
"6": "WithOrWithout",
|
|
574
|
+
"7": "LimitOrBetter",
|
|
575
|
+
"8": "LimitWithOrWithout",
|
|
576
|
+
"9": "OnBasis",
|
|
577
|
+
A: "OnClose",
|
|
578
|
+
B: "LimitOnClose",
|
|
579
|
+
C: "ForexMarket",
|
|
580
|
+
D: "PreviouslyQuoted",
|
|
581
|
+
E: "PreviouslyIndicated",
|
|
582
|
+
F: "ForexLimit",
|
|
583
|
+
G: "ForexSwap",
|
|
584
|
+
H: "ForexPreviouslyQuoted",
|
|
585
|
+
I: "Funari",
|
|
586
|
+
J: "MarketIfTouched",
|
|
587
|
+
K: "MarketWithLeftOverAsLimit",
|
|
588
|
+
L: "PreviousFundValuationPoint",
|
|
589
|
+
M: "NextFundValuationPoint",
|
|
590
|
+
P: "Pegged",
|
|
591
|
+
Q: "CounterOrderSelection",
|
|
592
|
+
R: "StopOnBidOrOffer",
|
|
593
|
+
S: "StopLimitOnBidOrOffer"
|
|
594
|
+
};
|
|
595
|
+
const sideNames = {
|
|
596
|
+
"1": "Buy",
|
|
597
|
+
"2": "Sell",
|
|
598
|
+
"3": "BuyMinus",
|
|
599
|
+
"4": "SellPlus",
|
|
600
|
+
"5": "SellShort",
|
|
601
|
+
"6": "SellShortExempt",
|
|
602
|
+
"7": "Undisclosed",
|
|
603
|
+
"8": "Cross",
|
|
604
|
+
"9": "CrossShort",
|
|
605
|
+
A: "CrossShortExempt",
|
|
606
|
+
B: "AsDefined",
|
|
607
|
+
C: "Opposite",
|
|
608
|
+
D: "Subscribe",
|
|
609
|
+
E: "Redeem",
|
|
610
|
+
F: "Lend",
|
|
611
|
+
G: "Borrow",
|
|
612
|
+
H: "SellUndisclosed"
|
|
613
|
+
};
|
|
614
|
+
const timeInForceNames = {
|
|
615
|
+
"0": "Day",
|
|
616
|
+
"1": "GoodTillCancel",
|
|
617
|
+
"2": "AtTheOpening",
|
|
618
|
+
"3": "ImmediateOrCancel",
|
|
619
|
+
"4": "FillOrKill",
|
|
620
|
+
"5": "GoodTillCrossing",
|
|
621
|
+
"6": "GoodTillDate",
|
|
622
|
+
"7": "AtTheClose",
|
|
623
|
+
"8": "GoodThroughCrossing",
|
|
624
|
+
"9": "AtCrossing",
|
|
625
|
+
A: "GoodForTime",
|
|
626
|
+
B: "GoodForAuction",
|
|
627
|
+
C: "GoodForMonth"
|
|
628
|
+
};
|
|
629
|
+
const handlInstNames = {
|
|
630
|
+
"1": "AutomatedExecutionNoIntervention",
|
|
631
|
+
"2": "AutomatedExecutionInterventionOK",
|
|
632
|
+
"3": "ManualOrder"
|
|
633
|
+
};
|
|
634
|
+
return {
|
|
635
|
+
contents: [
|
|
636
|
+
{
|
|
637
|
+
type: "text",
|
|
638
|
+
text: `VERIFICATION: All parameters valid. Ready to proceed with order execution.
|
|
639
|
+
|
|
640
|
+
Parameters verified:
|
|
641
|
+
- ClOrdID: ${args.clOrdID}
|
|
642
|
+
- HandlInst: ${args.handlInst} (${handlInstNames[args.handlInst]})
|
|
643
|
+
- Quantity: ${args.quantity}
|
|
644
|
+
- Price: ${args.price}
|
|
645
|
+
- OrdType: ${args.ordType} (${ordTypeNames[args.ordType]})
|
|
646
|
+
- Side: ${args.side} (${sideNames[args.side]})
|
|
647
|
+
- Symbol: ${args.symbol}
|
|
648
|
+
- TimeInForce: ${args.timeInForce} (${timeInForceNames[args.timeInForce]})
|
|
649
|
+
|
|
650
|
+
To execute this order, call the executeOrder tool with these exact same parameters.`,
|
|
651
|
+
uri: "verifyOrder"
|
|
652
|
+
}
|
|
653
|
+
]
|
|
654
|
+
};
|
|
655
|
+
} catch (error) {
|
|
656
|
+
return {
|
|
657
|
+
contents: [
|
|
658
|
+
{
|
|
659
|
+
type: "text",
|
|
660
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to verify order parameters"}`,
|
|
661
|
+
uri: "verifyOrder"
|
|
662
|
+
}
|
|
663
|
+
],
|
|
664
|
+
isError: true
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
case "executeOrder":
|
|
668
|
+
try {
|
|
669
|
+
const verifiedOrder = this.verifiedOrders.get(args.clOrdID);
|
|
670
|
+
if (!verifiedOrder) {
|
|
671
|
+
return {
|
|
672
|
+
contents: [
|
|
673
|
+
{
|
|
674
|
+
type: "text",
|
|
675
|
+
text: `Error: Order ${args.clOrdID} has not been verified. Please call verifyOrder first.`,
|
|
676
|
+
uri: "executeOrder"
|
|
677
|
+
}
|
|
678
|
+
],
|
|
679
|
+
isError: true
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
if (verifiedOrder.handlInst !== args.handlInst || verifiedOrder.quantity !== Number.parseFloat(args.quantity) || verifiedOrder.price !== Number.parseFloat(args.price) || verifiedOrder.ordType !== args.ordType || verifiedOrder.side !== args.side || verifiedOrder.symbol !== args.symbol || verifiedOrder.timeInForce !== args.timeInForce) {
|
|
683
|
+
return {
|
|
684
|
+
contents: [
|
|
685
|
+
{
|
|
686
|
+
type: "text",
|
|
687
|
+
text: "Error: Order parameters do not match the verified order. Please use the exact same parameters that were verified.",
|
|
688
|
+
uri: "executeOrder"
|
|
689
|
+
}
|
|
690
|
+
],
|
|
691
|
+
isError: true
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
const response = new Promise((resolve) => {
|
|
695
|
+
this.pendingRequests.set(args.clOrdID, resolve);
|
|
696
|
+
});
|
|
697
|
+
const order = this.parser?.createMessage(
|
|
698
|
+
new Field(Fields.MsgType, Messages.NewOrderSingle),
|
|
699
|
+
new Field(Fields.MsgSeqNum, this.parser?.getNextTargetMsgSeqNum()),
|
|
700
|
+
new Field(Fields.SenderCompID, this.parser?.sender),
|
|
701
|
+
new Field(Fields.TargetCompID, this.parser?.target),
|
|
702
|
+
new Field(Fields.SendingTime, this.parser?.getTimestamp()),
|
|
703
|
+
new Field(Fields.ClOrdID, args.clOrdID),
|
|
704
|
+
new Field(Fields.Side, args.side),
|
|
705
|
+
new Field(Fields.Symbol, args.symbol),
|
|
706
|
+
new Field(Fields.OrderQty, Number.parseFloat(args.quantity)),
|
|
707
|
+
new Field(Fields.Price, Number.parseFloat(args.price)),
|
|
708
|
+
new Field(Fields.OrdType, args.ordType),
|
|
709
|
+
new Field(Fields.HandlInst, args.handlInst),
|
|
710
|
+
new Field(Fields.TimeInForce, args.timeInForce),
|
|
711
|
+
new Field(Fields.TransactTime, this.parser?.getTimestamp())
|
|
712
|
+
);
|
|
713
|
+
if (!this.parser?.connected) {
|
|
714
|
+
return {
|
|
715
|
+
contents: [
|
|
716
|
+
{
|
|
717
|
+
type: "text",
|
|
718
|
+
text: "Error: Not connected. Ignoring message.",
|
|
719
|
+
uri: "executeOrder"
|
|
720
|
+
}
|
|
721
|
+
],
|
|
722
|
+
isError: true
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
this.parser?.send(order);
|
|
726
|
+
const fixData = await response;
|
|
727
|
+
this.verifiedOrders.delete(args.clOrdID);
|
|
728
|
+
return {
|
|
729
|
+
contents: [
|
|
730
|
+
{
|
|
731
|
+
type: "text",
|
|
732
|
+
text: fixData.messageType === Messages.Reject ? `Reject message for order ${args.clOrdID}: ${JSON.stringify(fixData.toFIXJSON())}` : `Execution Report for order ${args.clOrdID}: ${JSON.stringify(fixData.toFIXJSON())}`,
|
|
733
|
+
uri: "executeOrder"
|
|
734
|
+
}
|
|
735
|
+
]
|
|
736
|
+
};
|
|
737
|
+
} catch (error) {
|
|
738
|
+
return {
|
|
739
|
+
contents: [
|
|
740
|
+
{
|
|
741
|
+
type: "text",
|
|
742
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to execute order"}`,
|
|
743
|
+
uri: "executeOrder"
|
|
744
|
+
}
|
|
745
|
+
],
|
|
746
|
+
isError: true
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
case "marketDataRequest":
|
|
750
|
+
try {
|
|
751
|
+
const response = new Promise((resolve) => {
|
|
752
|
+
this.pendingRequests.set(args.mdReqID, resolve);
|
|
753
|
+
});
|
|
754
|
+
const messageFields = [
|
|
755
|
+
new Field(Fields.MsgType, Messages.MarketDataRequest),
|
|
756
|
+
new Field(Fields.SenderCompID, this.parser?.sender),
|
|
757
|
+
new Field(Fields.MsgSeqNum, this.parser?.getNextTargetMsgSeqNum()),
|
|
758
|
+
new Field(Fields.TargetCompID, this.parser?.target),
|
|
759
|
+
new Field(Fields.SendingTime, this.parser?.getTimestamp()),
|
|
760
|
+
new Field(Fields.MDReqID, args.mdReqID),
|
|
761
|
+
new Field(Fields.SubscriptionRequestType, args.subscriptionRequestType),
|
|
762
|
+
new Field(Fields.MarketDepth, 0),
|
|
763
|
+
new Field(Fields.MDUpdateType, args.mdUpdateType)
|
|
764
|
+
];
|
|
765
|
+
messageFields.push(new Field(Fields.NoRelatedSym, args.symbols.length));
|
|
766
|
+
args.symbols.forEach((symbol) => {
|
|
767
|
+
messageFields.push(new Field(Fields.Symbol, symbol));
|
|
768
|
+
});
|
|
769
|
+
messageFields.push(new Field(Fields.NoMDEntryTypes, args.mdEntryTypes.length));
|
|
770
|
+
args.mdEntryTypes.forEach((entryType) => {
|
|
771
|
+
messageFields.push(new Field(Fields.MDEntryType, entryType));
|
|
772
|
+
});
|
|
773
|
+
const mdr = this.parser?.createMessage(...messageFields);
|
|
774
|
+
if (!this.parser?.connected) {
|
|
775
|
+
return {
|
|
776
|
+
contents: [
|
|
777
|
+
{
|
|
778
|
+
type: "text",
|
|
779
|
+
text: "Error: Not connected. Ignoring message.",
|
|
780
|
+
uri: "marketDataRequest"
|
|
781
|
+
}
|
|
782
|
+
],
|
|
783
|
+
isError: true
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
this.parser?.send(mdr);
|
|
787
|
+
const fixData = await response;
|
|
788
|
+
return {
|
|
789
|
+
contents: [
|
|
790
|
+
{
|
|
791
|
+
type: "text",
|
|
792
|
+
text: `Market data for ${args.symbols.join(", ")}: ${JSON.stringify(fixData.toFIXJSON())}`,
|
|
793
|
+
uri: "marketDataRequest"
|
|
794
|
+
}
|
|
795
|
+
]
|
|
796
|
+
};
|
|
797
|
+
} catch (error) {
|
|
798
|
+
return {
|
|
799
|
+
contents: [
|
|
800
|
+
{
|
|
801
|
+
type: "text",
|
|
802
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to request market data"}`,
|
|
803
|
+
uri: "marketDataRequest"
|
|
804
|
+
}
|
|
805
|
+
],
|
|
806
|
+
isError: true
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
default:
|
|
299
810
|
return {
|
|
300
|
-
|
|
811
|
+
contents: [
|
|
301
812
|
{
|
|
302
813
|
type: "text",
|
|
303
|
-
text:
|
|
304
|
-
|
|
814
|
+
text: `Tool not found: ${name}`,
|
|
815
|
+
uri: name
|
|
305
816
|
}
|
|
306
|
-
]
|
|
817
|
+
],
|
|
818
|
+
isError: true
|
|
307
819
|
};
|
|
308
|
-
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
);
|
|
823
|
+
this.server.setRequestHandler(
|
|
824
|
+
z.object({
|
|
825
|
+
method: z.literal("resources/read"),
|
|
826
|
+
params: z.object({
|
|
827
|
+
uri: z.string()
|
|
828
|
+
})
|
|
829
|
+
}),
|
|
830
|
+
async (request, extra) => {
|
|
831
|
+
const { uri } = request.params;
|
|
832
|
+
switch (uri) {
|
|
833
|
+
case "greeting-resource":
|
|
309
834
|
return {
|
|
310
|
-
|
|
311
|
-
content: [
|
|
835
|
+
contents: [
|
|
312
836
|
{
|
|
313
837
|
type: "text",
|
|
314
|
-
text:
|
|
838
|
+
text: "Hello, world!",
|
|
839
|
+
uri: "greeting-resource"
|
|
315
840
|
}
|
|
316
841
|
]
|
|
317
842
|
};
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
case "parseToJSON": {
|
|
321
|
-
try {
|
|
322
|
-
const { fixString } = validateArgs(args, parseToJSONInputSchema);
|
|
323
|
-
const parsedMessage = this.parser?.parse(fixString);
|
|
324
|
-
if (!parsedMessage || parsedMessage.length === 0) {
|
|
325
|
-
return {
|
|
326
|
-
isError: true,
|
|
327
|
-
content: [{ type: "text", text: "Error: Failed to parse FIX string" }]
|
|
328
|
-
};
|
|
329
|
-
}
|
|
843
|
+
case "stockGraph":
|
|
330
844
|
return {
|
|
331
|
-
|
|
845
|
+
contents: [
|
|
332
846
|
{
|
|
333
847
|
type: "text",
|
|
334
|
-
text:
|
|
848
|
+
text: "This resource requires a symbol parameter. Please use the stockGraph/{symbol} resource.",
|
|
849
|
+
uri: "stockGraph"
|
|
335
850
|
}
|
|
336
851
|
]
|
|
337
852
|
};
|
|
338
|
-
|
|
853
|
+
case "stockPriceHistory":
|
|
339
854
|
return {
|
|
340
|
-
|
|
341
|
-
content: [
|
|
855
|
+
contents: [
|
|
342
856
|
{
|
|
343
857
|
type: "text",
|
|
344
|
-
text:
|
|
858
|
+
text: "This resource requires a symbol parameter. Please use the stockPriceHistory/{symbol} resource.",
|
|
859
|
+
uri: "stockPriceHistory"
|
|
345
860
|
}
|
|
346
861
|
]
|
|
347
862
|
};
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
863
|
+
default:
|
|
864
|
+
if (uri.startsWith("stockGraph/")) {
|
|
865
|
+
const symbol = uri.split("/")[1];
|
|
866
|
+
const priceHistory = this.marketDataPrices.get(symbol) || [];
|
|
867
|
+
if (priceHistory.length === 0) {
|
|
868
|
+
return {
|
|
869
|
+
contents: [
|
|
870
|
+
{
|
|
871
|
+
type: "text",
|
|
872
|
+
text: `No price data available for ${symbol}`,
|
|
873
|
+
uri
|
|
874
|
+
}
|
|
875
|
+
]
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
const width = 600;
|
|
879
|
+
const height = 300;
|
|
880
|
+
const padding = 40;
|
|
881
|
+
const xScale = (width - 2 * padding) / (priceHistory.length - 1);
|
|
882
|
+
const yMin = Math.min(...priceHistory.map((d) => d.price));
|
|
883
|
+
const yMax = Math.max(...priceHistory.map((d) => d.price));
|
|
884
|
+
const yScale = (height - 2 * padding) / (yMax - yMin);
|
|
885
|
+
const points = priceHistory.map((d, i) => {
|
|
886
|
+
const x = padding + i * xScale;
|
|
887
|
+
const y = height - padding - (d.price - yMin) * yScale;
|
|
888
|
+
return `${x},${y}`;
|
|
889
|
+
}).join(" L ");
|
|
890
|
+
const svg = `<?xml version="1.0" encoding="UTF-8"?>
|
|
891
|
+
<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg">
|
|
892
|
+
<!-- Background -->
|
|
893
|
+
<rect width="100%" height="100%" fill="#f8f9fa"/>
|
|
894
|
+
|
|
895
|
+
<!-- Grid lines -->
|
|
896
|
+
<g stroke="#e9ecef" stroke-width="1">
|
|
897
|
+
${Array.from({ length: 5 }, (_, i) => {
|
|
898
|
+
const y = padding + (height - 2 * padding) * i / 4;
|
|
899
|
+
return `<line x1="${padding}" y1="${y}" x2="${width - padding}" y2="${y}"/>`;
|
|
900
|
+
}).join("\n")}
|
|
901
|
+
</g>
|
|
902
|
+
|
|
903
|
+
<!-- Price line -->
|
|
904
|
+
<path d="M ${points}"
|
|
905
|
+
fill="none"
|
|
906
|
+
stroke="#007bff"
|
|
907
|
+
stroke-width="2"/>
|
|
908
|
+
|
|
909
|
+
<!-- Data points -->
|
|
910
|
+
${priceHistory.map((d, i) => {
|
|
911
|
+
const x = padding + i * xScale;
|
|
912
|
+
const y = height - padding - (d.price - yMin) * yScale;
|
|
913
|
+
return `<circle cx="${x}" cy="${y}" r="3" fill="#007bff"/>`;
|
|
914
|
+
}).join("\n")}
|
|
915
|
+
|
|
916
|
+
<!-- Labels -->
|
|
917
|
+
<g font-family="Arial" font-size="12" fill="#495057">
|
|
918
|
+
${Array.from({ length: 5 }, (_, i) => {
|
|
919
|
+
const x = padding + (width - 2 * padding) * i / 4;
|
|
920
|
+
const index = Math.floor((priceHistory.length - 1) * i / 4);
|
|
921
|
+
const timestamp = new Date(priceHistory[index].timestamp).toLocaleTimeString();
|
|
922
|
+
return `<text x="${x + padding}" y="${height - padding + 20}" text-anchor="middle">${timestamp}</text>`;
|
|
923
|
+
}).join("\n")}
|
|
924
|
+
${Array.from({ length: 5 }, (_, i) => {
|
|
925
|
+
const y = padding + (height - 2 * padding) * i / 4;
|
|
926
|
+
const price = yMax - (yMax - yMin) * i / 4;
|
|
927
|
+
return `<text x="${padding - 5}" y="${y + 4}" text-anchor="end">$${price.toFixed(2)}</text>`;
|
|
928
|
+
}).join("\n")}
|
|
929
|
+
</g>
|
|
930
|
+
|
|
931
|
+
<!-- Title -->
|
|
932
|
+
<text x="${width / 2}" y="${padding / 2}"
|
|
933
|
+
font-family="Arial" font-size="16" font-weight="bold"
|
|
934
|
+
text-anchor="middle" fill="#212529">
|
|
935
|
+
${symbol} - Price Chart (${priceHistory.length} points)
|
|
936
|
+
</text>
|
|
937
|
+
</svg>`;
|
|
373
938
|
return {
|
|
374
|
-
|
|
375
|
-
content: [
|
|
939
|
+
contents: [
|
|
376
940
|
{
|
|
377
941
|
type: "text",
|
|
378
|
-
text:
|
|
942
|
+
text: svg,
|
|
943
|
+
uri
|
|
379
944
|
}
|
|
380
945
|
]
|
|
381
946
|
};
|
|
382
947
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
{
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
{
|
|
398
|
-
type: "text",
|
|
399
|
-
text: `Error: ${error instanceof Error ? error.message : "Failed to create order"}`
|
|
400
|
-
}
|
|
401
|
-
]
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
case "marketDataRequest": {
|
|
406
|
-
try {
|
|
407
|
-
const { mdUpdateType, symbol, mdReqID, subscriptionRequestType, mdEntryType } = validateArgs(
|
|
408
|
-
args,
|
|
409
|
-
marketDataRequestInputSchema
|
|
410
|
-
);
|
|
411
|
-
const response = new Promise((resolve) => {
|
|
412
|
-
this.pendingRequests.set(mdReqID, resolve);
|
|
413
|
-
});
|
|
414
|
-
const marketDataRequest = this.parser?.createMessage(
|
|
415
|
-
new Field(Fields.MsgType, Messages.MarketDataRequest),
|
|
416
|
-
new Field(Fields.SenderCompID, this.parser?.sender),
|
|
417
|
-
new Field(Fields.MsgSeqNum, this.parser?.getNextTargetMsgSeqNum()),
|
|
418
|
-
new Field(Fields.TargetCompID, this.parser?.target),
|
|
419
|
-
new Field(Fields.SendingTime, this.parser?.getTimestamp()),
|
|
420
|
-
new Field(Fields.MarketDepth, 0),
|
|
421
|
-
new Field(Fields.MDUpdateType, mdUpdateType),
|
|
422
|
-
new Field(Fields.NoRelatedSym, 1),
|
|
423
|
-
new Field(Fields.Symbol, symbol),
|
|
424
|
-
new Field(Fields.MDReqID, mdReqID),
|
|
425
|
-
new Field(Fields.SubscriptionRequestType, subscriptionRequestType),
|
|
426
|
-
new Field(Fields.NoMDEntryTypes, 1),
|
|
427
|
-
new Field(Fields.MDEntryType, mdEntryType)
|
|
428
|
-
);
|
|
429
|
-
if (!this.parser?.connected) {
|
|
948
|
+
if (uri.startsWith("stockPriceHistory/")) {
|
|
949
|
+
const symbol = uri.split("/")[1];
|
|
950
|
+
const priceHistory = this.marketDataPrices.get(symbol) || [];
|
|
951
|
+
if (priceHistory.length === 0) {
|
|
952
|
+
return {
|
|
953
|
+
contents: [
|
|
954
|
+
{
|
|
955
|
+
type: "text",
|
|
956
|
+
text: `No price data available for ${symbol}`,
|
|
957
|
+
uri
|
|
958
|
+
}
|
|
959
|
+
]
|
|
960
|
+
};
|
|
961
|
+
}
|
|
430
962
|
return {
|
|
431
|
-
|
|
432
|
-
content: [
|
|
963
|
+
contents: [
|
|
433
964
|
{
|
|
434
965
|
type: "text",
|
|
435
|
-
text:
|
|
966
|
+
text: JSON.stringify(
|
|
967
|
+
{
|
|
968
|
+
symbol,
|
|
969
|
+
count: priceHistory.length,
|
|
970
|
+
prices: priceHistory.map((point) => ({
|
|
971
|
+
timestamp: new Date(point.timestamp).toISOString(),
|
|
972
|
+
price: point.price
|
|
973
|
+
}))
|
|
974
|
+
},
|
|
975
|
+
null,
|
|
976
|
+
2
|
|
977
|
+
),
|
|
978
|
+
uri
|
|
436
979
|
}
|
|
437
980
|
]
|
|
438
981
|
};
|
|
439
982
|
}
|
|
440
|
-
this.parser?.send(marketDataRequest);
|
|
441
|
-
const fixData = await response;
|
|
442
|
-
return {
|
|
443
|
-
content: [
|
|
444
|
-
{
|
|
445
|
-
type: "text",
|
|
446
|
-
text: `Market data for ${symbol}: ${JSON.stringify(fixData.toFIXJSON())}`
|
|
447
|
-
}
|
|
448
|
-
]
|
|
449
|
-
};
|
|
450
|
-
} catch (error) {
|
|
451
983
|
return {
|
|
452
|
-
|
|
453
|
-
content: [
|
|
984
|
+
contents: [
|
|
454
985
|
{
|
|
455
986
|
type: "text",
|
|
456
|
-
text: `
|
|
987
|
+
text: `Resource not found: ${uri}`,
|
|
988
|
+
uri
|
|
457
989
|
}
|
|
458
|
-
]
|
|
990
|
+
],
|
|
991
|
+
isError: true
|
|
459
992
|
};
|
|
460
|
-
}
|
|
461
993
|
}
|
|
462
|
-
default:
|
|
463
|
-
throw new Error(`Unknown tool: ${name}`);
|
|
464
994
|
}
|
|
465
|
-
|
|
466
|
-
this.server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
467
|
-
return {
|
|
468
|
-
prompts: [
|
|
469
|
-
{
|
|
470
|
-
name: "parse",
|
|
471
|
-
description: "Parses a FIX message and describes it in plain language",
|
|
472
|
-
arguments: [
|
|
473
|
-
{
|
|
474
|
-
name: "fixString",
|
|
475
|
-
description: "FIX message string to parse",
|
|
476
|
-
required: true
|
|
477
|
-
}
|
|
478
|
-
]
|
|
479
|
-
},
|
|
480
|
-
{
|
|
481
|
-
name: "parseToJSON",
|
|
482
|
-
description: "Parses a FIX message into JSON",
|
|
483
|
-
arguments: [
|
|
484
|
-
{
|
|
485
|
-
name: "fixString",
|
|
486
|
-
description: "FIX message string to parse",
|
|
487
|
-
required: true
|
|
488
|
-
}
|
|
489
|
-
]
|
|
490
|
-
},
|
|
491
|
-
{
|
|
492
|
-
name: "newOrderSingle",
|
|
493
|
-
description: "Creates and sends a New Order Single. IMPORTANT: All parameters must be explicitly provided by the user - no assumptions will be made.",
|
|
494
|
-
arguments: [
|
|
495
|
-
{
|
|
496
|
-
name: "clOrdID",
|
|
497
|
-
description: "Client Order ID",
|
|
498
|
-
required: true
|
|
499
|
-
},
|
|
500
|
-
{
|
|
501
|
-
name: "handlInst",
|
|
502
|
-
description: "Handling instruction (1=Manual, 2=Automated, 3=AutomatedNoIntervention)",
|
|
503
|
-
required: true
|
|
504
|
-
},
|
|
505
|
-
{
|
|
506
|
-
name: "quantity",
|
|
507
|
-
description: "Order quantity",
|
|
508
|
-
required: true
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
name: "price",
|
|
512
|
-
description: "Order price",
|
|
513
|
-
required: true
|
|
514
|
-
},
|
|
515
|
-
{
|
|
516
|
-
name: "ordType",
|
|
517
|
-
description: "Order type (1=Market, 2=Limit, 3=Stop)",
|
|
518
|
-
required: true
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
name: "side",
|
|
522
|
-
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)",
|
|
523
|
-
required: true
|
|
524
|
-
},
|
|
525
|
-
{
|
|
526
|
-
name: "symbol",
|
|
527
|
-
description: "Trading symbol",
|
|
528
|
-
required: true
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
name: "timeInForce",
|
|
532
|
-
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)",
|
|
533
|
-
required: true
|
|
534
|
-
}
|
|
535
|
-
]
|
|
536
|
-
},
|
|
537
|
-
{
|
|
538
|
-
name: "marketDataRequest",
|
|
539
|
-
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.",
|
|
540
|
-
arguments: [
|
|
541
|
-
{
|
|
542
|
-
name: "mdUpdateType",
|
|
543
|
-
description: "Market data update type (0=FullRefresh, 1=IncrementalRefresh)",
|
|
544
|
-
required: true
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
name: "symbol",
|
|
548
|
-
description: "Trading symbol",
|
|
549
|
-
required: true
|
|
550
|
-
},
|
|
551
|
-
{
|
|
552
|
-
name: "mdReqID",
|
|
553
|
-
description: "Market data request ID",
|
|
554
|
-
required: true
|
|
555
|
-
},
|
|
556
|
-
{
|
|
557
|
-
name: "subscriptionRequestType",
|
|
558
|
-
description: "Subscription request type (0=Snapshot + Updates, 1=Snapshot, 2=Unsubscribe)",
|
|
559
|
-
required: true
|
|
560
|
-
},
|
|
561
|
-
{
|
|
562
|
-
name: "mdEntryType",
|
|
563
|
-
description: "Market data entry type (0=Bid, 1=Offer, 2=Trade, 3=Index Value, 4=Opening Price)",
|
|
564
|
-
required: true
|
|
565
|
-
}
|
|
566
|
-
]
|
|
567
|
-
}
|
|
568
|
-
]
|
|
569
|
-
};
|
|
570
|
-
});
|
|
571
|
-
this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
572
|
-
const { name, arguments: args } = request.params;
|
|
573
|
-
switch (name) {
|
|
574
|
-
case "parse": {
|
|
575
|
-
const fixString = args?.fixString || "";
|
|
576
|
-
return {
|
|
577
|
-
messages: [
|
|
578
|
-
{
|
|
579
|
-
role: "user",
|
|
580
|
-
content: {
|
|
581
|
-
type: "text",
|
|
582
|
-
text: `Please parse and explain this FIX message: ${fixString}`
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
]
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
case "parseToJSON": {
|
|
589
|
-
const fixString = args?.fixString || "";
|
|
590
|
-
return {
|
|
591
|
-
messages: [
|
|
592
|
-
{
|
|
593
|
-
role: "user",
|
|
594
|
-
content: {
|
|
595
|
-
type: "text",
|
|
596
|
-
text: `Please parse the FIX message to JSON: ${fixString}`
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
]
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
case "newOrderSingle": {
|
|
603
|
-
const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = args || {};
|
|
604
|
-
return {
|
|
605
|
-
messages: [
|
|
606
|
-
{
|
|
607
|
-
role: "user",
|
|
608
|
-
content: {
|
|
609
|
-
type: "text",
|
|
610
|
-
text: [
|
|
611
|
-
"Create a New Order Single FIX message with the following parameters:",
|
|
612
|
-
`- ClOrdID: ${clOrdID}`,
|
|
613
|
-
`- HandlInst: ${handlInst ?? "3"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Manual, '2' for Automated, '3' for AutomatedNoIntervention)`,
|
|
614
|
-
`- Quantity: ${quantity}`,
|
|
615
|
-
`- Price: ${price}`,
|
|
616
|
-
`- OrdType: ${ordType ?? "1"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Market, '2' for Limit, '3' for Stop)`,
|
|
617
|
-
`- Side: ${side} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '1' for Buy, '2' for Sell)`,
|
|
618
|
-
`- Symbol: ${symbol}`,
|
|
619
|
-
`- TimeInForce: ${timeInForce ?? "0"} (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)`,
|
|
620
|
-
"",
|
|
621
|
-
'Note: For the OrdType parameter, always use the numeric/alphabetic value (e.g., "1" for Market, "2" for Limit, "3" for Stop) as defined in the FIX protocol, not the descriptive name.',
|
|
622
|
-
'Note: For the TimeInForce parameter, always use the numeric/alphabetic value (e.g., "0" for Day, "1" for Good Till Cancel, "2" for At Opening) as defined in the FIX protocol, not the descriptive name.',
|
|
623
|
-
"",
|
|
624
|
-
"IMPORTANT: All parameters must be set before sending the order. Missing or invalid parameters will result in a Reject message.",
|
|
625
|
-
"",
|
|
626
|
-
"IMPORTANT: The response will be either:",
|
|
627
|
-
"1. An Execution Report (MsgType=8) if the order was successfully placed",
|
|
628
|
-
"2. A Reject message (MsgType=3) if the order failed to execute (e.g., due to missing or invalid parameters)"
|
|
629
|
-
].join("\n")
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
]
|
|
633
|
-
};
|
|
634
|
-
}
|
|
635
|
-
case "marketDataRequest": {
|
|
636
|
-
const { mdUpdateType, symbol, mdReqID, subscriptionRequestType, mdEntryType } = args || {};
|
|
637
|
-
return {
|
|
638
|
-
messages: [
|
|
639
|
-
{
|
|
640
|
-
role: "user",
|
|
641
|
-
content: {
|
|
642
|
-
type: "text",
|
|
643
|
-
text: [
|
|
644
|
-
"Create a Market Data Request FIX message with the following parameters:",
|
|
645
|
-
`- MDUpdateType: ${mdUpdateType ?? "0"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for FullRefresh, '1' for IncrementalRefresh)`,
|
|
646
|
-
`- Symbol: ${symbol}`,
|
|
647
|
-
`- MDReqID: ${mdReqID}`,
|
|
648
|
-
`- SubscriptionRequestType: ${subscriptionRequestType ?? "0"} (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use '0' for Snapshot + Updates, '1' for Snapshot, '2' for Unsubscribe)`,
|
|
649
|
-
`- MDEntryType: ${mdEntryType ?? "0"} (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)`,
|
|
650
|
-
"",
|
|
651
|
-
"Format the response as a JSON object with FIX tag numbers as keys and their corresponding values.",
|
|
652
|
-
"",
|
|
653
|
-
'Note: For the MDUpdateType parameter, always use the numeric/alphabetic value (e.g., "0" for FullRefresh, "1" for IncrementalRefresh) as defined in the FIX protocol, not the descriptive name.',
|
|
654
|
-
'Note: For the SubscriptionRequestType parameter, always use the numeric/alphabetic value (e.g., "0" for Snapshot + Updates, "1" for Snapshot, "2" for Unsubscribe) as defined in the FIX protocol, not the descriptive name.',
|
|
655
|
-
'Note: For the MDEntryType parameter, always use the numeric/alphabetic value (e.g., "0" for Bid, "1" for Offer, "2" for Trade, "3" for Index Value, "4" for Opening Price) as defined in the FIX protocol, not the descriptive name.'
|
|
656
|
-
].join("\n")
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
]
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
default:
|
|
663
|
-
throw new Error(`Unknown prompt: ${name}`);
|
|
664
|
-
}
|
|
665
|
-
});
|
|
995
|
+
);
|
|
666
996
|
process.on("SIGINT", async () => {
|
|
667
997
|
await this.server.close();
|
|
668
998
|
process.exit(0);
|