L&B Events
What is this endpoint for?
This endpoint returns transactions (borrows, repayments, withdrawals, deposits and liquidations) registered on-chain, for the main L&B protocols.
Endpoint
https://eu.market-api.kaiko.io/v2/data/lending.v1/events
Parameters
Fields
Metadata information
Borrow event:
Deposit event:
Withdraw event:
Repayment event
Liquidation event
Request examples
curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: KAIKO_API_KEY' \
'https://us.market-api.kaiko.io/v2/data/lending.v1/events?blockchain=ethereum&start_time=2024-09-27T13:13:53.441Z&end_time=2024-09-29T13:13:53.441Z'
import http.client
import json
# Enter your Kaiko API Key
api_key = "KAIKO_API_KEY"
api_host = "us.market-api.kaiko.io"
api_base_endpoint = "/v2/data/lending.v1/events"
# Start of parameter configuration
optional_params = {
"blockchain": "ethereum",
"start_time": "2024-09-27T13:13:53.441Z",
"end_time": "2024-09-29T13:13:53.441Z",
}
# End of parameter configuration
conn = http.client.HTTPSConnection(api_host)
headers = {
"X-Api-Key": api_key,
"Accept": "application/json"
}
url_params = []
for param, value in optional_params.items():
url_params.append(f"{param}={value}")
url_params = '&'.join(url_params)
# Pagination for next pages
all_data = []
next_url = f"{api_base_endpoint}?{url_params}"
while next_url:
conn.request("GET", next_url, headers=headers)
response = conn.getresponse()
data = json.loads(response.read().decode("utf-8"))
all_data.extend(data.get("data", []))
print(f"Fetched {len(data.get('data', []))} datapoints. Total: {len(all_data)}")
next_url = data.get("next_url", "").replace("https://us.market-api.kaiko.io", "")
if not next_url:
break
conn.close()
print(f" datapoints fetched: {(all_data)}")
```
Response example
{
"query": {
"blockchain": "*",
"block_number": "*",
"asset": "*",
"user_address": "*",
"tx_hash": "*",
"type": "*",
"start_time": "*",
"end_time": "*",
"protocol": "*",
"sort": "descending",
"page_size": "1000",
"start_block": "*",
"end_block": "*"
},
"time": "2022-05-17T14:26:27.274Z",
"timestamp": 1652797587,
"data":
[
{
"blockchain": "ethereum",
"block_number": 16025918,
"datetime": 1669124591,
"transaction_hash":"0xa49cfa9c026e728614ca0bdf7272eaaad5b3dd8881fd263ea19ef7d648d9c941",
"exchange_code": "aave/v2",
"type": "repayment",
"user_address": "0x4f381fb46dfde2bc9dcae2d881705749b1ed6e1a",
"asset_symbol": "crv",
"asset_address": "0xd533a949740bb3306d119cc777fa900ba034cd52",
"asset_decimals": 18,
"receipt_symbol": "acrv",
"receipt_address": "0x8dae6cb04688c62d939ed9b68d32bc62e49970b1",
"receipt_decimals": 18,
"amount": 299894.78,
"metadata": {
"borrowRateMode": 2,
"amountInReceiptAsset": "299894.77",
"onBehalfOf": "0x4f381fb46dfde2bc9dcae2d881705749b1ed6e1a"
}
}
/* ... */
],
"continuation_token": "xxx",
"next_url": "https://eu.market-api.kaiko.io/v2/data/lending.v1/events?continuation_token=xxx"
}
Last updated