Repository navigation
Expand file tree
/
Copy pathtypes.ts
More file actions
118 lines (110 loc) · 2.49 KB
/
Copy pathtypes.ts
File metadata and controls
118 lines (110 loc) · 2.49 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
export interface PricePoint {
id?: string
assetA: string
assetB: string
pairKey: string
source: 'SDEX' | 'AMM' | string
poolId?: string
price: number
baseVolume: number
counterVolume: number
ledger: number
observedAt: Date
sourceTime: Date | null
/** @deprecated use observedAt (wall clock) or sourceTime (venue native clock) */
timestamp?: Date
eventId?: string
}
export interface AggregatedPrice {
assetA: string
assetB: string
pairKey: string
price: number | string
sdexPrice: number | string
ammPrice: number | string
bestRoute: 'SDEX' | 'AMM' | 'SPLIT' | 'UNKNOWN'
volume24h: number | string
sdexVolume24h: number | string
ammVolume24h: number | string
vwap1m: number | string
vwap5m: number | string
vwap1h: number | string
vwap24h: number | string
priceChange24h: number | string
lastUpdated: Date
sources: number
confidence: 'high' | 'medium' | 'low' | 'unknown'
lastTradeAgeSeconds: number | null
newestInputObservedAt: string | null
inputCount: number
stalenessThresholdSeconds: number
stale: boolean
}
export interface RouteHop {
assetIn: AssetId
assetOut: AssetId
venue: 'SDEX' | 'AMM'
poolId?: string
inputAmount: number
outputAmount: number
price: number
spotPrice: number
slippagePct: number
}
export interface RouteOption {
hops: RouteHop[]
hopCount: number
estimatedOutput: number
effectivePrice: number
slippagePct: number
}
export interface RouteProvenance {
sampledAt: string
network: string
venuesQueried: string[]
sampleCount: number
freshnessSeconds: number | null
}
export interface RouteInfo {
route: 'SDEX' | 'AMM' | 'SPLIT' | 'MULTI_HOP' | 'UNKNOWN'
sdexPrice: number
ammPrice: number
estimatedOutput: number
slippagePct: number
recommendation: string
network?: string
hops?: RouteHop[]
comparison?: {
direct: {
route: 'SDEX' | 'AMM' | 'SPLIT' | 'UNKNOWN'
sdexPrice: number
ammPrice: number
estimatedOutput: number
slippagePct: number
}
multiHop: RouteOption | null
}
provenance?: RouteProvenance
}
export interface WatchedPair {
assetA: AssetId
assetB: AssetId
pairKey: string
}
export interface AssetId {
code: string
issuer: string | null // null for native XLM
}
export interface PriceBucket {
bucket: Date
window: string
vwap: number
sdexVwap: number | null
ammVwap: number | null
volume: number
tradeCount: number
open: number | null
close: number | null
high: number | null
low: number | null
}