Repository navigation
Expand file tree
/
Copy pathopenapi.yaml
More file actions
4129 lines (4020 loc) · 122 KB
/
Copy pathopenapi.yaml
File metadata and controls
4129 lines (4020 loc) · 122 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
title: Lens API
description: >-
Unified Stellar price API aggregating SDEX + AMM prices.
Every route is served under the `/v1` version segment; the versioned path is
the canonical one documented here. The same routes also answer at their
unversioned paths as deprecated aliases so pre-`/v1` integrations keep
working — those responses carry `Deprecation` and `Link` headers pointing at
the successor. See `docs/api-versioning.md` for the retirement policy.
Cache policy: every route sends a deliberate `Cache-Control` response
header. Live prices (`/price/*`) are `public, max-age=30`; aggregates
(`/price/*/history`, `/price/twap/*`, `/price/vwap/*`, `/prices/history`,
`/compare/*`, `/spreads/*`) are `public, max-age=60`; slower-moving views
(`/volumes/*`, `/screener`, `/basket`) are `public, max-age=120`;
reference data that changes rarely (`/pairs`, `/pools`, `/benchmark/*`)
is `public, max-age=300`; the discovery document is
`public, max-age=3600`. `/candles` for a closed historical window (its
`to` at least one full interval in the past) is *probably* immutable —
backfill can rewrite history — so it is
`public, max-age=3600, stale-while-revalidate=86400`; the still-forming
window is `public, max-age=60`. Every `public` response also sends
`Vary: x-network`, because the Stellar network can come from the
`x-network` header (not part of the URL cache key). Routes behind the
x402 payment gate use `private` instead of `public` when x402 is
configured, so a shared cache never serves paid content for free.
Per-caller responses (`/usage/me`), operator routes
(`/admin/*`), mutations and error responses are `no-store` and must never
sit in a shared cache.
Data Quality Guarantees: see `docs/data-quality.md` for explicit SLAs
and guarantees on freshness (e.g. 300s staleness bound), completeness,
precision (PostgreSQL Decimal(36,18) and negotiated string serialization),
and multi-venue coverage across SDEX, Stellar AMM, Soroswap, and Aquarius.
version: 0.1.0
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: http://localhost:4000
description: Local development server
paths:
/v1/venues/registry:
get:
operationId: getVenueRegistry
summary: List registered venues and their network liveness
description: Returns each registered venue adapter for the selected network. Liveness is based on recent price writes where available; on-demand adapters without persisted price points report unknown.
security: []
parameters:
- $ref: '#/components/parameters/NetworkQuery'
responses:
'200':
description: Registered venues and their current liveness
content:
application/json:
schema:
type: object
required: [network, venues]
properties:
network:
type: string
enum: [testnet, mainnet]
venues:
type: array
items:
type: object
required: [id, kind, network, enabled, liveness, lastSeenAt]
properties:
id:
type: string
kind:
type: string
enum: [orderbook, amm, oracle]
network:
type: string
enum: [testnet, mainnet]
enabled:
type: boolean
liveness:
type: string
enum: [live, stale, disabled, unknown]
lastSeenAt:
type: string
format: date-time
nullable: true
/v1/venues:
get:
operationId: getVenueVolumeShare
summary: Venue Share of Volume
description: >-
Per-venue traded volume, market share (percentage of total), and
period-over-period percentage change comparing the requested window
against the immediately preceding window of identical duration.
Market shares sum to 100% within floating-point tolerance. Stale or
excluded venues are explicitly listed in `excludedVenues`.
All queries are filtered by `network` via the `x-network` header —
testnet and mainnet data are never merged into a single series.
security: []
parameters:
- $ref: '#/components/parameters/NetworkQuery'
- name: window
in: query
description: Time window for the aggregation
required: false
schema:
type: string
enum: [24h, 7d, 30d]
default: '24h'
responses:
'200':
description: Venue volume share and market share data
content:
application/json:
schema:
$ref: '#/components/schemas/VenuesResponse'
'400':
description: Invalid window parameter
content:
application/json:
schema:
type: object
required: [error]
properties:
error:
type: string
/v1/live:
get:
operationId: getLive
summary: Liveness probe
description: >-
Reports whether this process is wedged and needs to be restarted. It
checks no dependencies by design: a process that cannot reach Postgres
is still healthy and should keep running, so failing liveness during a
database outage would restart every instance at once. Use `/ready` to
decide whether to send traffic.
security: []
responses:
'200':
description: Process is alive.
/v1/tvl:
get:
operationId: getTvl
summary: Total Value Locked across Stellar DeFi venues
description: >-
Aggregates Total Value Locked (TVL) in USD across Stellar Classic AMM,
Soroswap, and Aquarius. Reports totals, breakdown by venue, breakdown
by asset with valuation sources named, and marks pools with unpriceable
assets as unpriced rather than zero. Querying `?history=true` returns
historical hourly TVL samples.
security: []
parameters:
- $ref: '#/components/parameters/NetworkQuery'
- name: history
in: query
required: false
description: Return historical time series of TVL when true
schema:
type: boolean
default: false
- name: window
in: query
required: false
description: Historical lookback window in hours (default 24)
schema:
type: string
default: 24
responses:
'200':
description: Total Value Locked breakdown or historical series
headers:
Cache-Control:
$ref: '#/components/headers/CacheControl'
content:
application/json:
schema:
type: object
required: [ok, uptimeSeconds]
properties:
ok:
type: boolean
example: true
uptimeSeconds:
type: integer
description: Seconds since the process started.
example: 3600
/v1/ready:
get:
operationId: getReady
summary: Readiness probe
description: >-
Reports whether this process should receive traffic yet. Unhealthy
until the boot sequence finishes — the server starts listening before
the ingesters and background workers are running — and while Postgres
is unreachable or unmigrated, or Redis is unreachable when Redis is
part of readiness (`READINESS_REDIS_CHECK`, default true).
A probe timeout is reported as `down`, and answers are cached briefly,
so this is cheap to poll every few seconds. `/live` stays healthy
throughout: a starting instance should be held out of rotation, not
killed.
security: []
responses:
'200':
description: Ready to receive traffic.
headers:
Cache-Control:
$ref: '#/components/headers/CacheControl'
content:
application/json:
schema:
$ref: '#/components/schemas/ReadinessReport'
'503':
description: >-
Not ready. `ok` is false and `checks` says which dependency (or the
boot sequence) is responsible. `/live` remains healthy.
content:
application/json:
schema:
$ref: '#/components/schemas/ReadinessReport'
properties:
network:
type: string
enum: [testnet, mainnet]
totalTvlUsd:
type: number
unpricedPoolsCount:
type: integer
pricedPoolsCount:
type: integer
venues:
type: object
byAsset:
type: object
pools:
type: array
items:
type: object
computedAt:
type: string
format: date-time
'400':
description: Invalid parameters
/v1/status:
get:
operationId: getStatus
summary: Get API status and indexer state
security: []
parameters:
- $ref: '#/components/parameters/NetworkQuery'
responses:
'200':
description: API status and health diagnostics
headers:
Cache-Control:
$ref: '#/components/headers/CacheControl'
content:
application/json:
schema:
type: object
properties:
ok:
type: boolean
status:
type: string
enum: [healthy, degraded, unhealthy]
network:
type: string
enum: [testnet, mainnet]
health:
type: object
properties:
process:
type: string
data:
type: string
process:
type: object
properties:
uptimeSeconds:
type: number
memoryUsageMb:
type: number
status:
type: string
data:
type: object
properties:
lastIndexedLedger:
type: integer
nullable: true
lastProcessedAt:
type: string
format: date-time
nullable: true
ingestLagSeconds:
type: integer
nullable: true
isStale:
type: boolean
watchedPairs:
type: array
items:
type: string
lastIndexedLedger:
type: integer
nullable: true
lastProcessedAt:
type: string
format: date-time
nullable: true
ingestLagSeconds:
type: integer
nullable: true
adminConfigured:
type: boolean
description: >-
Whether this deployment has an ADMIN_TOKEN configured, so
an operator can tell a rejected token from a disabled
admin surface. Reports only that a token is set, never any
part of its value. Admin routes answer 503
admin_not_configured when this is false.
'503':
description: Service unhealthy or database unreachable
content:
application/json:
schema:
type: object
properties:
ok:
type: boolean
status:
type: string
error:
type: string
description: >-
A fixed phrase, never the database driver's message. This
route is public and unauthenticated, and a connection
failure carries the host, the user and sometimes the whole
connection string; the detail is logged server-side
instead.
example: Database unavailable
pagingCondition:
type: string
example: DATABASE_DOWN
'429':
$ref: '#/components/responses/TooManyRequests'
/v1/snapshot:
get:
operationId: getSnapshot
summary: Whole-network snapshot (venues, TVL, 24h volume, top pairs, pegs, freshness)
description: >-
A single timestamped summary of one network: every venue's liveness,
AMM pool reserves (TVL), 24h traded volume, the busiest pairs, stablecoin
peg readings and how fresh the underlying data is. All figures are read
in one consistent database statement, so `asOf` is a real instant and
every age is measured from it. Missing data is reported as `null` with a
reason (or an empty list), never invented — a cross-pair volume total is
only returned when the pairs share one unit. Responses are cached briefly
per network; `cache.ageSeconds` states the age of a served copy.
security: []
parameters:
- $ref: '#/components/parameters/NetworkQuery'
responses:
'200':
description: Network snapshot
headers:
Cache-Control:
schema:
type: string
description: Freshness/brief-caching policy for the snapshot.
X-Cache:
schema:
type: string
enum: [HIT, MISS]
description: Whether this response came from the short-lived cache.
content:
application/json:
schema:
$ref: '#/components/schemas/SnapshotResponse'
'429':
$ref: '#/components/responses/TooManyRequests'
'500':
description: Snapshot aggregation failed
content:
application/json:
schema:
$ref: '#/components/schemas/InternalErrorResponse'
/v1/price/{assetA}/{assetB}:
get:
operationId: getPrice
summary: Get aggregated price for a pair
security:
- x402: []
parameters:
- name: assetA
in: path
required: true
schema:
type: string
example: XLM
- name: assetB
in: path
required: true
schema:
type: string
example: USDC
- $ref: '#/components/parameters/NetworkQuery'
- $ref: '#/components/parameters/DecimalFormatHeader'
responses:
'200':
description: Aggregated price data
headers:
Cache-Control:
$ref: '#/components/headers/CacheControl'
content:
application/json:
schema:
$ref: '#/components/schemas/AggregatedPrice'
'402':
$ref: '#/components/responses/PaymentRequired'
'404':
description: Pair not watched
'429':
$ref: '#/components/responses/TooManyRequests'
/v1/price/{assetA}/{assetB}/route:
get:
operationId: getBestRoute
summary: Get best swap route for a pair and amount
security:
- x402: []
parameters:
- name: assetA
in: path
required: true
schema:
type: string
example: XLM
- name: assetB
in: path
required: true
schema:
type: string
example: USDC
- name: amount
in: query
required: false
schema:
type: number
default: 1000
- $ref: '#/components/parameters/NetworkQuery'
- $ref: '#/components/parameters/DecimalFormatHeader'
responses:
'200':
description: Best route information
headers:
Cache-Control:
$ref: '#/components/headers/CacheControl'
content:
application/json:
schema:
$ref: '#/components/schemas/RouteInfo'
'402':
$ref: '#/components/responses/PaymentRequired'
'429':
$ref: '#/components/responses/TooManyRequests'
/v1/price/{asset}/fiat:
get:
operationId: getFiatPrice
summary: Convert asset price to fiat currency with NGN support (#290)
security: []
parameters:
- name: asset
in: path
required: true
schema:
type: string
example: XLM
- name: currency
in: query
required: false
schema:
type: string
default: USD
- $ref: '#/components/parameters/NetworkQuery'
responses:
'200':
description: Price converted into target fiat currency
content:
application/json:
schema:
type: object
'400':
description: Invalid parameters
'429':
$ref: '#/components/responses/TooManyRequests'
/v1/price/{assetA}/{assetB}/history:
get:
operationId: getPriceHistory
summary: Get price history buckets
description: >-
Returns price aggregate buckets (1m, 5m, 1h, 24h). Prices are serialized up to 18
decimal places and volumes up to 7 decimal places matching Stellar stroop precision.
security: []
parameters:
- name: assetA
in: path
required: true
schema:
type: string
example: XLM
- name: assetB
in: path
required: true
schema:
type: string
example: USDC
- name: window
in: query
required: false
schema:
type: string
enum: [1m, 5m, 1h, 24h]
default: 1h
- name: limit
in: query
required: false
schema:
type: integer
default: 100
maximum: 1000
- $ref: '#/components/parameters/NetworkQuery'
- $ref: '#/components/parameters/DecimalFormatHeader'
responses:
'200':
description: Price history
headers:
Cache-Control:
$ref: '#/components/headers/CacheControl'
content:
application/json:
schema:
type: object
properties:
pairKey:
type: string
network:
type: string
enum: [testnet, mainnet]
window:
type: string
buckets:
type: array
items:
$ref: '#/components/schemas/PriceBucket'
'400':
description: Invalid parameters
'429':
$ref: '#/components/responses/TooManyRequests'
/v1/pools:
get:
operationId: getPools
summary: Get AMM liquidity pool reserves and spot prices
description: >-
Latest snapshot per pool for one network. Paginated with the shared
keyset convention: ordered by pool_id ascending, default limit 50,
maximum 200.
security:
- x402: []
parameters:
- $ref: '#/components/parameters/NetworkQuery'
- $ref: '#/components/parameters/CursorQuery'
- name: limit
in: query
required: false
description: Page size. Out-of-range values are clamped into [1, 200].
schema:
type: integer
minimum: 1
maximum: 200
default: 50
responses:
'200':
description: List of pools
headers:
Cache-Control:
$ref: '#/components/headers/CacheControl'
content:
application/json:
schema:
type: object
required: [pools, nextCursor, hasMore]
properties:
pools:
type: array
items:
type: object
properties:
pool_id:
type: string
asset_a:
type: string
asset_b:
type: string
reserve_a:
oneOf:
- type: number
- type: string
reserve_b:
oneOf:
- type: number
- type: string
spot_price:
oneOf:
- type: number
- type: string
fee_bp:
type: integer
timestamp:
type: string
format: date-time
nextCursor:
type: string
nullable: true
hasMore:
type: boolean
'400':
description: Invalid limit or cursor
'402':
$ref: '#/components/responses/PaymentRequired'
'429':
$ref: '#/components/responses/TooManyRequests'
/v1/candles/{assetA}/{assetB}:
get:
operationId: getCandles
summary: Get OHLCV candle data
description: >-
OHLCV candles for a pair. Buckets are aggregated with exact numeric
arithmetic in the database, so a sum does not depend on the order rows
were summed in; values are narrowed to JSON numbers at the edge.
Paginated with the shared keyset convention: ordered by bucket start
time ascending, default limit 500, maximum 5000.
security:
- x402: []
parameters:
- name: assetA
in: path
required: true
schema:
type: string
example: XLM
- name: assetB
in: path
required: true
schema:
type: string
example: USDC
- name: interval
in: query
required: false
schema:
type: string
enum: [1m, 5m, 15m, 1h, 4h, 1d]
default: 1h
- name: from
in: query
required: false
description: >-
Start of the time window (inclusive). Together with `to` this defines
a half-open interval [from, to): samples whose timestamp is exactly
`from` are included, samples whose timestamp is exactly `to` are
excluded. This means two adjacent windows [T0, T1) and [T1, T2)
share no boundary — a sample landing exactly on T1 appears in
exactly one of the two windows.
schema:
type: string
format: date-time
- name: to
in: query
required: false
description: >-
End of the time window (exclusive). Together with `from` this
defines a half-open interval [from, to): samples whose timestamp is
exactly `to` are excluded, samples whose timestamp is exactly
`from` are included. This means two adjacent windows [T0, T1) and
[T1, T2) share no boundary — a sample landing exactly on T1 appears
in exactly one of the two windows.
schema:
type: string
format: date-time
- $ref: '#/components/parameters/CursorQuery'
- name: limit
in: query
required: false
description: Page size. Out-of-range values are clamped into [1, 5000].
schema:
type: integer
minimum: 1
maximum: 5000
default: 500
responses:
'200':
description: Candle data
headers:
Cache-Control:
$ref: '#/components/headers/CacheControl'
content:
application/json:
schema:
type: object
required: [pairKey, interval, from, to, candles, nextCursor, hasMore]
properties:
pairKey:
type: string
interval:
type: string
from:
type: string
format: date-time
to:
type: string
format: date-time
candles:
type: array
items:
type: object
properties:
time:
type: string
format: date-time
open:
type: number
high:
type: number
low:
type: number
close:
type: number
volume:
type: number
nextCursor:
type: string
nullable: true
hasMore:
type: boolean
'400':
description: Invalid parameters
'402':
$ref: '#/components/responses/PaymentRequired'
'429':
$ref: '#/components/responses/TooManyRequests'
/v1/prices/history:
get:
operationId: getPriceSnapshots
summary: Get historical 1-minute price snapshots
description: >-
Returns minute-resolution price snapshots for a pair over [from, to],
optionally aggregated into 5m or 1h buckets, with exact numeric
arithmetic in the database so a sum does not depend on row order.
Snapshots are retained for
~30 days. Paginated with the shared keyset convention: ordered by
bucket start time ascending, default limit 1000, maximum 10000 points.
With format=csv the pagination envelope travels in the X-Next-Cursor
and X-Has-More response headers; with format=json it is in the body.
Gated by x402 (matches the /price prefix).
security:
- x402: []
parameters:
- name: pair
in: query
required: true
schema:
type: string
example: XLM/USDC
- name: interval
in: query
required: false
schema:
type: string
enum: [1m, 5m, 1h]
default: 1m
- name: from
in: query
required: false
description: >-
Start of the time window (inclusive). Together with `to` this defines
a half-open interval [from, to): samples whose timestamp is exactly
`from` are included, samples whose timestamp is exactly `to` are
excluded. This means two adjacent windows [T0, T1) and [T1, T2)
share no boundary — a sample landing exactly on T1 appears in
exactly one of the two windows.
schema:
type: string
format: date-time
- name: to
in: query
required: false
description: >-
End of the time window (exclusive). Together with `from` this
defines a half-open interval [from, to): samples whose timestamp is
exactly `to` are excluded, samples whose timestamp is exactly
`from` are included. This means two adjacent windows [T0, T1) and
[T1, T2) share no boundary — a sample landing exactly on T1 appears
in exactly one of the two windows.
schema:
type: string
format: date-time
- name: format
in: query
required: false
description: >-
Response encoding. `csv` returns a text/csv body holding a
`ts,price,volume` table (RFC 4180 quoting, LF line endings, one
trailing newline); `json` is the default.
schema:
type: string
enum: [json, csv]
default: json
- $ref: '#/components/parameters/CursorQuery'
- name: limit
in: query
required: false
description: >-
Page size (number of buckets). Out-of-range values are clamped
into [1, 10000].
schema:
type: integer
minimum: 1
maximum: 10000
default: 1000
- $ref: '#/components/parameters/NetworkQuery'
responses:
'200':
description: >-
Historical price snapshots. When more buckets exist beyond this
page, the response carries X-Next-Cursor (pass it back as
?cursor=) and X-Has-More: true.
headers:
X-Next-Cursor:
description: Opaque cursor for the next page; absent on the last page.
schema:
type: string
X-Has-More:
description: "'true' when another page exists, 'false' otherwise."
schema:
type: string
enum: ['true', 'false']
content:
text/csv:
schema:
type: string
example: "ts,price,volume\n2025-01-01T00:00:00.000Z,1.25,500\n"
application/json:
schema:
type: object
required: [pair, network, interval, from, to, count, points, nextCursor, hasMore]
properties:
pair:
type: string
network:
type: string
enum: [testnet, mainnet]
interval:
type: string
from:
type: string
format: date-time
to:
type: string
format: date-time
count:
type: integer
description: Number of points in this page (not the total across pages).
points:
type: array
items:
type: object
properties:
ts:
type: string
format: date-time
price:
type: number
volume:
type: number
nextCursor:
type: string
nullable: true
hasMore:
type: boolean
'400':
description: Invalid parameters
'402':
$ref: '#/components/responses/PaymentRequired'
'429':
$ref: '#/components/responses/TooManyRequests'
/v1/pairs:
get:
operationId: listPairs
summary: List all active trading pairs
description: >-
Active trading pairs with their latest price metadata. Paginated with
the shared keyset convention: ordered by pairKey ascending, default
limit 50, maximum 200.
security: []
parameters:
- $ref: '#/components/parameters/NetworkQuery'
- $ref: '#/components/parameters/CursorQuery'
- name: limit
in: query
required: false
description: Page size. Out-of-range values are clamped into [1, 200].
schema:
type: integer
minimum: 1
maximum: 200
default: 50
responses:
'200':
description: List of pairs
headers:
Cache-Control:
$ref: '#/components/headers/CacheControl'
content:
application/json:
schema:
type: object
required: [pairs, nextCursor, hasMore]
properties:
pairs:
type: array
items:
type: object
properties:
pairKey:
type: string
assetA:
$ref: '#/components/schemas/Asset'
assetB:
$ref: '#/components/schemas/Asset'
latestPrice:
type: number
nullable: true
lastUpdated:
type: string
format: date-time
nullable: true
nextCursor:
type: string
nullable: true
hasMore:
type: boolean
'400':
description: Invalid limit or cursor
'429':
$ref: '#/components/responses/TooManyRequests'
post:
operationId: addPair
summary: Add a new trading pair (Admin only)
security:
- adminAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
assetA:
type: string
example: XLM
assetB:
type: string
example: USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5
responses:
'201':
description: Pair added
'400':
description: Invalid input
'401':
description: Unauthorized
'409':