defillama-sdk 0.1.0__py3-none-any.whl
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.
- defillama_api/__init__.py +71 -0
- defillama_api/client.py +157 -0
- defillama_api/constants/__init__.py +11 -0
- defillama_api/constants/dimensions.py +69 -0
- defillama_api/errors.py +41 -0
- defillama_api/modules/__init__.py +29 -0
- defillama_api/modules/account.py +29 -0
- defillama_api/modules/bridges.py +81 -0
- defillama_api/modules/dat.py +31 -0
- defillama_api/modules/ecosystem.py +54 -0
- defillama_api/modules/emissions.py +32 -0
- defillama_api/modules/etfs.py +58 -0
- defillama_api/modules/fees.py +242 -0
- defillama_api/modules/prices.py +122 -0
- defillama_api/modules/stablecoins.py +76 -0
- defillama_api/modules/tvl.py +84 -0
- defillama_api/modules/volumes.py +116 -0
- defillama_api/modules/yields.py +85 -0
- defillama_api/py.typed +0 -0
- defillama_api/types/__init__.py +14 -0
- defillama_api/types/account.py +10 -0
- defillama_api/types/bridges.py +147 -0
- defillama_api/types/dat.py +144 -0
- defillama_api/types/ecosystem.py +175 -0
- defillama_api/types/emissions.py +154 -0
- defillama_api/types/etfs.py +37 -0
- defillama_api/types/fees.py +217 -0
- defillama_api/types/prices.py +99 -0
- defillama_api/types/stablecoins.py +159 -0
- defillama_api/types/tvl.py +189 -0
- defillama_api/types/volumes.py +147 -0
- defillama_api/types/yields.py +170 -0
- defillama_sdk-0.1.0.dist-info/METADATA +688 -0
- defillama_sdk-0.1.0.dist-info/RECORD +36 -0
- defillama_sdk-0.1.0.dist-info/WHEEL +5 -0
- defillama_sdk-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,688 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: defillama-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for DefiLlama API
|
|
5
|
+
Author: DefiLlama
|
|
6
|
+
Project-URL: Homepage, https://api-docs.defillama.com/
|
|
7
|
+
Project-URL: Repository, https://github.com/DefiLlama/python-sdk
|
|
8
|
+
Keywords: defillama,defi,tvl,cryptocurrency,api,sdk
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: requests>=2.31.0
|
|
12
|
+
|
|
13
|
+
# DefiLlama Python SDK
|
|
14
|
+
|
|
15
|
+
Official Python SDK for the [DefiLlama API](https://api-docs.defillama.com/). Access DeFi protocol data including TVL, prices, yields, volumes, fees, bridges, and more.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install defillama-sdk
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
uv pip install defillama-sdk
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from defillama_api import DefiLlama
|
|
31
|
+
|
|
32
|
+
# Free tier
|
|
33
|
+
client = DefiLlama()
|
|
34
|
+
|
|
35
|
+
# Pro tier (required for premium endpoints)
|
|
36
|
+
pro_client = DefiLlama({"api_key": "your-api-key"})
|
|
37
|
+
|
|
38
|
+
# Get all protocols
|
|
39
|
+
protocols = client.tvl.getProtocols()
|
|
40
|
+
|
|
41
|
+
# Get current token prices
|
|
42
|
+
prices = client.prices.getCurrentPrices(
|
|
43
|
+
[
|
|
44
|
+
"ethereum:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
45
|
+
"coingecko:bitcoin",
|
|
46
|
+
]
|
|
47
|
+
)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Configuration
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
config = {
|
|
54
|
+
"api_key": "your-api-key",
|
|
55
|
+
"timeout": 30000,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
client = DefiLlama(config)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Modules
|
|
62
|
+
|
|
63
|
+
- TVL
|
|
64
|
+
- Prices
|
|
65
|
+
- Stablecoins
|
|
66
|
+
- Yields (Pro)
|
|
67
|
+
- Volumes
|
|
68
|
+
- Fees
|
|
69
|
+
- Emissions (Pro)
|
|
70
|
+
- Bridges (Pro)
|
|
71
|
+
- Ecosystem (Pro)
|
|
72
|
+
- ETFs (Pro)
|
|
73
|
+
- DAT (Pro)
|
|
74
|
+
- Account (Pro)
|
|
75
|
+
|
|
76
|
+
🔐 = Requires Pro API key
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## TVL
|
|
81
|
+
|
|
82
|
+
Total Value Locked data for protocols and chains.
|
|
83
|
+
|
|
84
|
+
### getProtocols
|
|
85
|
+
|
|
86
|
+
Get all protocols with current TVL.
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
protocols = client.tvl.getProtocols()
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### getProtocol
|
|
93
|
+
|
|
94
|
+
Get detailed protocol information including historical TVL.
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
aave = client.tvl.getProtocol("aave")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### getTvl
|
|
101
|
+
|
|
102
|
+
Get only current TVL for a protocol.
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
tvl = client.tvl.getTvl("uniswap")
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### getChains
|
|
109
|
+
|
|
110
|
+
Get current TVL for all chains.
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
chains = client.tvl.getChains()
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### getHistoricalChainTvl
|
|
117
|
+
|
|
118
|
+
Get historical TVL data.
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
all_history = client.tvl.getHistoricalChainTvl()
|
|
122
|
+
eth_history = client.tvl.getHistoricalChainTvl("Ethereum")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### getTokenProtocols 🔐
|
|
126
|
+
|
|
127
|
+
Get protocols holding a specific token.
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
holders = pro_client.tvl.getTokenProtocols("ETH")
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### getInflows 🔐
|
|
134
|
+
|
|
135
|
+
Get token inflows/outflows between timestamps.
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
inflows = pro_client.tvl.getInflows(
|
|
139
|
+
"lido",
|
|
140
|
+
1704067200,
|
|
141
|
+
1704153600,
|
|
142
|
+
"ETH,USDC",
|
|
143
|
+
)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### getChainAssets 🔐
|
|
147
|
+
|
|
148
|
+
Get asset breakdown for all chains.
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
assets = pro_client.tvl.getChainAssets()
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Prices
|
|
157
|
+
|
|
158
|
+
Token price data and historical charts.
|
|
159
|
+
|
|
160
|
+
### getCurrentPrices
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
prices = client.prices.getCurrentPrices(
|
|
164
|
+
[
|
|
165
|
+
"ethereum:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
166
|
+
"coingecko:bitcoin",
|
|
167
|
+
"solana:So11111111111111111111111111111111111111112",
|
|
168
|
+
]
|
|
169
|
+
)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### getHistoricalPrices
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
prices = client.prices.getHistoricalPrices(
|
|
176
|
+
1704067200,
|
|
177
|
+
["ethereum:0xdac17f958d2ee523a2206206994597c13d831ec7"],
|
|
178
|
+
)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### getBatchHistoricalPrices
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
prices = client.prices.getBatchHistoricalPrices(
|
|
185
|
+
{
|
|
186
|
+
"ethereum:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": [
|
|
187
|
+
1704067200,
|
|
188
|
+
1704153600,
|
|
189
|
+
1704240000,
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### getChart
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
chart = client.prices.getChart(
|
|
199
|
+
["coingecko:ethereum"],
|
|
200
|
+
{"start": 1704067200, "period": "1d", "span": 30},
|
|
201
|
+
)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### getPercentageChange
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
change = client.prices.getPercentageChange(
|
|
208
|
+
["coingecko:bitcoin"],
|
|
209
|
+
{"period": "24h"},
|
|
210
|
+
)
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### getFirstPrices
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
first = client.prices.getFirstPrices(
|
|
217
|
+
["ethereum:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"]
|
|
218
|
+
)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### getBlockAtTimestamp
|
|
222
|
+
|
|
223
|
+
```python
|
|
224
|
+
block = client.prices.getBlockAtTimestamp("ethereum", 1704067200)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Stablecoins
|
|
230
|
+
|
|
231
|
+
Stablecoin market cap and dominance data.
|
|
232
|
+
|
|
233
|
+
### getStablecoins
|
|
234
|
+
|
|
235
|
+
```python
|
|
236
|
+
stables = client.stablecoins.getStablecoins(True)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### getAllCharts
|
|
240
|
+
|
|
241
|
+
```python
|
|
242
|
+
charts = client.stablecoins.getAllCharts()
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### getChartsByChain
|
|
246
|
+
|
|
247
|
+
```python
|
|
248
|
+
eth_charts = client.stablecoins.getChartsByChain("Ethereum")
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### getStablecoin
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
usdt = client.stablecoins.getStablecoin("1")
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### getChains
|
|
258
|
+
|
|
259
|
+
```python
|
|
260
|
+
chains = client.stablecoins.getChains()
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### getPrices
|
|
264
|
+
|
|
265
|
+
```python
|
|
266
|
+
prices = client.stablecoins.getPrices()
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### getDominance 🔐
|
|
270
|
+
|
|
271
|
+
```python
|
|
272
|
+
dominance = pro_client.stablecoins.getDominance("ethereum", 1)
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Yields 🔐
|
|
278
|
+
|
|
279
|
+
Yield farming, lending, staking, and perpetual funding rates.
|
|
280
|
+
|
|
281
|
+
### getPools
|
|
282
|
+
|
|
283
|
+
```python
|
|
284
|
+
pools = pro_client.yields.getPools()
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### getPoolsOld
|
|
288
|
+
|
|
289
|
+
```python
|
|
290
|
+
pools = pro_client.yields.getPoolsOld()
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### getPoolChart
|
|
294
|
+
|
|
295
|
+
```python
|
|
296
|
+
chart = pro_client.yields.getPoolChart("pool-uuid-here")
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### getBorrowPools
|
|
300
|
+
|
|
301
|
+
```python
|
|
302
|
+
borrow_pools = pro_client.yields.getBorrowPools()
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### getLendBorrowChart
|
|
306
|
+
|
|
307
|
+
```python
|
|
308
|
+
chart = pro_client.yields.getLendBorrowChart("pool-uuid-here")
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### getPerps
|
|
312
|
+
|
|
313
|
+
```python
|
|
314
|
+
perps = pro_client.yields.getPerps()
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### getLsdRates
|
|
318
|
+
|
|
319
|
+
```python
|
|
320
|
+
lsd_rates = pro_client.yields.getLsdRates()
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Volumes
|
|
326
|
+
|
|
327
|
+
DEX, options, and derivatives trading volume data.
|
|
328
|
+
|
|
329
|
+
### getDexOverview
|
|
330
|
+
|
|
331
|
+
```python
|
|
332
|
+
overview = client.volumes.getDexOverview()
|
|
333
|
+
overview = client.volumes.getDexOverview(
|
|
334
|
+
{"excludeTotalDataChart": True, "dataType": "dailyVolume"}
|
|
335
|
+
)
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### getDexOverviewByChain
|
|
339
|
+
|
|
340
|
+
```python
|
|
341
|
+
eth_volume = client.volumes.getDexOverviewByChain("Ethereum")
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### getDexSummary
|
|
345
|
+
|
|
346
|
+
```python
|
|
347
|
+
uniswap = client.volumes.getDexSummary("uniswap")
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### getOptionsOverview
|
|
351
|
+
|
|
352
|
+
```python
|
|
353
|
+
options = client.volumes.getOptionsOverview()
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### getOptionsOverviewByChain
|
|
357
|
+
|
|
358
|
+
```python
|
|
359
|
+
eth_options = client.volumes.getOptionsOverviewByChain("Ethereum")
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### getOptionsSummary
|
|
363
|
+
|
|
364
|
+
```python
|
|
365
|
+
derive = client.volumes.getOptionsSummary("derive")
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### getDerivativesOverview 🔐
|
|
369
|
+
|
|
370
|
+
```python
|
|
371
|
+
derivatives = pro_client.volumes.getDerivativesOverview()
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### getDerivativesSummary 🔐
|
|
375
|
+
|
|
376
|
+
```python
|
|
377
|
+
gmx = pro_client.volumes.getDerivativesSummary("gmx")
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## Fees
|
|
383
|
+
|
|
384
|
+
Protocol fees and revenue data.
|
|
385
|
+
|
|
386
|
+
### Fee Data Types
|
|
387
|
+
|
|
388
|
+
```python
|
|
389
|
+
from defillama_api import FeeDataType
|
|
390
|
+
|
|
391
|
+
FeeDataType.DAILY_FEES
|
|
392
|
+
FeeDataType.DAILY_REVENUE
|
|
393
|
+
FeeDataType.DAILY_HOLDERS_REVENUE
|
|
394
|
+
FeeDataType.DAILY_SUPPLY_SIDE_REVENUE
|
|
395
|
+
FeeDataType.DAILY_BRIBES_REVENUE
|
|
396
|
+
FeeDataType.DAILY_TOKEN_TAXES
|
|
397
|
+
FeeDataType.DAILY_APP_FEES
|
|
398
|
+
FeeDataType.DAILY_APP_REVENUE
|
|
399
|
+
FeeDataType.DAILY_EARNINGS
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### getOverview
|
|
403
|
+
|
|
404
|
+
```python
|
|
405
|
+
fees = client.fees.getOverview()
|
|
406
|
+
revenue = client.fees.getOverview({"dataType": FeeDataType.DAILY_REVENUE})
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### getOverviewByChain
|
|
410
|
+
|
|
411
|
+
```python
|
|
412
|
+
eth_fees = client.fees.getOverviewByChain("Ethereum")
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### getSummary
|
|
416
|
+
|
|
417
|
+
```python
|
|
418
|
+
uniswap_fees = client.fees.getSummary("uniswap")
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### getChart 🔐
|
|
422
|
+
|
|
423
|
+
```python
|
|
424
|
+
chart = pro_client.fees.getChart()
|
|
425
|
+
eth_chart = pro_client.fees.getChartByChain("Ethereum")
|
|
426
|
+
protocol_chart = pro_client.fees.getChartByProtocol("aave")
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### getChartByProtocolChainBreakdown 🔐
|
|
430
|
+
|
|
431
|
+
```python
|
|
432
|
+
breakdown = pro_client.fees.getChartByProtocolChainBreakdown("aave")
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### getChartByProtocolVersionBreakdown 🔐
|
|
436
|
+
|
|
437
|
+
```python
|
|
438
|
+
breakdown = pro_client.fees.getChartByProtocolVersionBreakdown("uniswap")
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### getChartByChainProtocolBreakdown 🔐
|
|
442
|
+
|
|
443
|
+
```python
|
|
444
|
+
breakdown = pro_client.fees.getChartByChainProtocolBreakdown("Ethereum")
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### getChartChainBreakdown 🔐
|
|
448
|
+
|
|
449
|
+
```python
|
|
450
|
+
breakdown = pro_client.fees.getChartChainBreakdown()
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### getMetrics 🔐
|
|
454
|
+
|
|
455
|
+
```python
|
|
456
|
+
metrics = pro_client.fees.getMetrics()
|
|
457
|
+
chain_metrics = pro_client.fees.getMetricsByChain("Ethereum")
|
|
458
|
+
protocol_metrics = pro_client.fees.getMetricsByProtocol("aave")
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## Emissions 🔐
|
|
464
|
+
|
|
465
|
+
Token unlock schedules and vesting data.
|
|
466
|
+
|
|
467
|
+
### getAll
|
|
468
|
+
|
|
469
|
+
```python
|
|
470
|
+
emissions = pro_client.emissions.getAll()
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### getByProtocol
|
|
474
|
+
|
|
475
|
+
```python
|
|
476
|
+
arbitrum = pro_client.emissions.getByProtocol("arbitrum")
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## Bridges 🔐
|
|
482
|
+
|
|
483
|
+
Cross-chain bridge volume and transaction data.
|
|
484
|
+
|
|
485
|
+
### getAll
|
|
486
|
+
|
|
487
|
+
```python
|
|
488
|
+
bridges = pro_client.bridges.getAll()
|
|
489
|
+
bridges = pro_client.bridges.getAll({"includeChains": True})
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### getById
|
|
493
|
+
|
|
494
|
+
```python
|
|
495
|
+
bridge = pro_client.bridges.getById(1)
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
### getVolumeByChain
|
|
499
|
+
|
|
500
|
+
```python
|
|
501
|
+
volume = pro_client.bridges.getVolumeByChain("Ethereum")
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### getDayStats
|
|
505
|
+
|
|
506
|
+
```python
|
|
507
|
+
stats = pro_client.bridges.getDayStats(1704067200, "Ethereum")
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
### getTransactions
|
|
511
|
+
|
|
512
|
+
```python
|
|
513
|
+
txs = pro_client.bridges.getTransactions(
|
|
514
|
+
1,
|
|
515
|
+
{
|
|
516
|
+
"limit": 100,
|
|
517
|
+
"startTimestamp": 1704067200,
|
|
518
|
+
"endTimestamp": 1704153600,
|
|
519
|
+
"sourceChain": "Ethereum",
|
|
520
|
+
"address": "0x...",
|
|
521
|
+
},
|
|
522
|
+
)
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
---
|
|
526
|
+
|
|
527
|
+
## Ecosystem 🔐
|
|
528
|
+
|
|
529
|
+
Ecosystem-level data.
|
|
530
|
+
|
|
531
|
+
### getCategories
|
|
532
|
+
|
|
533
|
+
```python
|
|
534
|
+
categories = pro_client.ecosystem.getCategories()
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### getForks
|
|
538
|
+
|
|
539
|
+
```python
|
|
540
|
+
forks = pro_client.ecosystem.getForks()
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### getOracles
|
|
544
|
+
|
|
545
|
+
```python
|
|
546
|
+
oracles = pro_client.ecosystem.getOracles()
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### getEntities
|
|
550
|
+
|
|
551
|
+
```python
|
|
552
|
+
entities = pro_client.ecosystem.getEntities()
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### getTreasuries
|
|
556
|
+
|
|
557
|
+
```python
|
|
558
|
+
treasuries = pro_client.ecosystem.getTreasuries()
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
### getHacks
|
|
562
|
+
|
|
563
|
+
```python
|
|
564
|
+
hacks = pro_client.ecosystem.getHacks()
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### getRaises
|
|
568
|
+
|
|
569
|
+
```python
|
|
570
|
+
raises = pro_client.ecosystem.getRaises()
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
---
|
|
574
|
+
|
|
575
|
+
## ETFs 🔐
|
|
576
|
+
|
|
577
|
+
Bitcoin and Ethereum ETF data.
|
|
578
|
+
|
|
579
|
+
### getOverview
|
|
580
|
+
|
|
581
|
+
```python
|
|
582
|
+
btc_etfs = pro_client.etfs.getOverview()
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
### getOverviewEth
|
|
586
|
+
|
|
587
|
+
```python
|
|
588
|
+
eth_etfs = pro_client.etfs.getOverviewEth()
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
### getHistory
|
|
592
|
+
|
|
593
|
+
```python
|
|
594
|
+
history = pro_client.etfs.getHistory()
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
### getHistoryEth
|
|
598
|
+
|
|
599
|
+
```python
|
|
600
|
+
history_eth = pro_client.etfs.getHistoryEth()
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
### getFdvPerformance
|
|
604
|
+
|
|
605
|
+
```python
|
|
606
|
+
perf = pro_client.etfs.getFdvPerformance("30")
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
---
|
|
610
|
+
|
|
611
|
+
## DAT 🔐
|
|
612
|
+
|
|
613
|
+
Digital Asset Treasury data and institutional holdings.
|
|
614
|
+
|
|
615
|
+
### getInstitutions
|
|
616
|
+
|
|
617
|
+
```python
|
|
618
|
+
data = pro_client.dat.getInstitutions()
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
### getInstitution
|
|
622
|
+
|
|
623
|
+
```python
|
|
624
|
+
mstr = pro_client.dat.getInstitution("MSTR")
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
---
|
|
628
|
+
|
|
629
|
+
## Account 🔐
|
|
630
|
+
|
|
631
|
+
API usage management.
|
|
632
|
+
|
|
633
|
+
### getUsage
|
|
634
|
+
|
|
635
|
+
```python
|
|
636
|
+
usage = pro_client.account.getUsage()
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
---
|
|
640
|
+
|
|
641
|
+
## Error Handling
|
|
642
|
+
|
|
643
|
+
```python
|
|
644
|
+
from defillama_api import ApiKeyRequiredError, RateLimitError, NotFoundError, ApiError
|
|
645
|
+
|
|
646
|
+
try:
|
|
647
|
+
data = pro_client.yields.getPools()
|
|
648
|
+
except ApiKeyRequiredError:
|
|
649
|
+
print("Pro API key required for this endpoint")
|
|
650
|
+
except RateLimitError as exc:
|
|
651
|
+
print(f"Rate limited. Retry after {exc.retry_after} seconds")
|
|
652
|
+
except NotFoundError:
|
|
653
|
+
print("Resource not found")
|
|
654
|
+
except ApiError as exc:
|
|
655
|
+
print(f"API error: {exc.status_code}")
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
---
|
|
659
|
+
|
|
660
|
+
## Type Exports
|
|
661
|
+
|
|
662
|
+
All types are available from `defillama_api.types`, and are re-exported at the top level:
|
|
663
|
+
|
|
664
|
+
```python
|
|
665
|
+
from defillama_api import Protocol, CoinPricesResponse, Stablecoin, YieldPool
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
---
|
|
669
|
+
|
|
670
|
+
## Constants
|
|
671
|
+
|
|
672
|
+
```python
|
|
673
|
+
from defillama_api import AdapterType, FeeDataType, VolumeDataType
|
|
674
|
+
|
|
675
|
+
AdapterType.DEXS
|
|
676
|
+
VolumeDataType.DAILY_VOLUME
|
|
677
|
+
FeeDataType.DAILY_FEES
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
---
|
|
681
|
+
|
|
682
|
+
## Requirements
|
|
683
|
+
|
|
684
|
+
- Python >= 3.9
|
|
685
|
+
|
|
686
|
+
## License
|
|
687
|
+
|
|
688
|
+
MIT
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
defillama_api/__init__.py,sha256=I_Xbp5e4Dt3QozmepJ6uGwS3mQOEiEbVzp6f9THObNU,2161
|
|
2
|
+
defillama_api/client.py,sha256=YducXxdZefwp2WnGUkL-OAZhhrm-C8-qZfC0YIw1sWs,4965
|
|
3
|
+
defillama_api/errors.py,sha256=m7gqX_ri0pm9QSQVkCgCHn8cYz3OmOdhuOXOdkifnvM,1209
|
|
4
|
+
defillama_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
defillama_api/constants/__init__.py,sha256=mm_zBSoTOmb8pQ3YK8Ji9Xo7qX_M5ZYbVA_K5XgS7F0,273
|
|
6
|
+
defillama_api/constants/dimensions.py,sha256=XPBP2J-ILFD2E_slf-h3xo7jwtPl4K2Ugf836fWiHSM,1887
|
|
7
|
+
defillama_api/modules/__init__.py,sha256=Wmo-k2cAlX1Kz2CBYYnmWJiBRKtJ5Bf12qk2QBj47Eo,708
|
|
8
|
+
defillama_api/modules/account.py,sha256=Gz-FDyRTaz4lMtTGdTDLl4UDXR1oiuCSCsRS9_CIW6E,901
|
|
9
|
+
defillama_api/modules/bridges.py,sha256=CSfSZQYsSlwEeLnr-Tkz6CZVQM8nZoKvQUQPKsceuRE,2567
|
|
10
|
+
defillama_api/modules/dat.py,sha256=XbIoeljsJZIknRn2s4uMxsq-6M-GDHmOBc38z5a0mBM,884
|
|
11
|
+
defillama_api/modules/ecosystem.py,sha256=NvFO7h2i4Hb2emNAJ_zYNuRUgcqn_m6D-GImDj6hwiY,1518
|
|
12
|
+
defillama_api/modules/emissions.py,sha256=SrJ2E7zzRAduJIf-YXtVqJxgqcziGRWvtx3B4A1e5QI,926
|
|
13
|
+
defillama_api/modules/etfs.py,sha256=F4HrzAQdd2aFreuL8KCbJnQWJ11cjlUG1oSRpq8d2W4,1535
|
|
14
|
+
defillama_api/modules/fees.py,sha256=pmKxX5x8frrHFTdChAqSdmGCFwciRixsgR3PhTTOtRg,8267
|
|
15
|
+
defillama_api/modules/prices.py,sha256=Cq0ZRTXMdpUteUhopZBWQNqkNf_jiJY2YldRuuViJhQ,3675
|
|
16
|
+
defillama_api/modules/stablecoins.py,sha256=TT8IDv0GSLhDqi0NVD9j6GwCo7fidISO2TfEoWPtkOQ,2463
|
|
17
|
+
defillama_api/modules/tvl.py,sha256=TRyv0VHg_JpBdtWSpW87vJcuB0EDDHzOJSvkXPXz-RQ,2454
|
|
18
|
+
defillama_api/modules/volumes.py,sha256=pawVOPF4KWbTqBCY_Fz4pLUIP1sGUPhDI0xGRE1VRm4,4049
|
|
19
|
+
defillama_api/modules/yields.py,sha256=tWgOBgRbw8qtyET22wo8o3umtvbwyKYoojfY8HkMHrk,2178
|
|
20
|
+
defillama_api/types/__init__.py,sha256=vD04wPPb58zcvh1BYUcTUifkoqgyy-LRIl8Lm7Z4xkM,317
|
|
21
|
+
defillama_api/types/account.py,sha256=BBGOvn3L7WxhGfAWyffc7fqNP1ZbJvWDMHV21UtWrTk,147
|
|
22
|
+
defillama_api/types/bridges.py,sha256=6GcIDLsyRUqorKsPCgKktoaBm0nEF-KlBydvF3KnvP4,3421
|
|
23
|
+
defillama_api/types/dat.py,sha256=_qdpI33t6h4HC-o9FB6cI43t37mA9ngyqKm9_yKNY8o,3899
|
|
24
|
+
defillama_api/types/ecosystem.py,sha256=9RHnpOueJgvrJz8U0uSAv0m7Xh2JvdkanXp5q6ofjs8,4471
|
|
25
|
+
defillama_api/types/emissions.py,sha256=rijfVlkV9PMVbIn2UsV69-wmoWs-ZLE8Wb1XhEEKoYE,3398
|
|
26
|
+
defillama_api/types/etfs.py,sha256=wJOjd1cD3-_CN0BrEeXPnqXVlbN5uIqzoQ6OhhXbpdo,577
|
|
27
|
+
defillama_api/types/fees.py,sha256=ePqqzSmvXqazC4e-KCIouvQeRZpePnTEthQzeTxN5EU,5886
|
|
28
|
+
defillama_api/types/prices.py,sha256=qot5ESoMHZkLgL6sTg_FaEfY62eed2H-SXXAbKM2B30,1974
|
|
29
|
+
defillama_api/types/stablecoins.py,sha256=SfCVOIogu88JdONekzSJrPIno2v-EYDDoBPBYZP_vM4,3965
|
|
30
|
+
defillama_api/types/tvl.py,sha256=XOsSzVCNpDy3VEbX33vo7qAUv7lokdB9Q7KU5RNKd0k,4530
|
|
31
|
+
defillama_api/types/volumes.py,sha256=VJ14YepNzbayY-jsarbv_jIopnxl2bbWPqldo9TZAUs,4293
|
|
32
|
+
defillama_api/types/yields.py,sha256=rpuAzxLBy4QO42EtUYDXS-sbq4AqoND9YfePYXLg7Tc,3978
|
|
33
|
+
defillama_sdk-0.1.0.dist-info/METADATA,sha256=-SMOI1et3HZ5Cqh3pQr-6EUoyzejVhSW73sheOjdlL4,10781
|
|
34
|
+
defillama_sdk-0.1.0.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
35
|
+
defillama_sdk-0.1.0.dist-info/top_level.txt,sha256=vZ6lunBg1x-WPWjQcH_obfCDY2P8kLmhAUfgSb9UFnQ,14
|
|
36
|
+
defillama_sdk-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
defillama_api
|