@alfe.ai/ctrader-mcp 0.2.0 → 0.2.1
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/package.json +1 -1
- package/proto/ctrader.proto +48 -29
package/package.json
CHANGED
package/proto/ctrader.proto
CHANGED
|
@@ -119,11 +119,16 @@ message ProtoOACtidTraderAccount {
|
|
|
119
119
|
optional string brokerTitleShort = 6;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
// Canonical: permissionScope=3 (an enum upstream; we don't read it, kept as a
|
|
123
|
+
// scalar), ctidTraderAccount=4. This response is declared for completeness but
|
|
124
|
+
// is NOT on the live path — accounts come from AgentApiClient.getCTraderAccounts(),
|
|
125
|
+
// not this socket call. Field numbers corrected to match canonical anyway so a
|
|
126
|
+
// future decode of this message reads the account list at the right field.
|
|
122
127
|
message ProtoOAGetAccountListByAccessTokenRes {
|
|
123
128
|
optional uint32 payloadType = 1;
|
|
124
129
|
required string accessToken = 2;
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
optional uint32 permissionScope = 3;
|
|
131
|
+
repeated ProtoOACtidTraderAccount ctidTraderAccount = 4;
|
|
127
132
|
}
|
|
128
133
|
|
|
129
134
|
// ── Trader (balance / account details) ──────────────────────────────────
|
|
@@ -194,30 +199,33 @@ message ProtoOAPosition {
|
|
|
194
199
|
optional bool trailingStopLoss = 16;
|
|
195
200
|
}
|
|
196
201
|
|
|
202
|
+
// NOTE: canonical ProtoOAOrder has NO field 5 — it jumps orderStatus=4 → expirationTimestamp=6.
|
|
203
|
+
// Field numbers below are transcribed verbatim from Spotware's ProtoOAOrder
|
|
204
|
+
// (relativeStopLoss/relativeTakeProfit are int64, not double, upstream).
|
|
197
205
|
message ProtoOAOrder {
|
|
198
206
|
required int64 orderId = 1;
|
|
199
207
|
required ProtoOATradeData tradeData = 2;
|
|
200
208
|
required ProtoOAOrderType orderType = 3;
|
|
201
209
|
required uint32 orderStatus = 4;
|
|
202
|
-
optional int64 expirationTimestamp =
|
|
203
|
-
optional double executionPrice =
|
|
204
|
-
optional int64 executedVolume =
|
|
205
|
-
optional int64 utcLastUpdateTimestamp =
|
|
206
|
-
optional double baseSlippagePrice =
|
|
207
|
-
optional int64 slippageInPoints =
|
|
208
|
-
optional bool closingOrder =
|
|
209
|
-
optional double limitPrice =
|
|
210
|
-
optional double stopPrice =
|
|
211
|
-
optional double stopLoss =
|
|
212
|
-
optional double takeProfit =
|
|
213
|
-
optional string clientOrderId =
|
|
214
|
-
optional uint32 timeInForce =
|
|
215
|
-
optional int64 positionId =
|
|
216
|
-
optional
|
|
217
|
-
optional
|
|
218
|
-
optional bool isStopOut =
|
|
219
|
-
optional bool trailingStopLoss =
|
|
220
|
-
optional uint32 stopTriggerMethod =
|
|
210
|
+
optional int64 expirationTimestamp = 6;
|
|
211
|
+
optional double executionPrice = 7;
|
|
212
|
+
optional int64 executedVolume = 8;
|
|
213
|
+
optional int64 utcLastUpdateTimestamp = 9;
|
|
214
|
+
optional double baseSlippagePrice = 10;
|
|
215
|
+
optional int64 slippageInPoints = 11;
|
|
216
|
+
optional bool closingOrder = 12;
|
|
217
|
+
optional double limitPrice = 13;
|
|
218
|
+
optional double stopPrice = 14;
|
|
219
|
+
optional double stopLoss = 15;
|
|
220
|
+
optional double takeProfit = 16;
|
|
221
|
+
optional string clientOrderId = 17;
|
|
222
|
+
optional uint32 timeInForce = 18;
|
|
223
|
+
optional int64 positionId = 19;
|
|
224
|
+
optional int64 relativeStopLoss = 20;
|
|
225
|
+
optional int64 relativeTakeProfit = 21;
|
|
226
|
+
optional bool isStopOut = 22;
|
|
227
|
+
optional bool trailingStopLoss = 23;
|
|
228
|
+
optional uint32 stopTriggerMethod = 24;
|
|
221
229
|
}
|
|
222
230
|
|
|
223
231
|
message ProtoOAReconcileReq {
|
|
@@ -278,7 +286,10 @@ message ProtoOASymbol {
|
|
|
278
286
|
optional int64 minVolume = 10;
|
|
279
287
|
optional int64 stepVolume = 11;
|
|
280
288
|
optional int64 maxExposure = 12;
|
|
281
|
-
|
|
289
|
+
// lotSize is canonical field 30 (NOT 21 — field 21 is the deprecated
|
|
290
|
+
// minCommission). Reading it at 21 yields 0 for XAUUSD → SYMBOL_NO_LOTSIZE
|
|
291
|
+
// and mis-sizes volume for any symbol where field 21 is non-zero.
|
|
292
|
+
optional int64 lotSize = 30;
|
|
282
293
|
}
|
|
283
294
|
|
|
284
295
|
message ProtoOASymbolByIdReq {
|
|
@@ -421,14 +432,18 @@ message ProtoOACancelOrderReq {
|
|
|
421
432
|
required int64 orderId = 3;
|
|
422
433
|
}
|
|
423
434
|
|
|
435
|
+
// errorCode is canonical field 9 and isServerEvent field 10 (fields 6/7/8 are
|
|
436
|
+
// deal / bonusDepositWithdraw / depositWithdraw upstream, which we don't decode).
|
|
437
|
+
// An order-op rejection can ride here with errorCode set, so the field number
|
|
438
|
+
// is on the money path — reading errorCode at 8 misses the reject entirely.
|
|
424
439
|
message ProtoOAExecutionEvent {
|
|
425
440
|
optional uint32 payloadType = 1;
|
|
426
441
|
required int64 ctidTraderAccountId = 2;
|
|
427
442
|
required uint32 executionType = 3;
|
|
428
443
|
optional ProtoOAPosition position = 4;
|
|
429
444
|
optional ProtoOAOrder order = 5;
|
|
430
|
-
optional string errorCode =
|
|
431
|
-
optional bool isServerEvent =
|
|
445
|
+
optional string errorCode = 9;
|
|
446
|
+
optional bool isServerEvent = 10;
|
|
432
447
|
}
|
|
433
448
|
|
|
434
449
|
// ── Order-error event (payloadType 2132) ────────────────────────────────
|
|
@@ -437,11 +452,15 @@ message ProtoOAExecutionEvent {
|
|
|
437
452
|
// hours, insufficient margin, etc.). Field numbers/types transcribed from
|
|
438
453
|
// Spotware's ProtoOAOrderErrorEvent (OpenApiMessages.proto). This is a REJECT
|
|
439
454
|
// on a money path — it MUST map to a CTraderError, never resolve as success.
|
|
455
|
+
// Canonical field numbers are NOT sequential: errorCode=2, orderId=3,
|
|
456
|
+
// ctidTraderAccountId=5, positionId=6, description=7. Getting these wrong
|
|
457
|
+
// means the reject decodes to an empty errorCode and fails to map to a
|
|
458
|
+
// CTraderError — reintroducing the 2132 phantom-success bug.
|
|
440
459
|
message ProtoOAOrderErrorEvent {
|
|
441
460
|
optional uint32 payloadType = 1;
|
|
442
|
-
required
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
optional int64 positionId =
|
|
446
|
-
optional string description =
|
|
461
|
+
required string errorCode = 2;
|
|
462
|
+
optional int64 orderId = 3;
|
|
463
|
+
required int64 ctidTraderAccountId = 5;
|
|
464
|
+
optional int64 positionId = 6;
|
|
465
|
+
optional string description = 7;
|
|
447
466
|
}
|