@autonomaai/api-schemas 1.0.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/openapi.yaml ADDED
@@ -0,0 +1,1434 @@
1
+ openapi: 3.0.3
2
+ info:
3
+ title: autonoma Unified API
4
+ description: |
5
+ Standardized API specification for all autonoma services.
6
+
7
+ This specification normalizes schemas across:
8
+ - Hummingbot MCP Server
9
+ - Backend API
10
+ - Market Maker Agent
11
+ - Data Collector
12
+ - RAG Service
13
+
14
+ **Key Improvements:**
15
+ - Consistent request/response formats
16
+ - Standardized error schemas
17
+ - Unified controller metadata propagation
18
+ - Version-consistent API contracts
19
+
20
+ version: "1.0.0"
21
+ contact:
22
+ name: autonoma Team
23
+ url: https://github.com/autonoma/autonoma
24
+ license:
25
+ name: MIT
26
+ url: https://opensource.org/licenses/MIT
27
+
28
+ servers:
29
+ - url: http://localhost:8000
30
+ description: Hummingbot MCP Server / Data Collector MCP Server
31
+ - url: http://localhost:8001
32
+ description: Backend API
33
+ - url: http://localhost:3000
34
+ description: DexScreener MCP Server (Solana Token Analysis)
35
+ - url: http://localhost:3002
36
+ description: RAG Service
37
+
38
+ paths:
39
+ # =============================================================================
40
+ # Health and Context Endpoints
41
+ # =============================================================================
42
+
43
+ /health:
44
+ get:
45
+ summary: Get system health status
46
+ description: Returns comprehensive system health and capabilities
47
+ tags: [System]
48
+ responses:
49
+ '200':
50
+ description: System health information
51
+ content:
52
+ application/json:
53
+ schema:
54
+ $ref: '#/components/schemas/HealthResponse'
55
+ '500':
56
+ $ref: '#/components/responses/InternalServerError'
57
+
58
+ /context:
59
+ get:
60
+ summary: Get system context and capabilities
61
+ description: Returns detailed system context for AI agents
62
+ tags: [System]
63
+ responses:
64
+ '200':
65
+ description: System context information
66
+ content:
67
+ application/json:
68
+ schema:
69
+ $ref: '#/components/schemas/ContextResponse'
70
+ '500':
71
+ $ref: '#/components/responses/InternalServerError'
72
+
73
+ # =============================================================================
74
+ # Controller Management Endpoints (Normalized)
75
+ # =============================================================================
76
+
77
+ /controllers:
78
+ get:
79
+ summary: List all controllers
80
+ description: Returns list of all trading controllers
81
+ tags: [Controllers]
82
+ parameters:
83
+ - in: query
84
+ name: status
85
+ schema:
86
+ type: string
87
+ enum: [active, inactive, error]
88
+ description: Filter controllers by status
89
+ - in: query
90
+ name: strategy
91
+ schema:
92
+ type: string
93
+ description: Filter controllers by strategy type
94
+ responses:
95
+ '200':
96
+ description: List of controllers
97
+ content:
98
+ application/json:
99
+ schema:
100
+ type: object
101
+ properties:
102
+ controllers:
103
+ type: array
104
+ items:
105
+ $ref: '#/components/schemas/Controller'
106
+ count:
107
+ type: integer
108
+ status:
109
+ type: string
110
+ enum: [success]
111
+ '500':
112
+ $ref: '#/components/responses/InternalServerError'
113
+
114
+ post:
115
+ summary: Create new controller
116
+ description: Creates a new trading controller with specified configuration
117
+ tags: [Controllers]
118
+ requestBody:
119
+ required: true
120
+ content:
121
+ application/json:
122
+ schema:
123
+ $ref: '#/components/schemas/CreateControllerRequest'
124
+ responses:
125
+ '201':
126
+ description: Controller created successfully
127
+ content:
128
+ application/json:
129
+ schema:
130
+ allOf:
131
+ - $ref: '#/components/schemas/SuccessResponse'
132
+ - type: object
133
+ properties:
134
+ data:
135
+ $ref: '#/components/schemas/Controller'
136
+ '400':
137
+ $ref: '#/components/responses/BadRequest'
138
+ '500':
139
+ $ref: '#/components/responses/InternalServerError'
140
+
141
+ /controllers/{controller_id}:
142
+ parameters:
143
+ - $ref: '#/components/parameters/ControllerIdPath'
144
+
145
+ get:
146
+ summary: Get controller details
147
+ description: Returns detailed information about a specific controller
148
+ tags: [Controllers]
149
+ responses:
150
+ '200':
151
+ description: Controller details
152
+ content:
153
+ application/json:
154
+ schema:
155
+ allOf:
156
+ - $ref: '#/components/schemas/SuccessResponse'
157
+ - type: object
158
+ properties:
159
+ data:
160
+ $ref: '#/components/schemas/Controller'
161
+ '404':
162
+ $ref: '#/components/responses/NotFound'
163
+ '500':
164
+ $ref: '#/components/responses/InternalServerError'
165
+
166
+ put:
167
+ summary: Update controller configuration
168
+ description: Updates the configuration of an existing controller
169
+ tags: [Controllers]
170
+ requestBody:
171
+ required: true
172
+ content:
173
+ application/json:
174
+ schema:
175
+ $ref: '#/components/schemas/UpdateControllerRequest'
176
+ responses:
177
+ '200':
178
+ description: Controller updated successfully
179
+ content:
180
+ application/json:
181
+ schema:
182
+ allOf:
183
+ - $ref: '#/components/schemas/SuccessResponse'
184
+ - type: object
185
+ properties:
186
+ data:
187
+ $ref: '#/components/schemas/Controller'
188
+ '400':
189
+ $ref: '#/components/responses/BadRequest'
190
+ '404':
191
+ $ref: '#/components/responses/NotFound'
192
+ '500':
193
+ $ref: '#/components/responses/InternalServerError'
194
+
195
+ delete:
196
+ summary: Delete controller
197
+ description: Stops and removes a controller
198
+ tags: [Controllers]
199
+ responses:
200
+ '200':
201
+ description: Controller deleted successfully
202
+ content:
203
+ application/json:
204
+ schema:
205
+ $ref: '#/components/schemas/SuccessResponse'
206
+ '404':
207
+ $ref: '#/components/responses/NotFound'
208
+ '500':
209
+ $ref: '#/components/responses/InternalServerError'
210
+
211
+ /controllers/{controller_id}/start:
212
+ parameters:
213
+ - $ref: '#/components/parameters/ControllerIdPath'
214
+
215
+ post:
216
+ summary: Start controller
217
+ description: Starts a stopped controller
218
+ tags: [Controllers]
219
+ responses:
220
+ '200':
221
+ description: Controller started successfully
222
+ content:
223
+ application/json:
224
+ schema:
225
+ $ref: '#/components/schemas/SuccessResponse'
226
+ '400':
227
+ $ref: '#/components/responses/BadRequest'
228
+ '404':
229
+ $ref: '#/components/responses/NotFound'
230
+ '500':
231
+ $ref: '#/components/responses/InternalServerError'
232
+
233
+ /controllers/{controller_id}/stop:
234
+ parameters:
235
+ - $ref: '#/components/parameters/ControllerIdPath'
236
+
237
+ post:
238
+ summary: Stop controller
239
+ description: Stops a running controller
240
+ tags: [Controllers]
241
+ responses:
242
+ '200':
243
+ description: Controller stopped successfully
244
+ content:
245
+ application/json:
246
+ schema:
247
+ $ref: '#/components/schemas/SuccessResponse'
248
+ '400':
249
+ $ref: '#/components/responses/BadRequest'
250
+ '404':
251
+ $ref: '#/components/responses/NotFound'
252
+ '500':
253
+ $ref: '#/components/responses/InternalServerError'
254
+
255
+ /controllers/{controller_id}/metrics:
256
+ parameters:
257
+ - $ref: '#/components/parameters/ControllerIdPath'
258
+
259
+ get:
260
+ summary: Get controller metrics
261
+ description: Returns performance metrics for a controller
262
+ tags: [Controllers]
263
+ responses:
264
+ '200':
265
+ description: Controller metrics
266
+ content:
267
+ application/json:
268
+ schema:
269
+ allOf:
270
+ - $ref: '#/components/schemas/SuccessResponse'
271
+ - type: object
272
+ properties:
273
+ data:
274
+ $ref: '#/components/schemas/ControllerMetrics'
275
+ '404':
276
+ $ref: '#/components/responses/NotFound'
277
+ '500':
278
+ $ref: '#/components/responses/InternalServerError'
279
+
280
+ # =============================================================================
281
+ # Trading Operations (Unified Schema)
282
+ # =============================================================================
283
+
284
+ /trading/exchanges:
285
+ get:
286
+ summary: List supported exchanges
287
+ description: Returns list of all supported exchanges and their capabilities
288
+ tags: [Trading]
289
+ responses:
290
+ '200':
291
+ description: List of supported exchanges
292
+ content:
293
+ application/json:
294
+ schema:
295
+ $ref: '#/components/schemas/ExchangeListResponse'
296
+ '500':
297
+ $ref: '#/components/responses/InternalServerError'
298
+
299
+ /trading/signals/execute:
300
+ post:
301
+ summary: Execute trading signal (Unified)
302
+ description: |
303
+ **UNIFIED ENDPOINT** for executing trading signals.
304
+
305
+ This replaces the previous inconsistent endpoints:
306
+ - `/trading/execute-signal`
307
+ - `/trading/{controller_id}/signal`
308
+
309
+ Now uses standardized TradingSignal schema.
310
+ tags: [Trading]
311
+ requestBody:
312
+ required: true
313
+ content:
314
+ application/json:
315
+ schema:
316
+ $ref: '#/components/schemas/ExecuteSignalRequest'
317
+ responses:
318
+ '200':
319
+ description: Signal executed successfully
320
+ content:
321
+ application/json:
322
+ schema:
323
+ $ref: '#/components/schemas/SignalExecutionResponse'
324
+ '400':
325
+ $ref: '#/components/responses/BadRequest'
326
+ '404':
327
+ $ref: '#/components/responses/NotFound'
328
+ '500':
329
+ $ref: '#/components/responses/InternalServerError'
330
+
331
+ /trading/controllers/{controller_id}/connect:
332
+ parameters:
333
+ - $ref: '#/components/parameters/ControllerIdPath'
334
+
335
+ post:
336
+ summary: Connect controller to exchange
337
+ description: Establishes connection between controller and exchange
338
+ tags: [Trading]
339
+ requestBody:
340
+ required: true
341
+ content:
342
+ application/json:
343
+ schema:
344
+ $ref: '#/components/schemas/ConnectExchangeRequest'
345
+ responses:
346
+ '200':
347
+ description: Controller connected successfully
348
+ content:
349
+ application/json:
350
+ schema:
351
+ $ref: '#/components/schemas/TradingConnectionResponse'
352
+ '400':
353
+ $ref: '#/components/responses/BadRequest'
354
+ '404':
355
+ $ref: '#/components/responses/NotFound'
356
+ '500':
357
+ $ref: '#/components/responses/InternalServerError'
358
+
359
+ /trading/controllers/{controller_id}/market-data:
360
+ parameters:
361
+ - $ref: '#/components/parameters/ControllerIdPath'
362
+
363
+ get:
364
+ summary: Get market data for controller
365
+ description: Returns current market data for the controller's trading pair
366
+ tags: [Trading]
367
+ responses:
368
+ '200':
369
+ description: Current market data
370
+ content:
371
+ application/json:
372
+ schema:
373
+ allOf:
374
+ - $ref: '#/components/schemas/SuccessResponse'
375
+ - type: object
376
+ properties:
377
+ data:
378
+ $ref: '#/components/schemas/MarketData'
379
+ '404':
380
+ $ref: '#/components/responses/NotFound'
381
+ '500':
382
+ $ref: '#/components/responses/InternalServerError'
383
+
384
+ /trading/controllers/{controller_id}/balance:
385
+ parameters:
386
+ - $ref: '#/components/parameters/ControllerIdPath'
387
+
388
+ get:
389
+ summary: Get account balance
390
+ description: Returns current account balance for the controller
391
+ tags: [Trading]
392
+ responses:
393
+ '200':
394
+ description: Account balance information
395
+ content:
396
+ application/json:
397
+ schema:
398
+ allOf:
399
+ - $ref: '#/components/schemas/SuccessResponse'
400
+ - type: object
401
+ properties:
402
+ data:
403
+ $ref: '#/components/schemas/AccountBalance'
404
+ '404':
405
+ $ref: '#/components/responses/NotFound'
406
+ '500':
407
+ $ref: '#/components/responses/InternalServerError'
408
+
409
+ components:
410
+ parameters:
411
+ ControllerIdPath:
412
+ name: controller_id
413
+ in: path
414
+ required: true
415
+ description: Unique controller identifier
416
+ schema:
417
+ type: string
418
+ pattern: '^[a-zA-Z0-9_-]+$'
419
+ example: 'ctrl_abc123'
420
+
421
+ responses:
422
+ BadRequest:
423
+ description: Bad request - invalid parameters
424
+ content:
425
+ application/json:
426
+ schema:
427
+ $ref: '#/components/schemas/ErrorResponse'
428
+
429
+ NotFound:
430
+ description: Resource not found
431
+ content:
432
+ application/json:
433
+ schema:
434
+ $ref: '#/components/schemas/ErrorResponse'
435
+
436
+ InternalServerError:
437
+ description: Internal server error
438
+ content:
439
+ application/json:
440
+ schema:
441
+ $ref: '#/components/schemas/ErrorResponse'
442
+
443
+ schemas:
444
+ # =============================================================================
445
+ # Common Response Schemas
446
+ # =============================================================================
447
+
448
+ SuccessResponse:
449
+ type: object
450
+ required:
451
+ - success
452
+ - message
453
+ - timestamp
454
+ properties:
455
+ success:
456
+ type: boolean
457
+ example: true
458
+ message:
459
+ type: string
460
+ example: "Operation completed successfully"
461
+ timestamp:
462
+ type: string
463
+ format: date-time
464
+ example: "2024-12-01T12:00:00Z"
465
+
466
+ ErrorResponse:
467
+ type: object
468
+ required:
469
+ - success
470
+ - error
471
+ - timestamp
472
+ properties:
473
+ success:
474
+ type: boolean
475
+ example: false
476
+ error:
477
+ type: string
478
+ example: "Invalid controller ID"
479
+ detail:
480
+ type: string
481
+ example: "Controller ctrl_123 does not exist"
482
+ error_code:
483
+ type: string
484
+ example: "CONTROLLER_NOT_FOUND"
485
+ timestamp:
486
+ type: string
487
+ format: date-time
488
+ example: "2024-12-01T12:00:00Z"
489
+
490
+ # =============================================================================
491
+ # Health and Context Schemas
492
+ # =============================================================================
493
+
494
+ HealthResponse:
495
+ type: object
496
+ required:
497
+ - status
498
+ - version
499
+ - services
500
+ - capabilities
501
+ - timestamp
502
+ properties:
503
+ status:
504
+ type: string
505
+ enum: [healthy, degraded, unhealthy]
506
+ example: "healthy"
507
+ version:
508
+ type: string
509
+ example: "1.0.0"
510
+ system:
511
+ type: string
512
+ example: "autonoma Trading System"
513
+ services:
514
+ type: object
515
+ properties:
516
+ mcp_server:
517
+ type: string
518
+ enum: [healthy, unhealthy]
519
+ backend_api:
520
+ type: string
521
+ enum: [healthy, unhealthy]
522
+ database:
523
+ type: string
524
+ enum: [healthy, unhealthy]
525
+ redis:
526
+ type: string
527
+ enum: [healthy, unhealthy]
528
+ capabilities:
529
+ type: object
530
+ properties:
531
+ ai_agent_interface:
532
+ type: boolean
533
+ live_trading:
534
+ type: boolean
535
+ multi_strategy_support:
536
+ type: boolean
537
+ real_time_data:
538
+ type: boolean
539
+ timestamp:
540
+ type: string
541
+ format: date-time
542
+
543
+ ContextResponse:
544
+ type: object
545
+ required:
546
+ - name
547
+ - version
548
+ - description
549
+ - endpoints
550
+ - strategies_supported
551
+ - exchange_profiles
552
+ properties:
553
+ name:
554
+ type: string
555
+ example: "autonoma Trading System"
556
+ version:
557
+ type: string
558
+ example: "1.0.0"
559
+ description:
560
+ type: string
561
+ example: "AI-powered trading system with MCP integration"
562
+ endpoints:
563
+ type: array
564
+ items:
565
+ type: string
566
+ example: ["/health", "/context", "/controllers"]
567
+ strategies_supported:
568
+ type: array
569
+ items:
570
+ $ref: '#/components/schemas/StrategyInfo'
571
+ exchange_profiles:
572
+ type: array
573
+ items:
574
+ $ref: '#/components/schemas/ExchangeProfile'
575
+ features:
576
+ type: array
577
+ items:
578
+ type: string
579
+
580
+ # =============================================================================
581
+ # Controller Schemas (Normalized)
582
+ # =============================================================================
583
+
584
+ Controller:
585
+ type: object
586
+ required:
587
+ - id
588
+ - name
589
+ - strategy
590
+ - trading_pair
591
+ - status
592
+ - created_at
593
+ - updated_at
594
+ properties:
595
+ id:
596
+ type: string
597
+ description: Unique controller identifier
598
+ example: "ctrl_abc123"
599
+ name:
600
+ type: string
601
+ description: Human-readable controller name
602
+ example: "BTC Market Maker"
603
+ strategy:
604
+ type: string
605
+ description: Trading strategy type
606
+ enum: [pure_market_making, avellaneda_market_making, twap, grid_trading, arbitrage]
607
+ example: "pure_market_making"
608
+ trading_pair:
609
+ type: string
610
+ description: Trading pair symbol
611
+ example: "BTC-PERP"
612
+ status:
613
+ type: string
614
+ description: Current controller status
615
+ enum: [active, inactive, error, starting, stopping]
616
+ example: "active"
617
+ config:
618
+ type: object
619
+ description: Controller configuration parameters
620
+ additionalProperties: true
621
+ example:
622
+ exchange: "hyperliquid"
623
+ order_amount: 0.001
624
+ bid_spread: 0.001
625
+ ask_spread: 0.001
626
+ metadata:
627
+ type: object
628
+ description: Controller metadata (standardized propagation)
629
+ properties:
630
+ pool_id:
631
+ type: string
632
+ example: "pool_xyz789"
633
+ created_by:
634
+ type: string
635
+ example: "user_123"
636
+ tags:
637
+ type: array
638
+ items:
639
+ type: string
640
+ example: ["automated", "high-frequency"]
641
+ created_at:
642
+ type: string
643
+ format: date-time
644
+ example: "2024-12-01T10:00:00Z"
645
+ updated_at:
646
+ type: string
647
+ format: date-time
648
+ example: "2024-12-01T12:00:00Z"
649
+
650
+ CreateControllerRequest:
651
+ type: object
652
+ required:
653
+ - name
654
+ - strategy
655
+ - trading_pair
656
+ - config
657
+ properties:
658
+ name:
659
+ type: string
660
+ description: Human-readable controller name
661
+ example: "BTC Market Maker"
662
+ strategy:
663
+ type: string
664
+ description: Trading strategy type
665
+ enum: [pure_market_making, avellaneda_market_making, twap, grid_trading, arbitrage]
666
+ example: "pure_market_making"
667
+ trading_pair:
668
+ type: string
669
+ description: Trading pair symbol
670
+ example: "BTC-PERP"
671
+ config:
672
+ type: object
673
+ description: Strategy configuration parameters
674
+ additionalProperties: true
675
+ example:
676
+ exchange: "hyperliquid"
677
+ order_amount: 0.001
678
+ bid_spread: 0.001
679
+ ask_spread: 0.001
680
+ order_refresh_time: 10
681
+ metadata:
682
+ type: object
683
+ description: Optional controller metadata
684
+ additionalProperties: true
685
+
686
+ UpdateControllerRequest:
687
+ type: object
688
+ properties:
689
+ name:
690
+ type: string
691
+ description: Updated controller name
692
+ config:
693
+ type: object
694
+ description: Updated configuration parameters
695
+ additionalProperties: true
696
+ metadata:
697
+ type: object
698
+ description: Updated metadata
699
+ additionalProperties: true
700
+
701
+ ControllerMetrics:
702
+ type: object
703
+ required:
704
+ - controller_id
705
+ - performance
706
+ - status
707
+ - trading_stats
708
+ - timestamp
709
+ properties:
710
+ controller_id:
711
+ type: string
712
+ example: "ctrl_abc123"
713
+ performance:
714
+ type: object
715
+ properties:
716
+ total_pnl:
717
+ type: number
718
+ example: 150.75
719
+ unrealized_pnl:
720
+ type: number
721
+ example: 25.50
722
+ realized_pnl:
723
+ type: number
724
+ example: 125.25
725
+ win_rate:
726
+ type: number
727
+ minimum: 0
728
+ maximum: 100
729
+ example: 65.5
730
+ total_trades:
731
+ type: integer
732
+ minimum: 0
733
+ example: 247
734
+ sharpe_ratio:
735
+ type: number
736
+ example: 1.85
737
+ status:
738
+ type: object
739
+ properties:
740
+ is_running:
741
+ type: boolean
742
+ example: true
743
+ last_update:
744
+ type: string
745
+ format: date-time
746
+ example: "2024-12-01T12:00:00Z"
747
+ health_score:
748
+ type: number
749
+ minimum: 0
750
+ maximum: 100
751
+ example: 95.2
752
+ trading_stats:
753
+ type: object
754
+ properties:
755
+ volume_24h:
756
+ type: number
757
+ example: 1250.75
758
+ fees_paid:
759
+ type: number
760
+ example: 12.50
761
+ active_orders:
762
+ type: integer
763
+ minimum: 0
764
+ example: 4
765
+ orders_filled:
766
+ type: integer
767
+ minimum: 0
768
+ example: 89
769
+ timestamp:
770
+ type: string
771
+ format: date-time
772
+ example: "2024-12-01T12:00:00Z"
773
+
774
+ # =============================================================================
775
+ # Trading Schemas (Unified)
776
+ # =============================================================================
777
+
778
+ TradingSignal:
779
+ type: object
780
+ required:
781
+ - type
782
+ - side
783
+ - amount
784
+ - order_type
785
+ properties:
786
+ type:
787
+ type: string
788
+ description: Signal type
789
+ enum: [place_order, cancel_order, modify_order, close_position]
790
+ example: "place_order"
791
+ side:
792
+ type: string
793
+ description: Order side
794
+ enum: [buy, sell]
795
+ example: "buy"
796
+ amount:
797
+ type: number
798
+ description: Order amount/quantity
799
+ minimum: 0
800
+ exclusiveMinimum: true
801
+ example: 0.001
802
+ price:
803
+ type: number
804
+ description: Order price (required for limit orders)
805
+ minimum: 0
806
+ exclusiveMinimum: true
807
+ example: 49900.0
808
+ order_type:
809
+ type: string
810
+ description: Order type
811
+ enum: [market, limit, stop_loss, take_profit]
812
+ example: "limit"
813
+ time_in_force:
814
+ type: string
815
+ description: Order time in force
816
+ enum: [GTC, IOC, FOK]
817
+ default: "GTC"
818
+ example: "GTC"
819
+ metadata:
820
+ type: object
821
+ description: Additional signal metadata
822
+ additionalProperties: true
823
+
824
+ ExecuteSignalRequest:
825
+ type: object
826
+ required:
827
+ - controller_id
828
+ - signal
829
+ properties:
830
+ controller_id:
831
+ type: string
832
+ description: Target controller identifier
833
+ example: "ctrl_abc123"
834
+ signal:
835
+ $ref: '#/components/schemas/TradingSignal'
836
+ execution_options:
837
+ type: object
838
+ description: Signal execution options
839
+ properties:
840
+ dry_run:
841
+ type: boolean
842
+ default: false
843
+ description: Execute as simulation only
844
+ timeout_seconds:
845
+ type: integer
846
+ minimum: 1
847
+ maximum: 300
848
+ default: 30
849
+ description: Execution timeout
850
+
851
+ SignalExecutionResponse:
852
+ allOf:
853
+ - $ref: '#/components/schemas/SuccessResponse'
854
+ - type: object
855
+ properties:
856
+ data:
857
+ type: object
858
+ required:
859
+ - controller_id
860
+ - signal_id
861
+ - execution_time_ms
862
+ properties:
863
+ controller_id:
864
+ type: string
865
+ example: "ctrl_abc123"
866
+ signal_id:
867
+ type: string
868
+ description: Unique signal execution identifier
869
+ example: "sig_xyz789"
870
+ order_id:
871
+ type: string
872
+ description: Exchange order identifier (if applicable)
873
+ example: "ord_exchange_123"
874
+ execution_time_ms:
875
+ type: integer
876
+ description: Signal execution time in milliseconds
877
+ example: 150
878
+ execution_price:
879
+ type: number
880
+ description: Actual execution price
881
+ example: 49905.0
882
+ filled_amount:
883
+ type: number
884
+ description: Amount filled
885
+ example: 0.001
886
+ fees:
887
+ type: number
888
+ description: Trading fees incurred
889
+ example: 0.025
890
+
891
+ ExchangeListResponse:
892
+ allOf:
893
+ - $ref: '#/components/schemas/SuccessResponse'
894
+ - type: object
895
+ properties:
896
+ data:
897
+ type: object
898
+ properties:
899
+ exchanges:
900
+ type: array
901
+ items:
902
+ $ref: '#/components/schemas/ExchangeProfile'
903
+ count:
904
+ type: integer
905
+ example: 3
906
+
907
+ ConnectExchangeRequest:
908
+ type: object
909
+ required:
910
+ - exchange
911
+ - trading_pair
912
+ - credentials
913
+ properties:
914
+ exchange:
915
+ type: string
916
+ description: Exchange name
917
+ enum: [hyperliquid, binance, bybit]
918
+ example: "hyperliquid"
919
+ trading_pair:
920
+ type: string
921
+ description: Trading pair to connect
922
+ example: "BTC-PERP"
923
+ credentials:
924
+ type: object
925
+ description: Exchange-specific credentials
926
+ oneOf:
927
+ - title: "Hyperliquid Credentials"
928
+ properties:
929
+ wallet_address:
930
+ type: string
931
+ example: "0x1234567890abcdef"
932
+ private_key:
933
+ type: string
934
+ format: password
935
+ example: "0xabcdef1234567890"
936
+ - title: "CEX Credentials"
937
+ properties:
938
+ api_key:
939
+ type: string
940
+ example: "api_key_123"
941
+ api_secret:
942
+ type: string
943
+ format: password
944
+ example: "api_secret_456"
945
+ passphrase:
946
+ type: string
947
+ format: password
948
+ example: "passphrase_789"
949
+
950
+ TradingConnectionResponse:
951
+ allOf:
952
+ - $ref: '#/components/schemas/SuccessResponse'
953
+ - type: object
954
+ properties:
955
+ data:
956
+ type: object
957
+ required:
958
+ - controller_id
959
+ - exchange
960
+ - trading_pair
961
+ - status
962
+ - connected_at
963
+ properties:
964
+ controller_id:
965
+ type: string
966
+ example: "ctrl_abc123"
967
+ exchange:
968
+ type: string
969
+ example: "hyperliquid"
970
+ trading_pair:
971
+ type: string
972
+ example: "BTC-PERP"
973
+ status:
974
+ type: string
975
+ enum: [connected, disconnected, error]
976
+ example: "connected"
977
+ connected_at:
978
+ type: string
979
+ format: date-time
980
+ example: "2024-12-01T12:00:00Z"
981
+ account_info:
982
+ type: object
983
+ properties:
984
+ balance:
985
+ type: number
986
+ example: 1000.0
987
+ margin_level:
988
+ type: number
989
+ example: 0.85
990
+
991
+ MarketData:
992
+ type: object
993
+ required:
994
+ - symbol
995
+ - price
996
+ - timestamp
997
+ properties:
998
+ symbol:
999
+ type: string
1000
+ example: "BTC-PERP"
1001
+ price:
1002
+ type: number
1003
+ example: 49950.0
1004
+ bid:
1005
+ type: number
1006
+ example: 49945.0
1007
+ ask:
1008
+ type: number
1009
+ example: 49955.0
1010
+ volume_24h:
1011
+ type: number
1012
+ example: 1500000.0
1013
+ change_24h:
1014
+ type: number
1015
+ example: 2.5
1016
+ high_24h:
1017
+ type: number
1018
+ example: 50200.0
1019
+ low_24h:
1020
+ type: number
1021
+ example: 49500.0
1022
+ timestamp:
1023
+ type: string
1024
+ format: date-time
1025
+ example: "2024-12-01T12:00:00Z"
1026
+ exchange:
1027
+ type: string
1028
+ example: "hyperliquid"
1029
+
1030
+ AccountBalance:
1031
+ type: object
1032
+ required:
1033
+ - balances
1034
+ - timestamp
1035
+ properties:
1036
+ balances:
1037
+ type: object
1038
+ additionalProperties:
1039
+ type: object
1040
+ properties:
1041
+ available:
1042
+ type: number
1043
+ example: 1000.0
1044
+ locked:
1045
+ type: number
1046
+ example: 50.0
1047
+ total:
1048
+ type: number
1049
+ example: 1050.0
1050
+ example:
1051
+ USDC:
1052
+ available: 1000.0
1053
+ locked: 50.0
1054
+ total: 1050.0
1055
+ BTC:
1056
+ available: 0.02
1057
+ locked: 0.001
1058
+ total: 0.021
1059
+ margin_info:
1060
+ type: object
1061
+ properties:
1062
+ margin_level:
1063
+ type: number
1064
+ example: 0.85
1065
+ maintenance_margin:
1066
+ type: number
1067
+ example: 100.0
1068
+ initial_margin:
1069
+ type: number
1070
+ example: 200.0
1071
+ timestamp:
1072
+ type: string
1073
+ format: date-time
1074
+ example: "2024-12-01T12:00:00Z"
1075
+
1076
+ # =============================================================================
1077
+ # Supporting Schemas
1078
+ # =============================================================================
1079
+
1080
+ StrategyInfo:
1081
+ type: object
1082
+ required:
1083
+ - name
1084
+ - description
1085
+ - parameters
1086
+ - supported_exchanges
1087
+ properties:
1088
+ name:
1089
+ type: string
1090
+ example: "pure_market_making"
1091
+ description:
1092
+ type: string
1093
+ example: "Basic market making strategy with configurable spreads"
1094
+ parameters:
1095
+ type: object
1096
+ additionalProperties:
1097
+ type: string
1098
+ example:
1099
+ bid_spread: "Bid spread percentage"
1100
+ ask_spread: "Ask spread percentage"
1101
+ order_amount: "Order size"
1102
+ supported_exchanges:
1103
+ type: array
1104
+ items:
1105
+ type: string
1106
+ example: ["hyperliquid", "binance"]
1107
+ risk_management:
1108
+ type: object
1109
+ additionalProperties:
1110
+ type: string
1111
+
1112
+ ExchangeProfile:
1113
+ type: object
1114
+ required:
1115
+ - name
1116
+ - type
1117
+ - supported_pairs
1118
+ - features
1119
+ properties:
1120
+ name:
1121
+ type: string
1122
+ example: "hyperliquid"
1123
+ type:
1124
+ type: string
1125
+ enum: [dex, cex]
1126
+ example: "dex"
1127
+ mode:
1128
+ type: string
1129
+ enum: [spot, perpetual, both]
1130
+ example: "both"
1131
+ supported_pairs:
1132
+ type: array
1133
+ items:
1134
+ type: string
1135
+ example: ["BTC-PERP", "ETH-PERP", "SOL-PERP"]
1136
+ features:
1137
+ type: array
1138
+ items:
1139
+ type: string
1140
+ example: ["low_fees", "fast_execution", "vault_integration"]
1141
+ trading_fees:
1142
+ type: object
1143
+ properties:
1144
+ maker:
1145
+ type: number
1146
+ example: 0.0002
1147
+ taker:
1148
+ type: number
1149
+ example: 0.0005
1150
+ api_rate_limits:
1151
+ type: object
1152
+ additionalProperties:
1153
+ type: number
1154
+ example:
1155
+ requests_per_second: 10
1156
+ orders_per_minute: 60
1157
+
1158
+ # =============================================================================
1159
+ # MCP Tools Schemas (Standardized Interface)
1160
+ # =============================================================================
1161
+
1162
+ MCPRequest:
1163
+ type: object
1164
+ required:
1165
+ - jsonrpc
1166
+ - id
1167
+ - method
1168
+ properties:
1169
+ jsonrpc:
1170
+ type: string
1171
+ enum: ["2.0"]
1172
+ example: "2.0"
1173
+ id:
1174
+ oneOf:
1175
+ - type: string
1176
+ - type: integer
1177
+ example: 1
1178
+ method:
1179
+ type: string
1180
+ enum: ["tools/list", "tools/call", "ping"]
1181
+ example: "tools/list"
1182
+ params:
1183
+ type: object
1184
+ properties:
1185
+ name:
1186
+ type: string
1187
+ description: Tool name for tools/call method
1188
+ example: "get_trending_tokens"
1189
+ arguments:
1190
+ type: object
1191
+ description: Tool arguments for tools/call method
1192
+ additionalProperties: true
1193
+ example:
1194
+ token: "BTC"
1195
+ chain: "hyperliquid"
1196
+
1197
+ MCPResponse:
1198
+ type: object
1199
+ required:
1200
+ - jsonrpc
1201
+ - id
1202
+ properties:
1203
+ jsonrpc:
1204
+ type: string
1205
+ enum: ["2.0"]
1206
+ example: "2.0"
1207
+ id:
1208
+ oneOf:
1209
+ - type: string
1210
+ - type: integer
1211
+ example: 1
1212
+ result:
1213
+ oneOf:
1214
+ - $ref: '#/components/schemas/MCPToolsListResult'
1215
+ - $ref: '#/components/schemas/MCPToolCallResult'
1216
+ - $ref: '#/components/schemas/MCPPingResult'
1217
+ error:
1218
+ $ref: '#/components/schemas/MCPError'
1219
+
1220
+ MCPErrorResponse:
1221
+ type: object
1222
+ required:
1223
+ - jsonrpc
1224
+ - id
1225
+ - error
1226
+ properties:
1227
+ jsonrpc:
1228
+ type: string
1229
+ enum: ["2.0"]
1230
+ example: "2.0"
1231
+ id:
1232
+ oneOf:
1233
+ - type: string
1234
+ - type: integer
1235
+ example: 1
1236
+ error:
1237
+ $ref: '#/components/schemas/MCPError'
1238
+
1239
+ MCPError:
1240
+ type: object
1241
+ required:
1242
+ - code
1243
+ - message
1244
+ properties:
1245
+ code:
1246
+ type: integer
1247
+ example: -32601
1248
+ message:
1249
+ type: string
1250
+ example: "Method not found"
1251
+ data:
1252
+ type: string
1253
+ description: Additional error details
1254
+ example: "Tool 'invalid_tool' not found"
1255
+
1256
+ MCPToolsListResult:
1257
+ type: object
1258
+ required:
1259
+ - tools
1260
+ properties:
1261
+ tools:
1262
+ type: array
1263
+ items:
1264
+ $ref: '#/components/schemas/MCPTool'
1265
+
1266
+ MCPTool:
1267
+ type: object
1268
+ required:
1269
+ - name
1270
+ - title
1271
+ - description
1272
+ properties:
1273
+ name:
1274
+ type: string
1275
+ example: "get_trending_tokens"
1276
+ title:
1277
+ type: string
1278
+ example: "Get Trending Solana Tokens"
1279
+ description:
1280
+ type: string
1281
+ example: "Fetch trending Solana tokens with quality filtering"
1282
+ inputSchema:
1283
+ type: object
1284
+ properties:
1285
+ type:
1286
+ type: string
1287
+ example: "object"
1288
+ properties:
1289
+ type: object
1290
+ additionalProperties: true
1291
+ required:
1292
+ type: array
1293
+ items:
1294
+ type: string
1295
+
1296
+ MCPToolCallResult:
1297
+ type: object
1298
+ required:
1299
+ - content
1300
+ properties:
1301
+ content:
1302
+ type: array
1303
+ items:
1304
+ $ref: '#/components/schemas/MCPContent'
1305
+ meta:
1306
+ type: object
1307
+ additionalProperties: true
1308
+ description: Additional metadata
1309
+ isError:
1310
+ type: boolean
1311
+ example: false
1312
+
1313
+ MCPContent:
1314
+ type: object
1315
+ required:
1316
+ - type
1317
+ - text
1318
+ properties:
1319
+ type:
1320
+ type: string
1321
+ enum: ["text"]
1322
+ example: "text"
1323
+ text:
1324
+ type: string
1325
+ example: "💰 **BTC Price Data**\n\nPrice: $45,000\nChain: hyperliquid"
1326
+
1327
+ MCPPingResult:
1328
+ type: object
1329
+ required:
1330
+ - status
1331
+ properties:
1332
+ status:
1333
+ type: string
1334
+ enum: ["pong"]
1335
+ example: "pong"
1336
+ service:
1337
+ type: string
1338
+ example: "market-data-mcp-server"
1339
+
1340
+ # =============================================================================
1341
+ # MCP Tools Endpoints (Standardized Interface)
1342
+ # =============================================================================
1343
+
1344
+ /mcp:
1345
+ post:
1346
+ summary: MCP Tools Interface
1347
+ description: |
1348
+ Standardized Model Context Protocol endpoint for executing tools.
1349
+ Supports both DexScreener and Data Collector MCP tools.
1350
+ tags: [MCP Tools]
1351
+ requestBody:
1352
+ required: true
1353
+ content:
1354
+ application/json:
1355
+ schema:
1356
+ $ref: '#/components/schemas/MCPRequest'
1357
+ examples:
1358
+ list_tools:
1359
+ summary: List available tools
1360
+ value:
1361
+ jsonrpc: "2.0"
1362
+ id: 1
1363
+ method: "tools/list"
1364
+ call_tool:
1365
+ summary: Call a specific tool
1366
+ value:
1367
+ jsonrpc: "2.0"
1368
+ id: 2
1369
+ method: "tools/call"
1370
+ params:
1371
+ name: "get_trending_tokens"
1372
+ arguments: {}
1373
+ ping:
1374
+ summary: Ping the server
1375
+ value:
1376
+ jsonrpc: "2.0"
1377
+ id: 3
1378
+ method: "ping"
1379
+ responses:
1380
+ '200':
1381
+ description: MCP response
1382
+ content:
1383
+ application/json:
1384
+ schema:
1385
+ $ref: '#/components/schemas/MCPResponse'
1386
+ examples:
1387
+ tools_list:
1388
+ summary: Tools list response
1389
+ value:
1390
+ jsonrpc: "2.0"
1391
+ id: 1
1392
+ result:
1393
+ tools:
1394
+ - name: "get_trending_tokens"
1395
+ title: "Get Trending Solana Tokens"
1396
+ description: "Fetch trending Solana tokens with quality filtering"
1397
+ - name: "get_token_price"
1398
+ title: "Get Latest Token Price"
1399
+ description: "Get latest price for any token on supported chains"
1400
+ tool_result:
1401
+ summary: Tool execution result
1402
+ value:
1403
+ jsonrpc: "2.0"
1404
+ id: 2
1405
+ result:
1406
+ content:
1407
+ - type: "text"
1408
+ text: "💰 **BTC Price Data**\n\nPrice: $45,000\nChain: hyperliquid"
1409
+ meta:
1410
+ raw_data: {}
1411
+ ping_response:
1412
+ summary: Ping response
1413
+ value:
1414
+ jsonrpc: "2.0"
1415
+ id: 3
1416
+ result:
1417
+ status: "pong"
1418
+ service: "market-data-mcp-server"
1419
+ '400':
1420
+ description: Invalid request
1421
+ content:
1422
+ application/json:
1423
+ schema:
1424
+ $ref: '#/components/schemas/MCPErrorResponse'
1425
+
1426
+ tags:
1427
+ - name: System
1428
+ description: System health and context endpoints
1429
+ - name: Controllers
1430
+ description: Trading controller management
1431
+ - name: Trading
1432
+ description: Trading operations and market data
1433
+ - name: MCP Tools
1434
+ description: Model Context Protocol standardized tools interface