@alfe.ai/ctrader-mcp 0.1.0
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/dist/server.d.ts +1 -0
- package/dist/server.js +1311 -0
- package/package.json +48 -0
- package/proto/ctrader.proto +447 -0
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alfe.ai/ctrader-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "cTrader MCP server — full trading (place/modify/close orders + read) over the cTrader Open API (protobuf/TLS)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/server.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"ctrader-mcp-server": "./dist/server.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/server.d.ts",
|
|
13
|
+
"import": "./dist/server.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"proto"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
22
|
+
"protobufjs": "^8.7.0",
|
|
23
|
+
"zod": "^4.0.5",
|
|
24
|
+
"@alfe.ai/agent-api-client": "0.10.0",
|
|
25
|
+
"@alfe.ai/config": "0.3.0"
|
|
26
|
+
},
|
|
27
|
+
"license": "UNLICENSED",
|
|
28
|
+
"homepage": "https://alfe.ai",
|
|
29
|
+
"author": "Alfe (https://alfe.ai)",
|
|
30
|
+
"keywords": [
|
|
31
|
+
"alfe",
|
|
32
|
+
"ai-agents",
|
|
33
|
+
"agent",
|
|
34
|
+
"llm",
|
|
35
|
+
"mcp",
|
|
36
|
+
"model-context-protocol",
|
|
37
|
+
"ctrader",
|
|
38
|
+
"trading",
|
|
39
|
+
"forex"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsdown",
|
|
43
|
+
"dev": "tsdown --watch",
|
|
44
|
+
"typecheck": "tsc --noEmit",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"lint": "eslint ."
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
syntax = "proto2";
|
|
2
|
+
|
|
3
|
+
// Minimal, self-contained subset of Spotware's cTrader Open API protobuf
|
|
4
|
+
// schema — only the messages and enums this MCP server sends or receives.
|
|
5
|
+
//
|
|
6
|
+
// Field numbers, message names and enum values are transcribed verbatim from
|
|
7
|
+
// Spotware's official proto files (github.com/spotware/openapi-proto-messages,
|
|
8
|
+
// files OpenApiCommonMessages.proto, OpenApiCommonModelMessages.proto,
|
|
9
|
+
// OpenApiMessages.proto, OpenApiModelMessages.proto). Payload-type numbers are
|
|
10
|
+
// carried in the ProtoMessage envelope, not encoded here, so this file omits
|
|
11
|
+
// the giant ProtoOAPayloadType enum; the numbers live in payload-types.ts.
|
|
12
|
+
//
|
|
13
|
+
// We keep this vendored (rather than pulling the full upstream .proto tree)
|
|
14
|
+
// so the published tarball has no dependency on an external, unpinned schema
|
|
15
|
+
// and only carries the surface we actually use.
|
|
16
|
+
|
|
17
|
+
package ctrader;
|
|
18
|
+
|
|
19
|
+
// ── Envelope (OpenApiCommonMessages.proto) ──────────────────────────────
|
|
20
|
+
|
|
21
|
+
message ProtoMessage {
|
|
22
|
+
required uint32 payloadType = 1;
|
|
23
|
+
optional bytes payload = 2;
|
|
24
|
+
optional string clientMsgId = 3;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Common-layer error (payloadType 50). Framing / connection-level errors.
|
|
28
|
+
message ProtoErrorRes {
|
|
29
|
+
optional uint32 payloadType = 1;
|
|
30
|
+
required string errorCode = 2;
|
|
31
|
+
optional string description = 3;
|
|
32
|
+
optional int64 maintenanceEndTimestamp = 4;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Heartbeat (payloadType 51). Keep-alive; no fields beyond payloadType.
|
|
36
|
+
message ProtoHeartbeatEvent {
|
|
37
|
+
optional uint32 payloadType = 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ── Enums (OpenApiModelMessages.proto) ──────────────────────────────────
|
|
41
|
+
|
|
42
|
+
enum ProtoOAOrderType {
|
|
43
|
+
MARKET = 1;
|
|
44
|
+
LIMIT = 2;
|
|
45
|
+
STOP = 3;
|
|
46
|
+
STOP_LOSS_TAKE_PROFIT = 4;
|
|
47
|
+
MARKET_RANGE = 5;
|
|
48
|
+
STOP_LIMIT = 6;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
enum ProtoOATradeSide {
|
|
52
|
+
BUY = 1;
|
|
53
|
+
SELL = 2;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
enum ProtoOATrendbarPeriod {
|
|
57
|
+
M1 = 1;
|
|
58
|
+
M2 = 2;
|
|
59
|
+
M3 = 3;
|
|
60
|
+
M4 = 4;
|
|
61
|
+
M5 = 5;
|
|
62
|
+
M10 = 6;
|
|
63
|
+
M15 = 7;
|
|
64
|
+
M30 = 8;
|
|
65
|
+
H1 = 9;
|
|
66
|
+
H4 = 10;
|
|
67
|
+
H12 = 11;
|
|
68
|
+
D1 = 12;
|
|
69
|
+
W1 = 13;
|
|
70
|
+
MN1 = 14;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ── OA-layer error (payloadType 2142) ───────────────────────────────────
|
|
74
|
+
|
|
75
|
+
message ProtoOAErrorRes {
|
|
76
|
+
optional uint32 payloadType = 1;
|
|
77
|
+
optional int64 ctidTraderAccountId = 2;
|
|
78
|
+
required string errorCode = 3;
|
|
79
|
+
optional string description = 4;
|
|
80
|
+
optional int64 maintenanceEndTimestamp = 5;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ── Auth handshake ──────────────────────────────────────────────────────
|
|
84
|
+
|
|
85
|
+
message ProtoOAApplicationAuthReq {
|
|
86
|
+
optional uint32 payloadType = 1;
|
|
87
|
+
required string clientId = 2;
|
|
88
|
+
required string clientSecret = 3;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
message ProtoOAApplicationAuthRes {
|
|
92
|
+
optional uint32 payloadType = 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
message ProtoOAAccountAuthReq {
|
|
96
|
+
optional uint32 payloadType = 1;
|
|
97
|
+
required int64 ctidTraderAccountId = 2;
|
|
98
|
+
required string accessToken = 3;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
message ProtoOAAccountAuthRes {
|
|
102
|
+
optional uint32 payloadType = 1;
|
|
103
|
+
required int64 ctidTraderAccountId = 2;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ── Accounts list ───────────────────────────────────────────────────────
|
|
107
|
+
|
|
108
|
+
message ProtoOAGetAccountListByAccessTokenReq {
|
|
109
|
+
optional uint32 payloadType = 1;
|
|
110
|
+
required string accessToken = 2;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
message ProtoOACtidTraderAccount {
|
|
114
|
+
required uint64 ctidTraderAccountId = 1;
|
|
115
|
+
optional bool isLive = 2;
|
|
116
|
+
optional uint64 traderLogin = 3;
|
|
117
|
+
optional int64 lastClosingDealTimestamp = 4;
|
|
118
|
+
optional int64 lastBalanceUpdateTimestamp = 5;
|
|
119
|
+
optional string brokerTitleShort = 6;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
message ProtoOAGetAccountListByAccessTokenRes {
|
|
123
|
+
optional uint32 payloadType = 1;
|
|
124
|
+
required string accessToken = 2;
|
|
125
|
+
repeated ProtoOACtidTraderAccount ctidTraderAccount = 3;
|
|
126
|
+
optional bool permissionScope = 4;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ── Trader (balance / account details) ──────────────────────────────────
|
|
130
|
+
|
|
131
|
+
message ProtoOATraderReq {
|
|
132
|
+
optional uint32 payloadType = 1;
|
|
133
|
+
required int64 ctidTraderAccountId = 2;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
message ProtoOATrader {
|
|
137
|
+
required int64 ctidTraderAccountId = 1;
|
|
138
|
+
required int64 balance = 2;
|
|
139
|
+
optional int64 balanceVersion = 3;
|
|
140
|
+
optional int64 managerBonus = 4;
|
|
141
|
+
optional int64 ibBonus = 5;
|
|
142
|
+
optional int64 nonWithdrawableBonus = 6;
|
|
143
|
+
optional int64 accessRights = 7;
|
|
144
|
+
required int64 depositAssetId = 8;
|
|
145
|
+
optional bool swapFree = 9;
|
|
146
|
+
optional uint32 leverageInCents = 10;
|
|
147
|
+
optional uint32 totalMarginCalculationType = 11;
|
|
148
|
+
optional uint32 maxLeverage = 12;
|
|
149
|
+
optional bool frenchRisk = 13;
|
|
150
|
+
optional int64 traderLogin = 14;
|
|
151
|
+
optional uint32 accountType = 15;
|
|
152
|
+
optional string brokerName = 16;
|
|
153
|
+
optional int64 registrationTimestamp = 17;
|
|
154
|
+
optional bool isLimitedRisk = 18;
|
|
155
|
+
optional uint32 limitedRiskMarginCalculationStrategy = 19;
|
|
156
|
+
optional uint32 moneyDigits = 20;
|
|
157
|
+
optional int64 fairStopOut = 21;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
message ProtoOATraderRes {
|
|
161
|
+
optional uint32 payloadType = 1;
|
|
162
|
+
required ProtoOATrader trader = 2;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ── Reconcile (open positions + pending orders) ─────────────────────────
|
|
166
|
+
|
|
167
|
+
message ProtoOATradeData {
|
|
168
|
+
required int64 symbolId = 1;
|
|
169
|
+
required int64 volume = 2;
|
|
170
|
+
required ProtoOATradeSide tradeSide = 3;
|
|
171
|
+
optional int64 openTimestamp = 4;
|
|
172
|
+
optional string label = 5;
|
|
173
|
+
optional bool guaranteedStopLoss = 6;
|
|
174
|
+
optional string comment = 7;
|
|
175
|
+
optional double measurementUnits = 8;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
message ProtoOAPosition {
|
|
179
|
+
required int64 positionId = 1;
|
|
180
|
+
required ProtoOATradeData tradeData = 2;
|
|
181
|
+
required uint32 positionStatus = 3;
|
|
182
|
+
required int64 swap = 4;
|
|
183
|
+
optional double price = 5;
|
|
184
|
+
optional double stopLoss = 6;
|
|
185
|
+
optional double takeProfit = 7;
|
|
186
|
+
optional int64 utcLastUpdateTimestamp = 8;
|
|
187
|
+
optional int64 commission = 9;
|
|
188
|
+
optional double marginRate = 10;
|
|
189
|
+
optional int64 mirroringCommission = 11;
|
|
190
|
+
optional bool guaranteedStopLoss = 12;
|
|
191
|
+
optional int64 usedMargin = 13;
|
|
192
|
+
optional uint32 stopLossTriggerMethod = 14;
|
|
193
|
+
optional uint32 moneyDigits = 15;
|
|
194
|
+
optional bool trailingStopLoss = 16;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
message ProtoOAOrder {
|
|
198
|
+
required int64 orderId = 1;
|
|
199
|
+
required ProtoOATradeData tradeData = 2;
|
|
200
|
+
required ProtoOAOrderType orderType = 3;
|
|
201
|
+
required uint32 orderStatus = 4;
|
|
202
|
+
optional int64 expirationTimestamp = 5;
|
|
203
|
+
optional double executionPrice = 6;
|
|
204
|
+
optional int64 executedVolume = 7;
|
|
205
|
+
optional int64 utcLastUpdateTimestamp = 8;
|
|
206
|
+
optional double baseSlippagePrice = 9;
|
|
207
|
+
optional int64 slippageInPoints = 10;
|
|
208
|
+
optional bool closingOrder = 11;
|
|
209
|
+
optional double limitPrice = 12;
|
|
210
|
+
optional double stopPrice = 13;
|
|
211
|
+
optional double stopLoss = 14;
|
|
212
|
+
optional double takeProfit = 15;
|
|
213
|
+
optional string clientOrderId = 16;
|
|
214
|
+
optional uint32 timeInForce = 17;
|
|
215
|
+
optional int64 positionId = 18;
|
|
216
|
+
optional double relativeStopLoss = 19;
|
|
217
|
+
optional double relativeTakeProfit = 20;
|
|
218
|
+
optional bool isStopOut = 21;
|
|
219
|
+
optional bool trailingStopLoss = 22;
|
|
220
|
+
optional uint32 stopTriggerMethod = 23;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
message ProtoOAReconcileReq {
|
|
224
|
+
optional uint32 payloadType = 1;
|
|
225
|
+
required int64 ctidTraderAccountId = 2;
|
|
226
|
+
optional bool returnProtectionOrders = 3;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
message ProtoOAReconcileRes {
|
|
230
|
+
optional uint32 payloadType = 1;
|
|
231
|
+
required int64 ctidTraderAccountId = 2;
|
|
232
|
+
repeated ProtoOAPosition position = 3;
|
|
233
|
+
repeated ProtoOAOrder order = 4;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// ── Symbols ─────────────────────────────────────────────────────────────
|
|
237
|
+
|
|
238
|
+
message ProtoOALightSymbol {
|
|
239
|
+
required int64 symbolId = 1;
|
|
240
|
+
optional string symbolName = 2;
|
|
241
|
+
optional bool enabled = 3;
|
|
242
|
+
optional int64 baseAssetId = 4;
|
|
243
|
+
optional int64 quoteAssetId = 5;
|
|
244
|
+
optional int64 symbolCategoryId = 6;
|
|
245
|
+
optional string description = 7;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
message ProtoOASymbolsListReq {
|
|
249
|
+
optional uint32 payloadType = 1;
|
|
250
|
+
required int64 ctidTraderAccountId = 2;
|
|
251
|
+
optional bool includeArchivedSymbols = 3;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
message ProtoOAArchivedSymbol {
|
|
255
|
+
required int64 symbolId = 1;
|
|
256
|
+
required string name = 2;
|
|
257
|
+
optional int64 utcLastUpdateTimestamp = 3;
|
|
258
|
+
optional string description = 4;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
message ProtoOASymbolsListRes {
|
|
262
|
+
optional uint32 payloadType = 1;
|
|
263
|
+
required int64 ctidTraderAccountId = 2;
|
|
264
|
+
repeated ProtoOALightSymbol symbol = 3;
|
|
265
|
+
repeated ProtoOAArchivedSymbol archivedSymbol = 4;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
message ProtoOASymbol {
|
|
269
|
+
required int64 symbolId = 1;
|
|
270
|
+
optional int64 digits = 2;
|
|
271
|
+
optional int64 pipPosition = 3;
|
|
272
|
+
optional bool enableShortSelling = 4;
|
|
273
|
+
optional bool guaranteedStopLoss = 5;
|
|
274
|
+
optional uint32 swapRollover3Days = 6;
|
|
275
|
+
optional bool swapLong = 7;
|
|
276
|
+
optional bool swapShort = 8;
|
|
277
|
+
optional int64 maxVolume = 9;
|
|
278
|
+
optional int64 minVolume = 10;
|
|
279
|
+
optional int64 stepVolume = 11;
|
|
280
|
+
optional int64 maxExposure = 12;
|
|
281
|
+
optional int64 lotSize = 21;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
message ProtoOASymbolByIdReq {
|
|
285
|
+
optional uint32 payloadType = 1;
|
|
286
|
+
required int64 ctidTraderAccountId = 2;
|
|
287
|
+
repeated int64 symbolId = 3;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
message ProtoOASymbolByIdRes {
|
|
291
|
+
optional uint32 payloadType = 1;
|
|
292
|
+
required int64 ctidTraderAccountId = 2;
|
|
293
|
+
repeated ProtoOASymbol symbol = 3;
|
|
294
|
+
repeated ProtoOAArchivedSymbol archivedSymbol = 4;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// ── Trendbars (market data / candles) ───────────────────────────────────
|
|
298
|
+
|
|
299
|
+
message ProtoOATrendbar {
|
|
300
|
+
optional uint32 volume = 3;
|
|
301
|
+
optional ProtoOATrendbarPeriod period = 4;
|
|
302
|
+
optional int64 low = 5;
|
|
303
|
+
optional uint64 deltaOpen = 6;
|
|
304
|
+
optional uint64 deltaClose = 7;
|
|
305
|
+
optional uint64 deltaHigh = 8;
|
|
306
|
+
optional uint32 utcTimestampInMinutes = 9;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
message ProtoOAGetTrendbarsReq {
|
|
310
|
+
optional uint32 payloadType = 1;
|
|
311
|
+
required int64 ctidTraderAccountId = 2;
|
|
312
|
+
optional int64 fromTimestamp = 3;
|
|
313
|
+
optional int64 toTimestamp = 4;
|
|
314
|
+
required ProtoOATrendbarPeriod period = 5;
|
|
315
|
+
required int64 symbolId = 6;
|
|
316
|
+
optional uint32 count = 7;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
message ProtoOAGetTrendbarsRes {
|
|
320
|
+
optional uint32 payloadType = 1;
|
|
321
|
+
required int64 ctidTraderAccountId = 2;
|
|
322
|
+
required ProtoOATrendbarPeriod period = 3;
|
|
323
|
+
optional int64 timestamp = 4;
|
|
324
|
+
repeated ProtoOATrendbar trendbar = 5;
|
|
325
|
+
optional int64 symbolId = 6;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// ── Live spot subscription ──────────────────────────────────────────────
|
|
329
|
+
|
|
330
|
+
message ProtoOASubscribeSpotsReq {
|
|
331
|
+
optional uint32 payloadType = 1;
|
|
332
|
+
required int64 ctidTraderAccountId = 2;
|
|
333
|
+
repeated int64 symbolId = 3;
|
|
334
|
+
optional bool subscribeToSpotTimestamp = 4;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
message ProtoOASubscribeSpotsRes {
|
|
338
|
+
optional uint32 payloadType = 1;
|
|
339
|
+
required int64 ctidTraderAccountId = 2;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
message ProtoOASpotEvent {
|
|
343
|
+
optional uint32 payloadType = 1;
|
|
344
|
+
required int64 ctidTraderAccountId = 2;
|
|
345
|
+
required int64 symbolId = 3;
|
|
346
|
+
optional uint64 bid = 4;
|
|
347
|
+
optional uint64 ask = 5;
|
|
348
|
+
repeated ProtoOATrendbar trendbar = 6;
|
|
349
|
+
optional uint64 sessionClose = 7;
|
|
350
|
+
optional int64 timestamp = 8;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// ── Order mutations (all respond via ProtoOAExecutionEvent, 2126) ───────
|
|
354
|
+
|
|
355
|
+
message ProtoOANewOrderReq {
|
|
356
|
+
optional uint32 payloadType = 1;
|
|
357
|
+
required int64 ctidTraderAccountId = 2;
|
|
358
|
+
required int64 symbolId = 3;
|
|
359
|
+
required ProtoOAOrderType orderType = 4;
|
|
360
|
+
required ProtoOATradeSide tradeSide = 5;
|
|
361
|
+
required int64 volume = 6;
|
|
362
|
+
optional double limitPrice = 7;
|
|
363
|
+
optional double stopPrice = 8;
|
|
364
|
+
optional uint32 timeInForce = 9;
|
|
365
|
+
optional int64 expirationTimestamp = 10;
|
|
366
|
+
optional double stopLoss = 11;
|
|
367
|
+
optional double takeProfit = 12;
|
|
368
|
+
optional string comment = 13;
|
|
369
|
+
optional double baseSlippagePrice = 14;
|
|
370
|
+
optional int32 slippageInPoints = 15;
|
|
371
|
+
optional string label = 16;
|
|
372
|
+
optional int64 positionId = 17;
|
|
373
|
+
optional string clientOrderId = 18;
|
|
374
|
+
optional int64 relativeStopLoss = 19;
|
|
375
|
+
optional int64 relativeTakeProfit = 20;
|
|
376
|
+
optional bool guaranteedStopLoss = 21;
|
|
377
|
+
optional bool trailingStopLoss = 22;
|
|
378
|
+
optional uint32 stopTriggerMethod = 23;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
message ProtoOAAmendOrderReq {
|
|
382
|
+
optional uint32 payloadType = 1;
|
|
383
|
+
required int64 ctidTraderAccountId = 2;
|
|
384
|
+
required int64 orderId = 3;
|
|
385
|
+
optional int64 volume = 4;
|
|
386
|
+
optional double limitPrice = 5;
|
|
387
|
+
optional double stopPrice = 6;
|
|
388
|
+
optional int64 expirationTimestamp = 7;
|
|
389
|
+
optional double stopLoss = 8;
|
|
390
|
+
optional double takeProfit = 9;
|
|
391
|
+
optional int64 relativeStopLoss = 10;
|
|
392
|
+
optional int64 relativeTakeProfit = 11;
|
|
393
|
+
optional bool guaranteedStopLoss = 12;
|
|
394
|
+
optional bool trailingStopLoss = 13;
|
|
395
|
+
optional uint32 stopTriggerMethod = 14;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
message ProtoOAAmendPositionSLTPReq {
|
|
399
|
+
optional uint32 payloadType = 1;
|
|
400
|
+
required int64 ctidTraderAccountId = 2;
|
|
401
|
+
required int64 positionId = 3;
|
|
402
|
+
optional double stopLoss = 4;
|
|
403
|
+
optional double takeProfit = 5;
|
|
404
|
+
optional bool guaranteedStopLoss = 6;
|
|
405
|
+
optional double stopLossTriggerMethod = 7;
|
|
406
|
+
optional bool trailingStopLoss = 8;
|
|
407
|
+
optional double relativeStopLoss = 9;
|
|
408
|
+
optional double relativeTakeProfit = 10;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
message ProtoOAClosePositionReq {
|
|
412
|
+
optional uint32 payloadType = 1;
|
|
413
|
+
required int64 ctidTraderAccountId = 2;
|
|
414
|
+
required int64 positionId = 3;
|
|
415
|
+
required int64 volume = 4;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
message ProtoOACancelOrderReq {
|
|
419
|
+
optional uint32 payloadType = 1;
|
|
420
|
+
required int64 ctidTraderAccountId = 2;
|
|
421
|
+
required int64 orderId = 3;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
message ProtoOAExecutionEvent {
|
|
425
|
+
optional uint32 payloadType = 1;
|
|
426
|
+
required int64 ctidTraderAccountId = 2;
|
|
427
|
+
required uint32 executionType = 3;
|
|
428
|
+
optional ProtoOAPosition position = 4;
|
|
429
|
+
optional ProtoOAOrder order = 5;
|
|
430
|
+
optional string errorCode = 8;
|
|
431
|
+
optional bool isServerEvent = 9;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// ── Order-error event (payloadType 2132) ────────────────────────────────
|
|
435
|
+
//
|
|
436
|
+
// Emitted when the broker rejects an order submission (bad price, out of
|
|
437
|
+
// hours, insufficient margin, etc.). Field numbers/types transcribed from
|
|
438
|
+
// Spotware's ProtoOAOrderErrorEvent (OpenApiMessages.proto). This is a REJECT
|
|
439
|
+
// on a money path — it MUST map to a CTraderError, never resolve as success.
|
|
440
|
+
message ProtoOAOrderErrorEvent {
|
|
441
|
+
optional uint32 payloadType = 1;
|
|
442
|
+
required int64 ctidTraderAccountId = 2;
|
|
443
|
+
required string errorCode = 3;
|
|
444
|
+
optional int64 orderId = 4;
|
|
445
|
+
optional int64 positionId = 5;
|
|
446
|
+
optional string description = 6;
|
|
447
|
+
}
|