hedgequantx 1.1.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.
@@ -0,0 +1,1766 @@
1
+ {
2
+ "openapi": "3.0.3",
3
+ "info": {
4
+ "title": "ProjectX Gateway API",
5
+ "description": "ProjectX Trading, LLC - Gateway API for prop firms and evaluation providers. Provides account customization, risk rules & monitoring, liquidations, statistics and robust permissioning.",
6
+ "version": "1.0.0",
7
+ "contact": {
8
+ "name": "ProjectX Trading, LLC",
9
+ "url": "https://www.projectx.com"
10
+ }
11
+ },
12
+ "servers": [
13
+ {
14
+ "url": "https://gateway-api-demo.s2f.projectx.com",
15
+ "description": "Demo API Endpoint"
16
+ }
17
+ ],
18
+ "externalDocs": {
19
+ "description": "ProjectX Gateway API Documentation",
20
+ "url": "https://gateway.docs.projectx.com/docs/intro"
21
+ },
22
+ "components": {
23
+ "securitySchemes": {
24
+ "BearerAuth": {
25
+ "type": "http",
26
+ "scheme": "bearer",
27
+ "bearerFormat": "JWT",
28
+ "description": "JSON Web Token obtained from /api/Auth/loginKey or /api/Auth/loginApp. Tokens are valid for 24 hours."
29
+ }
30
+ },
31
+ "schemas": {
32
+ "BaseResponse": {
33
+ "type": "object",
34
+ "properties": {
35
+ "success": {
36
+ "type": "boolean",
37
+ "description": "Indicates if the request was successful"
38
+ },
39
+ "errorCode": {
40
+ "type": "integer",
41
+ "description": "Error code (0 = Success)"
42
+ },
43
+ "errorMessage": {
44
+ "type": "string",
45
+ "nullable": true,
46
+ "description": "Error message if any"
47
+ }
48
+ }
49
+ },
50
+ "LoginKeyRequest": {
51
+ "type": "object",
52
+ "required": ["userName", "apiKey"],
53
+ "properties": {
54
+ "userName": {
55
+ "type": "string",
56
+ "description": "The username"
57
+ },
58
+ "apiKey": {
59
+ "type": "string",
60
+ "description": "The API key obtained from your firm"
61
+ }
62
+ }
63
+ },
64
+ "LoginAppRequest": {
65
+ "type": "object",
66
+ "required": ["userName", "password", "deviceId", "appId", "verifyKey"],
67
+ "properties": {
68
+ "userName": {
69
+ "type": "string",
70
+ "description": "The admin username"
71
+ },
72
+ "password": {
73
+ "type": "string",
74
+ "description": "The admin password"
75
+ },
76
+ "deviceId": {
77
+ "type": "string",
78
+ "description": "The device ID"
79
+ },
80
+ "appId": {
81
+ "type": "string",
82
+ "description": "The application ID"
83
+ },
84
+ "verifyKey": {
85
+ "type": "string",
86
+ "description": "The verify key"
87
+ }
88
+ }
89
+ },
90
+ "LoginResponse": {
91
+ "allOf": [
92
+ { "$ref": "#/components/schemas/BaseResponse" },
93
+ {
94
+ "type": "object",
95
+ "properties": {
96
+ "token": {
97
+ "type": "string",
98
+ "description": "JWT session token valid for 24 hours"
99
+ }
100
+ }
101
+ }
102
+ ]
103
+ },
104
+ "ValidateResponse": {
105
+ "allOf": [
106
+ { "$ref": "#/components/schemas/BaseResponse" },
107
+ {
108
+ "type": "object",
109
+ "properties": {
110
+ "newToken": {
111
+ "type": "string",
112
+ "description": "New JWT session token"
113
+ }
114
+ }
115
+ }
116
+ ]
117
+ },
118
+ "Account": {
119
+ "type": "object",
120
+ "properties": {
121
+ "id": {
122
+ "type": "integer",
123
+ "description": "The account ID"
124
+ },
125
+ "name": {
126
+ "type": "string",
127
+ "description": "The name of the account"
128
+ },
129
+ "balance": {
130
+ "type": "number",
131
+ "format": "decimal",
132
+ "description": "The current balance of the account"
133
+ },
134
+ "canTrade": {
135
+ "type": "boolean",
136
+ "description": "Whether the account is eligible for trading"
137
+ },
138
+ "isVisible": {
139
+ "type": "boolean",
140
+ "description": "Whether the account should be visible"
141
+ },
142
+ "simulated": {
143
+ "type": "boolean",
144
+ "description": "Whether the account is simulated or live"
145
+ }
146
+ }
147
+ },
148
+ "AccountSearchRequest": {
149
+ "type": "object",
150
+ "required": ["onlyActiveAccounts"],
151
+ "properties": {
152
+ "onlyActiveAccounts": {
153
+ "type": "boolean",
154
+ "description": "Whether to filter only active accounts"
155
+ }
156
+ }
157
+ },
158
+ "AccountSearchResponse": {
159
+ "allOf": [
160
+ { "$ref": "#/components/schemas/BaseResponse" },
161
+ {
162
+ "type": "object",
163
+ "properties": {
164
+ "accounts": {
165
+ "type": "array",
166
+ "items": { "$ref": "#/components/schemas/Account" }
167
+ }
168
+ }
169
+ }
170
+ ]
171
+ },
172
+ "Contract": {
173
+ "type": "object",
174
+ "properties": {
175
+ "id": {
176
+ "type": "string",
177
+ "description": "The contract ID (e.g., CON.F.US.ENQ.U25)"
178
+ },
179
+ "name": {
180
+ "type": "string",
181
+ "description": "The contract name (e.g., NQU5)"
182
+ },
183
+ "description": {
184
+ "type": "string",
185
+ "description": "Full description (e.g., E-mini NASDAQ-100: September 2025)"
186
+ },
187
+ "tickSize": {
188
+ "type": "number",
189
+ "format": "decimal",
190
+ "description": "The minimum price movement"
191
+ },
192
+ "tickValue": {
193
+ "type": "number",
194
+ "format": "decimal",
195
+ "description": "The dollar value per tick"
196
+ },
197
+ "activeContract": {
198
+ "type": "boolean",
199
+ "description": "Whether the contract is currently active"
200
+ },
201
+ "symbolId": {
202
+ "type": "string",
203
+ "description": "The symbol ID (e.g., F.US.ENQ)"
204
+ }
205
+ }
206
+ },
207
+ "ContractSearchRequest": {
208
+ "type": "object",
209
+ "required": ["searchText", "live"],
210
+ "properties": {
211
+ "searchText": {
212
+ "type": "string",
213
+ "description": "The name of the contract to search for"
214
+ },
215
+ "live": {
216
+ "type": "boolean",
217
+ "description": "Whether to search for contracts using the sim/live data subscription"
218
+ }
219
+ }
220
+ },
221
+ "ContractSearchResponse": {
222
+ "allOf": [
223
+ { "$ref": "#/components/schemas/BaseResponse" },
224
+ {
225
+ "type": "object",
226
+ "properties": {
227
+ "contracts": {
228
+ "type": "array",
229
+ "items": { "$ref": "#/components/schemas/Contract" },
230
+ "description": "Returns up to 20 contracts at a time"
231
+ }
232
+ }
233
+ }
234
+ ]
235
+ },
236
+ "ContractSearchByIdRequest": {
237
+ "type": "object",
238
+ "required": ["contractId"],
239
+ "properties": {
240
+ "contractId": {
241
+ "type": "string",
242
+ "description": "The id of the contract to search for"
243
+ }
244
+ }
245
+ },
246
+ "ContractSearchByIdResponse": {
247
+ "allOf": [
248
+ { "$ref": "#/components/schemas/BaseResponse" },
249
+ {
250
+ "type": "object",
251
+ "properties": {
252
+ "contract": { "$ref": "#/components/schemas/Contract" }
253
+ }
254
+ }
255
+ ]
256
+ },
257
+ "AvailableContractsRequest": {
258
+ "type": "object",
259
+ "required": ["live"],
260
+ "properties": {
261
+ "live": {
262
+ "type": "boolean",
263
+ "description": "Whether to retrieve live contracts"
264
+ }
265
+ }
266
+ },
267
+ "AvailableContractsResponse": {
268
+ "allOf": [
269
+ { "$ref": "#/components/schemas/BaseResponse" },
270
+ {
271
+ "type": "object",
272
+ "properties": {
273
+ "contracts": {
274
+ "type": "array",
275
+ "items": { "$ref": "#/components/schemas/Contract" }
276
+ }
277
+ }
278
+ }
279
+ ]
280
+ },
281
+ "Bar": {
282
+ "type": "object",
283
+ "properties": {
284
+ "t": {
285
+ "type": "string",
286
+ "format": "date-time",
287
+ "description": "Timestamp of the bar"
288
+ },
289
+ "o": {
290
+ "type": "number",
291
+ "format": "decimal",
292
+ "description": "Open price"
293
+ },
294
+ "h": {
295
+ "type": "number",
296
+ "format": "decimal",
297
+ "description": "High price"
298
+ },
299
+ "l": {
300
+ "type": "number",
301
+ "format": "decimal",
302
+ "description": "Low price"
303
+ },
304
+ "c": {
305
+ "type": "number",
306
+ "format": "decimal",
307
+ "description": "Close price"
308
+ },
309
+ "v": {
310
+ "type": "integer",
311
+ "description": "Volume"
312
+ }
313
+ }
314
+ },
315
+ "RetrieveBarsRequest": {
316
+ "type": "object",
317
+ "required": ["contractId", "live", "startTime", "endTime", "unit", "unitNumber", "limit", "includePartialBar"],
318
+ "properties": {
319
+ "contractId": {
320
+ "type": "string",
321
+ "description": "The contract ID"
322
+ },
323
+ "live": {
324
+ "type": "boolean",
325
+ "description": "Whether to retrieve bars using the sim or live data subscription"
326
+ },
327
+ "startTime": {
328
+ "type": "string",
329
+ "format": "date-time",
330
+ "description": "The start time of the historical data"
331
+ },
332
+ "endTime": {
333
+ "type": "string",
334
+ "format": "date-time",
335
+ "description": "The end time of the historical data"
336
+ },
337
+ "unit": {
338
+ "type": "integer",
339
+ "enum": [1, 2, 3, 4, 5, 6],
340
+ "description": "The unit of aggregation: 1=Second, 2=Minute, 3=Hour, 4=Day, 5=Week, 6=Month"
341
+ },
342
+ "unitNumber": {
343
+ "type": "integer",
344
+ "description": "The number of units to aggregate"
345
+ },
346
+ "limit": {
347
+ "type": "integer",
348
+ "description": "The maximum number of bars to retrieve (max 20000)"
349
+ },
350
+ "includePartialBar": {
351
+ "type": "boolean",
352
+ "description": "Whether to include a partial bar representing the current time unit"
353
+ }
354
+ }
355
+ },
356
+ "RetrieveBarsResponse": {
357
+ "allOf": [
358
+ { "$ref": "#/components/schemas/BaseResponse" },
359
+ {
360
+ "type": "object",
361
+ "properties": {
362
+ "bars": {
363
+ "type": "array",
364
+ "items": { "$ref": "#/components/schemas/Bar" }
365
+ }
366
+ }
367
+ }
368
+ ]
369
+ },
370
+ "Order": {
371
+ "type": "object",
372
+ "properties": {
373
+ "id": {
374
+ "type": "integer",
375
+ "format": "int64",
376
+ "description": "The order ID"
377
+ },
378
+ "accountId": {
379
+ "type": "integer",
380
+ "description": "The account associated with the order"
381
+ },
382
+ "contractId": {
383
+ "type": "string",
384
+ "description": "The contract ID on which the order is placed"
385
+ },
386
+ "symbolId": {
387
+ "type": "string",
388
+ "description": "The symbol ID corresponding to the contract"
389
+ },
390
+ "creationTimestamp": {
391
+ "type": "string",
392
+ "format": "date-time",
393
+ "description": "The timestamp when the order was created"
394
+ },
395
+ "updateTimestamp": {
396
+ "type": "string",
397
+ "format": "date-time",
398
+ "description": "The timestamp when the order was last updated"
399
+ },
400
+ "status": {
401
+ "type": "integer",
402
+ "description": "The current status of the order (OrderStatus enum)"
403
+ },
404
+ "type": {
405
+ "type": "integer",
406
+ "description": "The type of the order (OrderType enum)"
407
+ },
408
+ "side": {
409
+ "type": "integer",
410
+ "description": "The side of the order: 0=Bid (buy), 1=Ask (sell)"
411
+ },
412
+ "size": {
413
+ "type": "integer",
414
+ "description": "The size of the order"
415
+ },
416
+ "limitPrice": {
417
+ "type": "number",
418
+ "format": "decimal",
419
+ "nullable": true,
420
+ "description": "The limit price for the order, if applicable"
421
+ },
422
+ "stopPrice": {
423
+ "type": "number",
424
+ "format": "decimal",
425
+ "nullable": true,
426
+ "description": "The stop price for the order, if applicable"
427
+ },
428
+ "fillVolume": {
429
+ "type": "integer",
430
+ "description": "The number of contracts filled on the order"
431
+ },
432
+ "filledPrice": {
433
+ "type": "number",
434
+ "format": "decimal",
435
+ "nullable": true,
436
+ "description": "The price at which the order was filled, if any"
437
+ },
438
+ "customTag": {
439
+ "type": "string",
440
+ "nullable": true,
441
+ "description": "The custom tag associated with the order, if any"
442
+ }
443
+ }
444
+ },
445
+ "OrderSearchRequest": {
446
+ "type": "object",
447
+ "required": ["accountId", "startTimestamp"],
448
+ "properties": {
449
+ "accountId": {
450
+ "type": "integer",
451
+ "description": "The account ID"
452
+ },
453
+ "startTimestamp": {
454
+ "type": "string",
455
+ "format": "date-time",
456
+ "description": "The start of the timestamp filter"
457
+ },
458
+ "endTimestamp": {
459
+ "type": "string",
460
+ "format": "date-time",
461
+ "nullable": true,
462
+ "description": "The end of the timestamp filter"
463
+ }
464
+ }
465
+ },
466
+ "OrderSearchResponse": {
467
+ "allOf": [
468
+ { "$ref": "#/components/schemas/BaseResponse" },
469
+ {
470
+ "type": "object",
471
+ "properties": {
472
+ "orders": {
473
+ "type": "array",
474
+ "items": { "$ref": "#/components/schemas/Order" }
475
+ }
476
+ }
477
+ }
478
+ ]
479
+ },
480
+ "OrderSearchOpenRequest": {
481
+ "type": "object",
482
+ "required": ["accountId"],
483
+ "properties": {
484
+ "accountId": {
485
+ "type": "integer",
486
+ "description": "The account ID"
487
+ }
488
+ }
489
+ },
490
+ "StopLossBracket": {
491
+ "type": "object",
492
+ "required": ["ticks", "type"],
493
+ "properties": {
494
+ "ticks": {
495
+ "type": "integer",
496
+ "description": "Number of ticks for stop loss"
497
+ },
498
+ "type": {
499
+ "type": "integer",
500
+ "description": "Type of stop loss bracket (OrderType enum)"
501
+ }
502
+ }
503
+ },
504
+ "TakeProfitBracket": {
505
+ "type": "object",
506
+ "required": ["ticks", "type"],
507
+ "properties": {
508
+ "ticks": {
509
+ "type": "integer",
510
+ "description": "Number of ticks for take profit"
511
+ },
512
+ "type": {
513
+ "type": "integer",
514
+ "description": "Type of take profit bracket (OrderType enum)"
515
+ }
516
+ }
517
+ },
518
+ "PlaceOrderRequest": {
519
+ "type": "object",
520
+ "required": ["accountId", "contractId", "type", "side", "size"],
521
+ "properties": {
522
+ "accountId": {
523
+ "type": "integer",
524
+ "description": "The account ID"
525
+ },
526
+ "contractId": {
527
+ "type": "string",
528
+ "description": "The contract ID"
529
+ },
530
+ "type": {
531
+ "type": "integer",
532
+ "enum": [1, 2, 4, 5, 6, 7],
533
+ "description": "The order type: 1=Limit, 2=Market, 4=Stop, 5=TrailingStop, 6=JoinBid, 7=JoinAsk"
534
+ },
535
+ "side": {
536
+ "type": "integer",
537
+ "enum": [0, 1],
538
+ "description": "The side of the order: 0=Bid (buy), 1=Ask (sell)"
539
+ },
540
+ "size": {
541
+ "type": "integer",
542
+ "description": "The size of the order"
543
+ },
544
+ "limitPrice": {
545
+ "type": "number",
546
+ "format": "decimal",
547
+ "nullable": true,
548
+ "description": "The limit price for the order, if applicable"
549
+ },
550
+ "stopPrice": {
551
+ "type": "number",
552
+ "format": "decimal",
553
+ "nullable": true,
554
+ "description": "The stop price for the order, if applicable"
555
+ },
556
+ "trailPrice": {
557
+ "type": "number",
558
+ "format": "decimal",
559
+ "nullable": true,
560
+ "description": "The trail price for the order, if applicable"
561
+ },
562
+ "customTag": {
563
+ "type": "string",
564
+ "nullable": true,
565
+ "description": "An optional custom tag for the order. Must be unique across the account"
566
+ },
567
+ "stopLossBracket": {
568
+ "$ref": "#/components/schemas/StopLossBracket",
569
+ "nullable": true,
570
+ "description": "Stop loss bracket configuration"
571
+ },
572
+ "takeProfitBracket": {
573
+ "$ref": "#/components/schemas/TakeProfitBracket",
574
+ "nullable": true,
575
+ "description": "Take profit bracket configuration"
576
+ }
577
+ }
578
+ },
579
+ "PlaceOrderResponse": {
580
+ "allOf": [
581
+ { "$ref": "#/components/schemas/BaseResponse" },
582
+ {
583
+ "type": "object",
584
+ "properties": {
585
+ "orderId": {
586
+ "type": "integer",
587
+ "format": "int64",
588
+ "description": "The ID of the placed order"
589
+ }
590
+ }
591
+ }
592
+ ]
593
+ },
594
+ "CancelOrderRequest": {
595
+ "type": "object",
596
+ "required": ["accountId", "orderId"],
597
+ "properties": {
598
+ "accountId": {
599
+ "type": "integer",
600
+ "description": "The account ID"
601
+ },
602
+ "orderId": {
603
+ "type": "integer",
604
+ "format": "int64",
605
+ "description": "The order ID"
606
+ }
607
+ }
608
+ },
609
+ "ModifyOrderRequest": {
610
+ "type": "object",
611
+ "required": ["accountId", "orderId"],
612
+ "properties": {
613
+ "accountId": {
614
+ "type": "integer",
615
+ "description": "The account ID"
616
+ },
617
+ "orderId": {
618
+ "type": "integer",
619
+ "format": "int64",
620
+ "description": "The order ID"
621
+ },
622
+ "size": {
623
+ "type": "integer",
624
+ "nullable": true,
625
+ "description": "The new size of the order"
626
+ },
627
+ "limitPrice": {
628
+ "type": "number",
629
+ "format": "decimal",
630
+ "nullable": true,
631
+ "description": "The new limit price for the order, if applicable"
632
+ },
633
+ "stopPrice": {
634
+ "type": "number",
635
+ "format": "decimal",
636
+ "nullable": true,
637
+ "description": "The new stop price for the order, if applicable"
638
+ },
639
+ "trailPrice": {
640
+ "type": "number",
641
+ "format": "decimal",
642
+ "nullable": true,
643
+ "description": "The new trail price for the order, if applicable"
644
+ }
645
+ }
646
+ },
647
+ "Position": {
648
+ "type": "object",
649
+ "properties": {
650
+ "id": {
651
+ "type": "integer",
652
+ "description": "The position ID"
653
+ },
654
+ "accountId": {
655
+ "type": "integer",
656
+ "description": "The account associated with the position"
657
+ },
658
+ "contractId": {
659
+ "type": "string",
660
+ "description": "The contract ID associated with the position"
661
+ },
662
+ "creationTimestamp": {
663
+ "type": "string",
664
+ "format": "date-time",
665
+ "description": "The timestamp when the position was created or opened"
666
+ },
667
+ "type": {
668
+ "type": "integer",
669
+ "description": "The type of the position (PositionType enum): 0=Undefined, 1=Long, 2=Short"
670
+ },
671
+ "size": {
672
+ "type": "integer",
673
+ "description": "The size of the position"
674
+ },
675
+ "averagePrice": {
676
+ "type": "number",
677
+ "format": "decimal",
678
+ "description": "The average price of the position"
679
+ }
680
+ }
681
+ },
682
+ "PositionSearchOpenRequest": {
683
+ "type": "object",
684
+ "required": ["accountId"],
685
+ "properties": {
686
+ "accountId": {
687
+ "type": "integer",
688
+ "description": "The account ID"
689
+ }
690
+ }
691
+ },
692
+ "PositionSearchOpenResponse": {
693
+ "allOf": [
694
+ { "$ref": "#/components/schemas/BaseResponse" },
695
+ {
696
+ "type": "object",
697
+ "properties": {
698
+ "positions": {
699
+ "type": "array",
700
+ "items": { "$ref": "#/components/schemas/Position" }
701
+ }
702
+ }
703
+ }
704
+ ]
705
+ },
706
+ "ClosePositionRequest": {
707
+ "type": "object",
708
+ "required": ["accountId", "contractId"],
709
+ "properties": {
710
+ "accountId": {
711
+ "type": "integer",
712
+ "description": "The account ID"
713
+ },
714
+ "contractId": {
715
+ "type": "string",
716
+ "description": "The contract ID"
717
+ }
718
+ }
719
+ },
720
+ "PartialClosePositionRequest": {
721
+ "type": "object",
722
+ "required": ["accountId", "contractId", "size"],
723
+ "properties": {
724
+ "accountId": {
725
+ "type": "integer",
726
+ "description": "The account ID"
727
+ },
728
+ "contractId": {
729
+ "type": "string",
730
+ "description": "The contract ID"
731
+ },
732
+ "size": {
733
+ "type": "integer",
734
+ "description": "The size to close"
735
+ }
736
+ }
737
+ },
738
+ "Trade": {
739
+ "type": "object",
740
+ "properties": {
741
+ "id": {
742
+ "type": "integer",
743
+ "format": "int64",
744
+ "description": "The trade ID"
745
+ },
746
+ "accountId": {
747
+ "type": "integer",
748
+ "description": "The account ID associated with the trade"
749
+ },
750
+ "contractId": {
751
+ "type": "string",
752
+ "description": "The contract ID on which the trade occurred"
753
+ },
754
+ "creationTimestamp": {
755
+ "type": "string",
756
+ "format": "date-time",
757
+ "description": "The timestamp when the trade was created"
758
+ },
759
+ "price": {
760
+ "type": "number",
761
+ "format": "decimal",
762
+ "description": "The price at which the trade was executed"
763
+ },
764
+ "profitAndLoss": {
765
+ "type": "number",
766
+ "format": "decimal",
767
+ "nullable": true,
768
+ "description": "The total profit and loss of the trade (null indicates a half-turn trade)"
769
+ },
770
+ "fees": {
771
+ "type": "number",
772
+ "format": "decimal",
773
+ "description": "The total fees associated with the trade"
774
+ },
775
+ "side": {
776
+ "type": "integer",
777
+ "description": "The side of the trade: 0=Bid (buy), 1=Ask (sell)"
778
+ },
779
+ "size": {
780
+ "type": "integer",
781
+ "description": "The size of the trade"
782
+ },
783
+ "voided": {
784
+ "type": "boolean",
785
+ "description": "Whether the trade is voided"
786
+ },
787
+ "orderId": {
788
+ "type": "integer",
789
+ "format": "int64",
790
+ "description": "The order ID associated with the trade"
791
+ }
792
+ }
793
+ },
794
+ "TradeSearchRequest": {
795
+ "type": "object",
796
+ "required": ["accountId", "startTimestamp"],
797
+ "properties": {
798
+ "accountId": {
799
+ "type": "integer",
800
+ "description": "The account ID"
801
+ },
802
+ "startTimestamp": {
803
+ "type": "string",
804
+ "format": "date-time",
805
+ "description": "The start of the timestamp filter"
806
+ },
807
+ "endTimestamp": {
808
+ "type": "string",
809
+ "format": "date-time",
810
+ "nullable": true,
811
+ "description": "The end of the timestamp filter"
812
+ }
813
+ }
814
+ },
815
+ "TradeSearchResponse": {
816
+ "allOf": [
817
+ { "$ref": "#/components/schemas/BaseResponse" },
818
+ {
819
+ "type": "object",
820
+ "properties": {
821
+ "trades": {
822
+ "type": "array",
823
+ "items": { "$ref": "#/components/schemas/Trade" }
824
+ }
825
+ }
826
+ }
827
+ ]
828
+ }
829
+ }
830
+ },
831
+ "security": [
832
+ { "BearerAuth": [] }
833
+ ],
834
+ "tags": [
835
+ { "name": "Auth", "description": "Authentication endpoints" },
836
+ { "name": "Account", "description": "Account management endpoints" },
837
+ { "name": "Contract", "description": "Contract/Market data endpoints" },
838
+ { "name": "History", "description": "Historical data endpoints" },
839
+ { "name": "Order", "description": "Order management endpoints" },
840
+ { "name": "Position", "description": "Position management endpoints" },
841
+ { "name": "Trade", "description": "Trade search endpoints" }
842
+ ],
843
+ "paths": {
844
+ "/api/Auth/loginKey": {
845
+ "post": {
846
+ "tags": ["Auth"],
847
+ "summary": "Authenticate with API key",
848
+ "description": "Authenticates a user using username and API key. Returns a JWT session token valid for 24 hours.",
849
+ "operationId": "Auth_LoginKey",
850
+ "security": [],
851
+ "requestBody": {
852
+ "required": true,
853
+ "content": {
854
+ "application/json": {
855
+ "schema": { "$ref": "#/components/schemas/LoginKeyRequest" },
856
+ "example": {
857
+ "userName": "string",
858
+ "apiKey": "string"
859
+ }
860
+ }
861
+ }
862
+ },
863
+ "responses": {
864
+ "200": {
865
+ "description": "Login successful",
866
+ "content": {
867
+ "application/json": {
868
+ "schema": { "$ref": "#/components/schemas/LoginResponse" },
869
+ "example": {
870
+ "token": "your_session_token_here",
871
+ "success": true,
872
+ "errorCode": 0,
873
+ "errorMessage": null
874
+ }
875
+ }
876
+ }
877
+ },
878
+ "401": {
879
+ "description": "Unauthorized"
880
+ }
881
+ }
882
+ }
883
+ },
884
+ "/api/Auth/loginApp": {
885
+ "post": {
886
+ "tags": ["Auth"],
887
+ "summary": "Authenticate for authorized applications",
888
+ "description": "Authenticates an application using admin credentials, appId, and verifyKey. Returns a JWT session token valid for 24 hours.",
889
+ "operationId": "Auth_LoginApp",
890
+ "security": [],
891
+ "requestBody": {
892
+ "required": true,
893
+ "content": {
894
+ "application/json": {
895
+ "schema": { "$ref": "#/components/schemas/LoginAppRequest" },
896
+ "example": {
897
+ "userName": "yourUsername",
898
+ "password": "yourPassword",
899
+ "deviceId": "yourDeviceId",
900
+ "appId": "yourApplicationID",
901
+ "verifyKey": "yourVerifyKey"
902
+ }
903
+ }
904
+ }
905
+ },
906
+ "responses": {
907
+ "200": {
908
+ "description": "Login successful",
909
+ "content": {
910
+ "application/json": {
911
+ "schema": { "$ref": "#/components/schemas/LoginResponse" }
912
+ }
913
+ }
914
+ },
915
+ "401": {
916
+ "description": "Unauthorized"
917
+ }
918
+ }
919
+ }
920
+ },
921
+ "/api/Auth/validate": {
922
+ "post": {
923
+ "tags": ["Auth"],
924
+ "summary": "Validate and refresh session token",
925
+ "description": "Validates an existing session token and returns a new token if the current one is expired. Tokens are valid for 24 hours.",
926
+ "operationId": "Auth_Validate",
927
+ "responses": {
928
+ "200": {
929
+ "description": "Validation successful",
930
+ "content": {
931
+ "application/json": {
932
+ "schema": { "$ref": "#/components/schemas/ValidateResponse" },
933
+ "example": {
934
+ "success": true,
935
+ "errorCode": 0,
936
+ "errorMessage": null,
937
+ "newToken": "NEW_TOKEN"
938
+ }
939
+ }
940
+ }
941
+ },
942
+ "401": {
943
+ "description": "Unauthorized"
944
+ }
945
+ }
946
+ }
947
+ },
948
+ "/api/Account/search": {
949
+ "post": {
950
+ "tags": ["Account"],
951
+ "summary": "Search for accounts",
952
+ "description": "Search for accounts associated with the authenticated user.",
953
+ "operationId": "Account_SearchAccounts",
954
+ "requestBody": {
955
+ "required": true,
956
+ "content": {
957
+ "application/json": {
958
+ "schema": { "$ref": "#/components/schemas/AccountSearchRequest" },
959
+ "example": {
960
+ "onlyActiveAccounts": true
961
+ }
962
+ }
963
+ }
964
+ },
965
+ "responses": {
966
+ "200": {
967
+ "description": "Accounts retrieved successfully",
968
+ "content": {
969
+ "application/json": {
970
+ "schema": { "$ref": "#/components/schemas/AccountSearchResponse" },
971
+ "example": {
972
+ "accounts": [
973
+ {
974
+ "id": 1,
975
+ "name": "TEST_ACCOUNT_1",
976
+ "balance": 50000,
977
+ "canTrade": true,
978
+ "isVisible": true
979
+ }
980
+ ],
981
+ "success": true,
982
+ "errorCode": 0,
983
+ "errorMessage": null
984
+ }
985
+ }
986
+ }
987
+ },
988
+ "401": {
989
+ "description": "Unauthorized"
990
+ }
991
+ }
992
+ }
993
+ },
994
+ "/api/Contract/search": {
995
+ "post": {
996
+ "tags": ["Contract"],
997
+ "summary": "Search for contracts",
998
+ "description": "Search for contracts by name. Returns up to 20 contracts at a time.",
999
+ "operationId": "Contract_SearchContracts",
1000
+ "requestBody": {
1001
+ "required": true,
1002
+ "content": {
1003
+ "application/json": {
1004
+ "schema": { "$ref": "#/components/schemas/ContractSearchRequest" },
1005
+ "example": {
1006
+ "live": false,
1007
+ "searchText": "NQ"
1008
+ }
1009
+ }
1010
+ }
1011
+ },
1012
+ "responses": {
1013
+ "200": {
1014
+ "description": "Contracts retrieved successfully",
1015
+ "content": {
1016
+ "application/json": {
1017
+ "schema": { "$ref": "#/components/schemas/ContractSearchResponse" },
1018
+ "example": {
1019
+ "contracts": [
1020
+ {
1021
+ "id": "CON.F.US.ENQ.U25",
1022
+ "name": "NQU5",
1023
+ "description": "E-mini NASDAQ-100: September 2025",
1024
+ "tickSize": 0.25,
1025
+ "tickValue": 5,
1026
+ "activeContract": true,
1027
+ "symbolId": "F.US.ENQ"
1028
+ }
1029
+ ],
1030
+ "success": true,
1031
+ "errorCode": 0,
1032
+ "errorMessage": null
1033
+ }
1034
+ }
1035
+ }
1036
+ },
1037
+ "401": {
1038
+ "description": "Unauthorized"
1039
+ }
1040
+ }
1041
+ }
1042
+ },
1043
+ "/api/Contract/searchById": {
1044
+ "post": {
1045
+ "tags": ["Contract"],
1046
+ "summary": "Search for contract by ID",
1047
+ "description": "Search for a specific contract by its ID.",
1048
+ "operationId": "Contract_SearchContractById",
1049
+ "requestBody": {
1050
+ "required": true,
1051
+ "content": {
1052
+ "application/json": {
1053
+ "schema": { "$ref": "#/components/schemas/ContractSearchByIdRequest" },
1054
+ "example": {
1055
+ "contractId": "CON.F.US.ENQ.H25"
1056
+ }
1057
+ }
1058
+ }
1059
+ },
1060
+ "responses": {
1061
+ "200": {
1062
+ "description": "Contract retrieved successfully",
1063
+ "content": {
1064
+ "application/json": {
1065
+ "schema": { "$ref": "#/components/schemas/ContractSearchByIdResponse" },
1066
+ "example": {
1067
+ "contract": {
1068
+ "id": "CON.F.US.ENQ.H25",
1069
+ "name": "NQH5",
1070
+ "description": "E-mini NASDAQ-100: March 2025",
1071
+ "tickSize": 0.25,
1072
+ "tickValue": 5,
1073
+ "activeContract": false,
1074
+ "symbolId": "F.US.ENQ"
1075
+ },
1076
+ "success": true,
1077
+ "errorCode": 0,
1078
+ "errorMessage": null
1079
+ }
1080
+ }
1081
+ }
1082
+ },
1083
+ "401": {
1084
+ "description": "Unauthorized"
1085
+ }
1086
+ }
1087
+ }
1088
+ },
1089
+ "/api/Contract/available": {
1090
+ "post": {
1091
+ "tags": ["Contract"],
1092
+ "summary": "List available contracts",
1093
+ "description": "Lists all available contracts based on the provided request parameters.",
1094
+ "operationId": "Contract_AvailableContracts",
1095
+ "requestBody": {
1096
+ "required": true,
1097
+ "content": {
1098
+ "application/json": {
1099
+ "schema": { "$ref": "#/components/schemas/AvailableContractsRequest" },
1100
+ "example": {
1101
+ "live": true
1102
+ }
1103
+ }
1104
+ }
1105
+ },
1106
+ "responses": {
1107
+ "200": {
1108
+ "description": "Available contracts retrieved successfully",
1109
+ "content": {
1110
+ "application/json": {
1111
+ "schema": { "$ref": "#/components/schemas/AvailableContractsResponse" }
1112
+ }
1113
+ }
1114
+ },
1115
+ "401": {
1116
+ "description": "Unauthorized"
1117
+ }
1118
+ }
1119
+ }
1120
+ },
1121
+ "/api/History/retrieveBars": {
1122
+ "post": {
1123
+ "tags": ["History"],
1124
+ "summary": "Retrieve historical bars",
1125
+ "description": "Retrieve historical OHLCV bars. Maximum of 20,000 bars per request. Rate limited to 50 requests per 30 seconds.",
1126
+ "operationId": "History_GetBars",
1127
+ "requestBody": {
1128
+ "required": true,
1129
+ "content": {
1130
+ "application/json": {
1131
+ "schema": { "$ref": "#/components/schemas/RetrieveBarsRequest" },
1132
+ "example": {
1133
+ "contractId": "CON.F.US.RTY.Z24",
1134
+ "live": false,
1135
+ "startTime": "2024-12-01T00:00:00Z",
1136
+ "endTime": "2024-12-31T21:00:00Z",
1137
+ "unit": 3,
1138
+ "unitNumber": 1,
1139
+ "limit": 7,
1140
+ "includePartialBar": false
1141
+ }
1142
+ }
1143
+ }
1144
+ },
1145
+ "responses": {
1146
+ "200": {
1147
+ "description": "Bars retrieved successfully",
1148
+ "content": {
1149
+ "application/json": {
1150
+ "schema": { "$ref": "#/components/schemas/RetrieveBarsResponse" },
1151
+ "example": {
1152
+ "bars": [
1153
+ {
1154
+ "t": "2024-12-20T14:00:00+00:00",
1155
+ "o": 2208.1,
1156
+ "h": 2217.0,
1157
+ "l": 2206.7,
1158
+ "c": 2210.1,
1159
+ "v": 87
1160
+ }
1161
+ ],
1162
+ "success": true,
1163
+ "errorCode": 0,
1164
+ "errorMessage": null
1165
+ }
1166
+ }
1167
+ }
1168
+ },
1169
+ "401": {
1170
+ "description": "Unauthorized"
1171
+ },
1172
+ "429": {
1173
+ "description": "Rate limit exceeded (50 requests / 30 seconds)"
1174
+ }
1175
+ }
1176
+ }
1177
+ },
1178
+ "/api/Order/search": {
1179
+ "post": {
1180
+ "tags": ["Order"],
1181
+ "summary": "Search for orders",
1182
+ "description": "Search for orders within a specified time range.",
1183
+ "operationId": "Order_SearchOrders",
1184
+ "requestBody": {
1185
+ "required": true,
1186
+ "content": {
1187
+ "application/json": {
1188
+ "schema": { "$ref": "#/components/schemas/OrderSearchRequest" },
1189
+ "example": {
1190
+ "accountId": 704,
1191
+ "startTimestamp": "2025-07-18T21:00:01.268009+00:00",
1192
+ "endTimestamp": "2025-07-18T21:00:01.278009+00:00"
1193
+ }
1194
+ }
1195
+ }
1196
+ },
1197
+ "responses": {
1198
+ "200": {
1199
+ "description": "Orders retrieved successfully",
1200
+ "content": {
1201
+ "application/json": {
1202
+ "schema": { "$ref": "#/components/schemas/OrderSearchResponse" }
1203
+ }
1204
+ }
1205
+ },
1206
+ "401": {
1207
+ "description": "Unauthorized"
1208
+ }
1209
+ }
1210
+ }
1211
+ },
1212
+ "/api/Order/searchOpen": {
1213
+ "post": {
1214
+ "tags": ["Order"],
1215
+ "summary": "Search for open orders",
1216
+ "description": "Search for currently open orders for an account.",
1217
+ "operationId": "Order_SearchOpenOrders",
1218
+ "requestBody": {
1219
+ "required": true,
1220
+ "content": {
1221
+ "application/json": {
1222
+ "schema": { "$ref": "#/components/schemas/OrderSearchOpenRequest" },
1223
+ "example": {
1224
+ "accountId": 212
1225
+ }
1226
+ }
1227
+ }
1228
+ },
1229
+ "responses": {
1230
+ "200": {
1231
+ "description": "Open orders retrieved successfully",
1232
+ "content": {
1233
+ "application/json": {
1234
+ "schema": { "$ref": "#/components/schemas/OrderSearchResponse" }
1235
+ }
1236
+ }
1237
+ },
1238
+ "401": {
1239
+ "description": "Unauthorized"
1240
+ }
1241
+ }
1242
+ }
1243
+ },
1244
+ "/api/Order/place": {
1245
+ "post": {
1246
+ "tags": ["Order"],
1247
+ "summary": "Place an order",
1248
+ "description": "Place a new order with optional stop loss and take profit brackets.",
1249
+ "operationId": "Order_PlaceOrder",
1250
+ "requestBody": {
1251
+ "required": true,
1252
+ "content": {
1253
+ "application/json": {
1254
+ "schema": { "$ref": "#/components/schemas/PlaceOrderRequest" },
1255
+ "example": {
1256
+ "accountId": 465,
1257
+ "contractId": "CON.F.US.DA6.M25",
1258
+ "type": 2,
1259
+ "side": 1,
1260
+ "size": 1,
1261
+ "limitPrice": null,
1262
+ "stopPrice": null,
1263
+ "trailPrice": null,
1264
+ "customTag": null,
1265
+ "stopLossBracket": {
1266
+ "ticks": 10,
1267
+ "type": 1
1268
+ },
1269
+ "takeProfitBracket": {
1270
+ "ticks": 20,
1271
+ "type": 1
1272
+ }
1273
+ }
1274
+ }
1275
+ }
1276
+ },
1277
+ "responses": {
1278
+ "200": {
1279
+ "description": "Order placed successfully",
1280
+ "content": {
1281
+ "application/json": {
1282
+ "schema": { "$ref": "#/components/schemas/PlaceOrderResponse" },
1283
+ "example": {
1284
+ "orderId": 9056,
1285
+ "success": true,
1286
+ "errorCode": 0,
1287
+ "errorMessage": null
1288
+ }
1289
+ }
1290
+ }
1291
+ },
1292
+ "401": {
1293
+ "description": "Unauthorized"
1294
+ }
1295
+ }
1296
+ }
1297
+ },
1298
+ "/api/Order/cancel": {
1299
+ "post": {
1300
+ "tags": ["Order"],
1301
+ "summary": "Cancel an order",
1302
+ "description": "Cancel an existing open order.",
1303
+ "operationId": "Order_CancelOrder",
1304
+ "requestBody": {
1305
+ "required": true,
1306
+ "content": {
1307
+ "application/json": {
1308
+ "schema": { "$ref": "#/components/schemas/CancelOrderRequest" },
1309
+ "example": {
1310
+ "accountId": 465,
1311
+ "orderId": 26974
1312
+ }
1313
+ }
1314
+ }
1315
+ },
1316
+ "responses": {
1317
+ "200": {
1318
+ "description": "Order cancelled successfully",
1319
+ "content": {
1320
+ "application/json": {
1321
+ "schema": { "$ref": "#/components/schemas/BaseResponse" },
1322
+ "example": {
1323
+ "success": true,
1324
+ "errorCode": 0,
1325
+ "errorMessage": null
1326
+ }
1327
+ }
1328
+ }
1329
+ },
1330
+ "401": {
1331
+ "description": "Unauthorized"
1332
+ }
1333
+ }
1334
+ }
1335
+ },
1336
+ "/api/Order/modify": {
1337
+ "post": {
1338
+ "tags": ["Order"],
1339
+ "summary": "Modify an order",
1340
+ "description": "Modify an existing open order.",
1341
+ "operationId": "Order_ModifyOrder",
1342
+ "requestBody": {
1343
+ "required": true,
1344
+ "content": {
1345
+ "application/json": {
1346
+ "schema": { "$ref": "#/components/schemas/ModifyOrderRequest" },
1347
+ "example": {
1348
+ "accountId": 465,
1349
+ "orderId": 26974,
1350
+ "size": 1,
1351
+ "limitPrice": null,
1352
+ "stopPrice": 1604,
1353
+ "trailPrice": null
1354
+ }
1355
+ }
1356
+ }
1357
+ },
1358
+ "responses": {
1359
+ "200": {
1360
+ "description": "Order modified successfully",
1361
+ "content": {
1362
+ "application/json": {
1363
+ "schema": { "$ref": "#/components/schemas/BaseResponse" }
1364
+ }
1365
+ }
1366
+ },
1367
+ "401": {
1368
+ "description": "Unauthorized"
1369
+ }
1370
+ }
1371
+ }
1372
+ },
1373
+ "/api/Position/searchOpen": {
1374
+ "post": {
1375
+ "tags": ["Position"],
1376
+ "summary": "Search for open positions",
1377
+ "description": "Search for open positions for an account.",
1378
+ "operationId": "Position_SearchOpenPositions",
1379
+ "requestBody": {
1380
+ "required": true,
1381
+ "content": {
1382
+ "application/json": {
1383
+ "schema": { "$ref": "#/components/schemas/PositionSearchOpenRequest" },
1384
+ "example": {
1385
+ "accountId": 536
1386
+ }
1387
+ }
1388
+ }
1389
+ },
1390
+ "responses": {
1391
+ "200": {
1392
+ "description": "Positions retrieved successfully",
1393
+ "content": {
1394
+ "application/json": {
1395
+ "schema": { "$ref": "#/components/schemas/PositionSearchOpenResponse" },
1396
+ "example": {
1397
+ "positions": [
1398
+ {
1399
+ "id": 6124,
1400
+ "accountId": 536,
1401
+ "contractId": "CON.F.US.GMET.J25",
1402
+ "creationTimestamp": "2025-04-21T19:52:32.175721+00:00",
1403
+ "type": 1,
1404
+ "size": 2,
1405
+ "averagePrice": 1575.75
1406
+ }
1407
+ ],
1408
+ "success": true,
1409
+ "errorCode": 0,
1410
+ "errorMessage": null
1411
+ }
1412
+ }
1413
+ }
1414
+ },
1415
+ "401": {
1416
+ "description": "Unauthorized"
1417
+ }
1418
+ }
1419
+ }
1420
+ },
1421
+ "/api/Position/closeContract": {
1422
+ "post": {
1423
+ "tags": ["Position"],
1424
+ "summary": "Close a position",
1425
+ "description": "Close an entire position for a specific contract.",
1426
+ "operationId": "Position_CloseContractPosition",
1427
+ "requestBody": {
1428
+ "required": true,
1429
+ "content": {
1430
+ "application/json": {
1431
+ "schema": { "$ref": "#/components/schemas/ClosePositionRequest" },
1432
+ "example": {
1433
+ "accountId": 536,
1434
+ "contractId": "CON.F.US.GMET.J25"
1435
+ }
1436
+ }
1437
+ }
1438
+ },
1439
+ "responses": {
1440
+ "200": {
1441
+ "description": "Position closed successfully",
1442
+ "content": {
1443
+ "application/json": {
1444
+ "schema": { "$ref": "#/components/schemas/BaseResponse" }
1445
+ }
1446
+ }
1447
+ },
1448
+ "401": {
1449
+ "description": "Unauthorized"
1450
+ }
1451
+ }
1452
+ }
1453
+ },
1454
+ "/api/Position/partialCloseContract": {
1455
+ "post": {
1456
+ "tags": ["Position"],
1457
+ "summary": "Partially close a position",
1458
+ "description": "Partially close a position for a specific contract.",
1459
+ "operationId": "Position_PartialCloseContractPosition",
1460
+ "requestBody": {
1461
+ "required": true,
1462
+ "content": {
1463
+ "application/json": {
1464
+ "schema": { "$ref": "#/components/schemas/PartialClosePositionRequest" },
1465
+ "example": {
1466
+ "accountId": 536,
1467
+ "contractId": "CON.F.US.GMET.J25",
1468
+ "size": 1
1469
+ }
1470
+ }
1471
+ }
1472
+ },
1473
+ "responses": {
1474
+ "200": {
1475
+ "description": "Position partially closed successfully",
1476
+ "content": {
1477
+ "application/json": {
1478
+ "schema": { "$ref": "#/components/schemas/BaseResponse" }
1479
+ }
1480
+ }
1481
+ },
1482
+ "401": {
1483
+ "description": "Unauthorized"
1484
+ }
1485
+ }
1486
+ }
1487
+ },
1488
+ "/api/Trade/search": {
1489
+ "post": {
1490
+ "tags": ["Trade"],
1491
+ "summary": "Search for trades",
1492
+ "description": "Search for trades within a specified time range.",
1493
+ "operationId": "Trade_SearchFilledTrades",
1494
+ "requestBody": {
1495
+ "required": true,
1496
+ "content": {
1497
+ "application/json": {
1498
+ "schema": { "$ref": "#/components/schemas/TradeSearchRequest" },
1499
+ "example": {
1500
+ "accountId": 203,
1501
+ "startTimestamp": "2025-01-20T15:47:39.882Z",
1502
+ "endTimestamp": "2025-01-30T15:47:39.882Z"
1503
+ }
1504
+ }
1505
+ }
1506
+ },
1507
+ "responses": {
1508
+ "200": {
1509
+ "description": "Trades retrieved successfully",
1510
+ "content": {
1511
+ "application/json": {
1512
+ "schema": { "$ref": "#/components/schemas/TradeSearchResponse" },
1513
+ "example": {
1514
+ "trades": [
1515
+ {
1516
+ "id": 8604,
1517
+ "accountId": 203,
1518
+ "contractId": "CON.F.US.EP.H25",
1519
+ "creationTimestamp": "2025-01-21T16:13:52.523293+00:00",
1520
+ "price": 6065.25,
1521
+ "profitAndLoss": 50.0,
1522
+ "fees": 1.4,
1523
+ "side": 1,
1524
+ "size": 1,
1525
+ "voided": false,
1526
+ "orderId": 14328
1527
+ }
1528
+ ],
1529
+ "success": true,
1530
+ "errorCode": 0,
1531
+ "errorMessage": null
1532
+ }
1533
+ }
1534
+ }
1535
+ },
1536
+ "401": {
1537
+ "description": "Unauthorized"
1538
+ }
1539
+ }
1540
+ }
1541
+ }
1542
+ },
1543
+ "x-realtime": {
1544
+ "description": "Real-time updates via SignalR WebSocket",
1545
+ "hubs": {
1546
+ "user": {
1547
+ "url": "https://gateway-rtc-demo.s2f.projectx.com/hubs/user",
1548
+ "description": "Provides real-time updates to a user's accounts, orders, positions, and trades",
1549
+ "methods": {
1550
+ "subscribe": [
1551
+ "SubscribeAccounts",
1552
+ "SubscribeOrders(accountId)",
1553
+ "SubscribePositions(accountId)",
1554
+ "SubscribeTrades(accountId)"
1555
+ ],
1556
+ "unsubscribe": [
1557
+ "UnsubscribeAccounts",
1558
+ "UnsubscribeOrders(accountId)",
1559
+ "UnsubscribePositions(accountId)",
1560
+ "UnsubscribeTrades(accountId)"
1561
+ ]
1562
+ },
1563
+ "events": {
1564
+ "GatewayUserAccount": {
1565
+ "description": "Account update event",
1566
+ "payload": {
1567
+ "id": "int",
1568
+ "name": "string",
1569
+ "balance": "number",
1570
+ "canTrade": "bool",
1571
+ "isVisible": "bool",
1572
+ "simulated": "bool"
1573
+ }
1574
+ },
1575
+ "GatewayUserOrder": {
1576
+ "description": "Order update event",
1577
+ "payload": {
1578
+ "id": "long",
1579
+ "accountId": "int",
1580
+ "contractId": "string",
1581
+ "symbolId": "string",
1582
+ "creationTimestamp": "string",
1583
+ "updateTimestamp": "string",
1584
+ "status": "int (OrderStatus enum)",
1585
+ "type": "int (OrderType enum)",
1586
+ "side": "int (OrderSide enum)",
1587
+ "size": "int",
1588
+ "limitPrice": "number",
1589
+ "stopPrice": "number",
1590
+ "fillVolume": "int",
1591
+ "filledPrice": "number",
1592
+ "customTag": "string"
1593
+ }
1594
+ },
1595
+ "GatewayUserPosition": {
1596
+ "description": "Position update event",
1597
+ "payload": {
1598
+ "id": "int",
1599
+ "accountId": "int",
1600
+ "contractId": "string",
1601
+ "creationTimestamp": "string",
1602
+ "type": "int (PositionType enum)",
1603
+ "size": "int",
1604
+ "averagePrice": "number"
1605
+ }
1606
+ },
1607
+ "GatewayUserTrade": {
1608
+ "description": "Trade update event",
1609
+ "payload": {
1610
+ "id": "long",
1611
+ "accountId": "int",
1612
+ "contractId": "string",
1613
+ "creationTimestamp": "string",
1614
+ "price": "number",
1615
+ "profitAndLoss": "number",
1616
+ "fees": "number",
1617
+ "side": "int (OrderSide enum)",
1618
+ "size": "int",
1619
+ "voided": "bool",
1620
+ "orderId": "long"
1621
+ }
1622
+ }
1623
+ }
1624
+ },
1625
+ "market": {
1626
+ "url": "https://gateway-rtc-demo.s2f.projectx.com/hubs/market",
1627
+ "description": "Provides market data such as quotes, trades, and DOM events",
1628
+ "methods": {
1629
+ "subscribe": [
1630
+ "SubscribeContractQuotes(contractId)",
1631
+ "SubscribeContractTrades(contractId)",
1632
+ "SubscribeContractMarketDepth(contractId)"
1633
+ ],
1634
+ "unsubscribe": [
1635
+ "UnsubscribeContractQuotes(contractId)",
1636
+ "UnsubscribeContractTrades(contractId)",
1637
+ "UnsubscribeContractMarketDepth(contractId)"
1638
+ ]
1639
+ },
1640
+ "events": {
1641
+ "GatewayQuote": {
1642
+ "description": "Quote update event",
1643
+ "payload": {
1644
+ "symbol": "string",
1645
+ "symbolName": "string",
1646
+ "lastPrice": "number",
1647
+ "bestBid": "number",
1648
+ "bestAsk": "number",
1649
+ "change": "number",
1650
+ "changePercent": "number",
1651
+ "open": "number",
1652
+ "high": "number",
1653
+ "low": "number",
1654
+ "volume": "number",
1655
+ "lastUpdated": "string",
1656
+ "timestamp": "string"
1657
+ }
1658
+ },
1659
+ "GatewayDepth": {
1660
+ "description": "DOM/Depth update event",
1661
+ "payload": {
1662
+ "timestamp": "string",
1663
+ "type": "int (DomType enum)",
1664
+ "price": "number",
1665
+ "volume": "number",
1666
+ "currentVolume": "int"
1667
+ }
1668
+ },
1669
+ "GatewayTrade": {
1670
+ "description": "Market trade event",
1671
+ "payload": {
1672
+ "symbolId": "string",
1673
+ "price": "number",
1674
+ "timestamp": "string",
1675
+ "type": "int (TradeLogType enum)",
1676
+ "volume": "number"
1677
+ }
1678
+ }
1679
+ }
1680
+ }
1681
+ },
1682
+ "connectionExample": {
1683
+ "javascript": "const { HubConnectionBuilder, HttpTransportType } = require('@microsoft/signalr');\nconst JWT_TOKEN = 'your_bearer_token';\nconst userHubUrl = 'https://gateway-rtc-demo.s2f.projectx.com/hubs/user?access_token=YOUR_JWT_TOKEN';\nconst rtcConnection = new HubConnectionBuilder()\n .withUrl(userHubUrl, {\n skipNegotiation: true,\n transport: HttpTransportType.WebSockets,\n accessTokenFactory: () => JWT_TOKEN,\n timeout: 10000\n })\n .withAutomaticReconnect()\n .build();"
1684
+ }
1685
+ },
1686
+ "x-enums": {
1687
+ "OrderSide": {
1688
+ "Bid": 0,
1689
+ "Ask": 1
1690
+ },
1691
+ "OrderType": {
1692
+ "Unknown": 0,
1693
+ "Limit": 1,
1694
+ "Market": 2,
1695
+ "StopLimit": 3,
1696
+ "Stop": 4,
1697
+ "TrailingStop": 5,
1698
+ "JoinBid": 6,
1699
+ "JoinAsk": 7
1700
+ },
1701
+ "OrderStatus": {
1702
+ "None": 0,
1703
+ "Open": 1,
1704
+ "Filled": 2,
1705
+ "Cancelled": 3,
1706
+ "Expired": 4,
1707
+ "Rejected": 5,
1708
+ "Pending": 6
1709
+ },
1710
+ "PositionType": {
1711
+ "Undefined": 0,
1712
+ "Long": 1,
1713
+ "Short": 2
1714
+ },
1715
+ "DomType": {
1716
+ "Unknown": 0,
1717
+ "Ask": 1,
1718
+ "Bid": 2,
1719
+ "BestAsk": 3,
1720
+ "BestBid": 4,
1721
+ "Trade": 5,
1722
+ "Reset": 6,
1723
+ "Low": 7,
1724
+ "High": 8,
1725
+ "NewBestBid": 9,
1726
+ "NewBestAsk": 10,
1727
+ "Fill": 11
1728
+ },
1729
+ "TradeLogType": {
1730
+ "Buy": 0,
1731
+ "Sell": 1
1732
+ },
1733
+ "BarUnit": {
1734
+ "Second": 1,
1735
+ "Minute": 2,
1736
+ "Hour": 3,
1737
+ "Day": 4,
1738
+ "Week": 5,
1739
+ "Month": 6
1740
+ }
1741
+ },
1742
+ "x-rateLimits": {
1743
+ "description": "Rate limiting system for all authenticated requests",
1744
+ "limits": [
1745
+ {
1746
+ "endpoints": ["POST /api/History/retrieveBars"],
1747
+ "limit": "50 requests / 30 seconds"
1748
+ },
1749
+ {
1750
+ "endpoints": ["All other endpoints"],
1751
+ "limit": "200 requests / 60 seconds"
1752
+ }
1753
+ ],
1754
+ "exceededResponse": {
1755
+ "statusCode": 429,
1756
+ "description": "Too Many Requests - reduce request frequency and retry after a short delay"
1757
+ }
1758
+ },
1759
+ "x-connectionUrls": {
1760
+ "demo": {
1761
+ "apiEndpoint": "https://gateway-api-demo.s2f.projectx.com",
1762
+ "userHub": "https://gateway-rtc-demo.s2f.projectx.com/hubs/user",
1763
+ "marketHub": "https://gateway-rtc-demo.s2f.projectx.com/hubs/market"
1764
+ }
1765
+ }
1766
+ }