openapi: 3.2.0
info:
title: Defi Lending API
version: '2'
servers:
- url: https://api.amberdata.com/defi
security:
- sec0: []
tags:
- name: Lending
paths:
/lending/{protocolId}/protocol:
get:
summary: Protocol Lens
description: This API retrieves information about all of the actions that occurred on the protocol within a certain timespan.
operationId: defi-lending-protocol-lens
parameters:
- name: protocolId
in: path
schema:
type: string
enum:
- aavev2
- aavev3
- makerdao
- compoundv2
default: aavev2
required: true
- name: startDate
in: query
description: '**[Optional]** Payload only includes data after this date (inclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`'
schema:
type: string
format: date-time
- name: endDate
in: query
description: '**[Optional]** Payload only includes data before this date (exclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`'
schema:
type: string
format: date-time
- name: size
in: query
description: '**[Optional]** Number of records per page. If not specified, the API will default to and try to return 1000 actions under **payload.data**.'
schema:
type: integer
format: int32
- name: direction
in: query
description: '**[Optional]** The order in which to return the results (ascending or descending). By default. records are returned in ascending order, so the oldest records are returned first.'
schema:
type: string
enum:
- asc
- desc
- name: timeFormat
in: query
schema:
type: string
enum:
- milliseconds
- ms
- iso
- iso8601
- hr
- human_readable
- name: x-amberdata-blockchain-id
in: header
description: '**[Optional]** The id of the blockchain for which you want protocol data from. Defaults to `ethereum-mainnet` if not specified. Use the [Information Protocols](https://docs.amberdata.io/reference/defi-lending-information-protocols) API to view the supported protocol and blockchain id combinations.'
schema:
type: string
enum:
- ethereum-mainnet
- polygon-mainnet
- avalanche-mainnet
- arbitrum-mainnet
- optimism-mainnet
default: polygon-mainnet
- name: action
in: query
description: '**[Optional]** Payload only includes data filtered by the action.'
schema:
type: string
enum:
- Deposit
- Withdraw
- LiquidationCall
- Repay
- Borrow
- FlashLoan
responses:
'200':
description: '200'
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
default: 0
title:
type: string
example: OK
description:
type: string
example: Successful request
payload:
type: object
properties:
metadata:
type: object
properties:
next:
type: string
example: https://api.amberdata.com/defi/lending/aavev2/protocol?cursor=N4IgDgTg9gLlDGUA2BJAJiAXCAhjgbgKb4BMIANCAJYB28SArmoQIJJIAqEONAzjvBhUoNAKJEaMXlgBmOJL0KUhAW0IAxKBBU4YWEAAsGOmgCVCONDgBGSQhRBoqEQoOE19LAMoBhB7xgcCBgAEV17TABGADZoyIAGAHYATkSSaPjMykIaNDCYCJi4yPSAFkyKyl4qAC8IkABmB2YiJCgwQggAWShmWXlFShktHT1sACteEQcwHABzQsotKjnaeS9A4PzC2ISUjIr4pYgVtaRRXO2sIsiS6PLDgF8gA
data:
type: array
items:
type: object
properties:
action:
type: string
example: UseReserveAsCollateral
timestamp:
type: string
example: 2022-08-21 11:00:03 000
blockNumber:
type: integer
example: 15383603
default: 0
transactionHash:
type: string
example: '0x0bee33572d60aaf827adb727c0db3fc72f78c7c80257c69bafa37c180907666d'
logIndex:
type: integer
example: 529
default: 0
assetId:
type: string
example: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
assetSymbol:
type: string
example: STETH
marketId:
type: string
example: '0xb53c1a33016b2dc2ff3653530bff1848a515c8c5'
market:
type: string
example: main
reserveAsCollateralEnabled:
type: boolean
example: true
default: true
user:
type: string
example: '0xb9428f4e0c0c104f89dfd1fd3f4ca89549666666'
deprecated: false
tags:
- Lending
/lending/{protocolId}/wallets/{walletAddress}:
get:
summary: Wallet Lens
description: This API retrieves information about all of the actions taken by a specific wallet on the protocol within a certain timespan.
operationId: defi-lending-wallet-lens
parameters:
- name: protocolId
in: path
schema:
type: string
enum:
- aavev2
- aavev3
- compoundv2
- makerdao
default: aavev2
required: true
- name: startDate
in: query
description: '**[Optional]** Payload only includes data after this date (inclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`'
schema:
type: string
format: date-time
default: '2022-09-01'
- name: endDate
in: query
description: '**[Optional]** Payload only includes data before this date (exclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`'
schema:
type: string
format: date-time
default: '2022-10-31'
- name: size
in: query
description: '**[Optional]** Number of records per page. If not specified, the API will default to and try to return 1000 actions under **payload.data**.'
schema:
type: integer
format: int32
- name: direction
in: query
description: '**[Optional]** The order in which to return the results (ascending or descending). By default. records are returned in ascending order, so the oldest records are returned first.'
schema:
type: string
enum:
- asc
- desc
- name: timeFormat
in: query
description: '**[Optional]** Time format of the timestamps in the return payload.'
schema:
type: string
enum:
- milliseconds
- ms
- iso
- iso8601
- hr
- human_readable
- name: x-amberdata-blockchain-id
in: header
description: '**[Optional]** The id of the blockchain for which you want protocol data from. Defaults to `ethereum-mainnet` if not specified. Use the [Information Protocols](https://docs.amberdata.io/reference/defi-lending-information-protocols) API to view the supported protocol and blockchain id combinations.'
schema:
type: string
enum:
- ethereum-mainnet
- polygon-mainnet
- avalanche-mainnet
- arbitrum-mainnet
- optimism-mainnet
- name: walletAddress
in: path
description: The wallet address
schema:
type: string
default: '0x1ec5878ffc42e6d5d80422bdd06cf0712e5611fd'
required: true
- name: action
in: query
description: '**[Optional]** Payload only includes data filtered by the action.'
schema:
type: string
enum:
- Deposit
- Withdraw
- LiquidationCall
- Repay
- Borrow
- FlashLoan
responses:
'200':
description: '200'
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
default: 0
title:
type: string
example: OK
description:
type: string
example: Successful request
payload:
type: object
properties:
metadata:
type: object
properties:
next:
type: string
example: https://api.amberdata.com/defi/lending/aavev2/wallets/0xe26684de8d5a40a35c3fc15c9328c7f3a523759b?cursor=N4IgDgTg9gLlDGUA2BJAJiAXCAhjgbgKb4BMIANCAJYB28SArmoQIJJIAqEONAzjvBhUoNAKJEaMXlgBmOJL0KUhAW0IAxKBBU4YWEAAsGOmgCVCONDgBGSQhRBoqEQoOE19LAMoBhB7xgcCBgAEV17TABGADZoyMiSAAYAFmSAZkTMykIaNDCYCJi4hOjkzPLKXioALwiQNIdmIiQoMEIIAFkoZll5RUoZLR09bAArXhEHMBwAc0LKLSoZ2nkvQOD8wtjIxIB2AE5o8qyQReWaeVFczawi%2BJJS48SAXyA
data:
type: array
items:
type: object
properties:
action:
type: string
example: Withdraw
timestamp:
type: string
example: 2022-08-21 11:09:05 000
blockNumber:
type: integer
example: 15383647
default: 0
transactionHash:
type: string
example: '0xc03a13328450f14094551250865c7e3b3f97ccae37a3cc1079efed098033c2b7'
logIndex:
type: integer
example: 669
default: 0
assetId:
type: string
example: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
assetSymbol:
type: string
example: WETH
marketId:
type: string
example: '0xb53c1a33016b2dc2ff3653530bff1848a515c8c5'
market:
type: string
example: main
amount:
type: number
example: 0.4072108498457563
default: 0
user:
type: string
example: '0xe26684de8d5a40a35c3fc15c9328c7f3a523759b'
to:
type: string
example: '0xe26684de8d5a40a35c3fc15c9328c7f3a523759b'
deprecated: false
tags:
- Lending
/lending/{protocolId}/assets/{asset}:
get:
summary: Asset Lens
description: This API retrieves information about all of the actions that occurred for a specific asset on the protocol within a certain timespan.
operationId: defi-lending-asset-lens
parameters:
- name: protocolId
in: path
schema:
type: string
enum:
- aavev2
- aavev3
- compoundv2
- makerdao
default: aavev2
required: true
- name: startDate
in: query
description: '**[Optional]** Payload only includes data after this date (inclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`'
schema:
type: string
format: date-time
- name: endDate
in: query
description: '**[Optional]** Payload only includes data before this date (exclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`'
schema:
type: string
format: date-time
- name: size
in: query
description: '**[Optional]** Number of records per page. If not specified, the API will default to and try to return 1000 actions under **payload.data**.'
schema:
type: integer
format: int32
- name: direction
in: query
description: '**[Optional]** The order in which to return the results (ascending or descending). By default. records are returned in ascending order, so the oldest records are returned first.'
schema:
type: string
enum:
- asc
- desc
- name: timeFormat
in: query
description: '**[Optional]** Time format of the timestamps in the return payload.'
schema:
type: string
enum:
- milliseconds
- ms
- iso
- iso8601
- hr
- human_readable
- name: x-amberdata-blockchain-id
in: header
description: '**[Optional]** The id of the blockchain for which you want protocol data from. Defaults to `ethereum-mainnet` if not specified. Use the [Information Protocols](https://docs.amberdata.io/reference/defi-lending-information-protocols) API to view the supported protocol and blockchain id combinations.'
schema:
type: string
enum:
- ethereum-mainnet
- polygon-mainnet
- avalanche-mainnet
- arbitrum-mainnet
- optimism-mainnet
- name: asset
in: path
description: '**[Examples]** `WETH` The token symbol'
schema:
type: string
default: WETH
required: true
- name: action
in: query
description: '**[Optional]** Payload only includes data filtered by the action.
**[Examples]** `UseReserveAsCollateral|Deposit|Withdraw|LiquidationCall|Repay|Borrow|FlashLoan`'
schema:
type: string
enum:
- Deposit
- Withdraw
- LiquidationCall
- Repay
- Borrow
- FlashLoan
responses:
'200':
description: '200'
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
default: 0
title:
type: string
example: OK
description:
type: string
example: Successful request
payload:
type: object
properties:
metadata:
type: object
properties:
next:
type: string
example: https://api.amberdata.com/defi/lending/aavev2/assets/WETH?cursor=N4IgDgTg9gLlDGUA2BJAJiAXCAhjgbgKb4BMIANCALY4QDWhMWAdgK5JKUCWz8SraQgEEOAFQg5mAZxzwYXKMwCiRZjClYAZjiRTCleVUIAxKBBpNsAC1Y1mAJUI40OAEZJCFEGi4RCchWYsECEAZQBhLykYWhgAERwYT0wARgA2NJSABgAOFJSAFgBWLNLKQmY0BKSsdMyUkjSC0pbKKS4AL2SQAGYvQSIkKDBCCABZKEEtHT1KTTMLYIArKUUvMBwAc2SUyjMuTZ4dUJiIeMSdjOyAdgBONJaykH3D5h0lSurL%2Bsbmx8ocFI9DB0MEsgAPeBZEh4HA9W6uEgkHqaQg5NBZHBZQhFeAFTQka5ONC3XI9eDXIppeDwMgAXyAA
data:
type: array
items:
type: object
properties:
action:
type: string
example: Withdraw
timestamp:
type: string
example: 2022-08-21 11:09:05 000
blockNumber:
type: integer
example: 15383647
default: 0
transactionHash:
type: string
example: '0xc03a13328450f14094551250865c7e3b3f97ccae37a3cc1079efed098033c2b7'
logIndex:
type: integer
example: 669
default: 0
assetId:
type: string
example: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
assetSymbol:
type: string
example: WETH
marketId:
type: string
example: '0xb53c1a33016b2dc2ff3653530bff1848a515c8c5'
market:
type: string
example: main
amount:
type: number
example: 0.4072108498457563
default: 0
user:
type: string
example: '0xe26684de8d5a40a35c3fc15c9328c7f3a523759b'
to:
type: string
example: '0xe26684de8d5a40a35c3fc15c9328c7f3a523759b'
'400':
description: '400'
content:
application/json:
examples:
Result:
value: '{}'
schema:
type: object
properties: {}
deprecated: false
tags:
- Lending
/lending/{protocolId}/governance:
get:
summary: Governance Lens
description: This API retrieves information about all of the governance actions that occurred for the protocol within a certain timespan.
operationId: defi-lending-governance-lens
parameters:
- name: startDate
in: query
description: Payload only includes data after this date (inclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`
schema:
type: string
format: date-time
default: '2022-09-01'
- name: endDate
in: query
description: Payload only includes data before this date (exclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`
schema:
type: string
format: date-time
default: '2022-09-30'
- name: size
in: query
description: Number of records per page
schema:
type: integer
format: int32
- name: direction
in: query
description: The order in which to return the results (ascending or descending). By default. records are returned in descending order, so the most recent records are returned first.
schema:
type: string
- name: timeFormat
in: query
description: Time format of the timestamps in the return payload.
**[Defaults]** `milliseconds | ms* | iso | iso8601 | hr | human_readable`
schema:
type: string
- name: proposalId
in: query
description: The proposal id to filter results by
schema:
type: string
- name: address
in: query
description: The wallet address to filter results by
schema:
type: string
- name: support
in: query
description: Filter results by votes for or votes against
schema:
type: boolean
- name: protocolId
in: path
description: '**Note**: Aave has the same governance regardless of protocol version (v2 vs. v3).'
schema:
type: string
enum:
- aavev2
- aavev3
- compoundv2
- makerdao
default: aavev2
required: true
responses:
'200':
description: '200'
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
default: 0
title:
type: string
example: OK
description:
type: string
example: Successful request
payload:
type: object
properties:
metadata:
type: object
properties:
next:
type: string
example: https://api.amberdata.com/defi/lending/aavev3/governance?cursor=N4IgRgNg9gxg1jAFgQwJYDsCSATEAuEARhgE5SA2EgBnIFYAzGbY%2BkAGhAAcAnKAF1hQIOfCGTIAbgFMJAZnYg%2BqALZSAYlG7LkfUYgCu29ACUpybMkhSF2VNykwlUdKICCAZQDCCgM59k3HwAIjrWeITkACyEtAAc5ADssrRUqRxS6NghfGERkbJJsgBM5LGpVBw%2BqABeYSDyHPSa2roEAFY%2BzgqcyADmuRyaqL0YyBDu-oHZuVGEVIQJsUXlFSBDI%2BhjAKKZ0-h5BbLFpeUcEMh%2BACoqUn7Iypz7s3GJyWcXfAAyUL2YmVIAD3wRRK7z8AAVeJwoD4xiICLRIiAAL5AA
data:
type: array
items:
type: object
properties:
action:
type: string
example: Proposal
proposalId:
type: string
example: '54'
timestamp:
type: string
example: 2022-01-06 07:07:31 000
title:
type: string
example: Risk Parameter Updates 2021-12-29
shortDescription:
type: string
example: Risk parameter updates
ipfsHash:
type: string
example: QmZc8PLPsfT98kiVuECZDYh4nJgjwSgthNNBNhGz5kCTfZ
creator:
type: string
example: '0x683a4f9915d6216f73d6df50151725036bd26c02'
deprecated: false
tags:
- Lending
/lending/protocols/information:
get:
summary: Information - Lending Protocols
description: This API lists the supported DeFi lending protocols and provides snapshots of aggregate metrics.
operationId: defi-lending-information-protocols
parameters:
- name: blockchain
in: query
description: The blockchainId or blockchain slug to filter results by
schema:
type: string
enum:
- ethereum-mainnet
- polygon-mainnet
- avalanche-mainnet
- arbitrum-mainnet
- optimism-mainnet
- name: protocol
in: query
description: The protocol to filter results by
schema:
type: string
enum:
- makerdao
- compound
- compoundv2
- aave
- aavev2
- aavev3
- name: endDate
in: query
description: '**[Optional]** If provided, returns the associated state of this protocol up to the specified date.
**[Examples]** `2023-01-01`'
schema:
type: string
responses:
'200':
description: '200'
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
default: 0
title:
type: string
example: OK
description:
type: string
example: Successful request
payload:
type: array
items:
type: object
properties:
protocolId:
type: string
example: aavev2
protocolName:
type: string
example: aave
protocolVersion:
type: string
example: v2
blockchain:
type: string
example: ethereum-mainnet
numAssets:
type: integer
example: 37
default: 0
totalDepositedUSD:
type: number
example: 2450326532.6253276
default: 0
totalCollateralUSD:
type: number
example: 2411068465.347387
default: 0
totalBorrowedUSD:
type: number
example: 601548244.8033507
default: 0
deprecated: false
tags:
- Lending
/lending/assets/information:
get:
summary: Information - Assets in Lending Protocols
description: This API lists the supported assets across the available lending protocols and provides snapshots of aggregate metrics.
operationId: defi-lending-information-assets
parameters:
- name: blockchain
in: query
description: The blockchainId or blockchain slug to filter results by
schema:
type: string
enum:
- ethereum-mainnet
- polygon-mainnet
- avalanche-mainnet
- arbitrum-mainnet
- optimism-mainnet
- name: protocol
in: query
description: The protocol to filter results by
schema:
type: string
enum:
- makerdao
- compound
- compoundv2
- compoundv3
- aave
- aavev2
- aavev3
- name: asset
in: query
description: The asset id or symbol to filter the results by.
schema:
type: string
- name: market
in: query
description: The market id or name to filter the results by.
schema:
type: string
- name: endDate
in: query
description: '**[Optional]** If provided, returns the associated state of this asset up to the specified date since the first transaction involving this asset.
If not specified, returns the **current** (now) state of the asset since the first transaction involving the asset.
**[Examples]** `2023-01-01`'
schema:
type: string
responses:
'200':
description: '200'
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
default: 0
title:
type: string
example: OK
description:
type: string
example: Successful request
payload:
type: array
items:
type: object
properties:
protocolId:
type: string
example: aavev2
protocolName:
type: string
example: aave
protocolVersion:
type: string
example: v2
blockchain:
type: string
example: ethereum-mainnet
assetId:
type: string
example: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599'
assetSymbol:
type: string
example: WBTC
market:
type: string
example: main
decimals:
type: integer
example: 8
default: 0
borrowRateStable:
type: number
example: 0.04319282678448013
default: 0
borrowRateVariable:
type: number
example: 0.005277130713792051
default: 0
lendRate:
type: number
example: 0.000181012705707908
default: 0
totalDepositedUSD:
type: number
example: 588524548.0301714
default: 0
totalCollateralUSD:
type: number
example: 588062085.8247572
default: 0
totalBorrowedUSD:
type: number
example: 50467940.46065201
default: 0
totalLiquidationsUSD:
type: number
example: 224678377.90751523
default: 0
loanToValueRatio:
type: number
example: 0.72
default: 0
isActive:
type: boolean
example: true
default: true
deprecated: false
tags:
- Lending
/lending/{protocolId}/metrics/summary:
get:
summary: Lending Protocol Summary Metrics
description: This API provides aggregated insights into the lending protocols.
operationId: lending-protocol-metrics-summary
parameters:
- name: protocolId
in: path
schema:
type: string
enum:
- aavev2
- aavev3
- makerdao
- compoundv2
default: aavev3
required: true
- name: startDate
in: query
description: '**[Optional]** Payload only includes data after this date (inclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`'
schema:
type: string
format: date-time
- name: endDate
in: query
description: '**[Optional]** Payload only includes data before this date (exclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`'
schema:
type: string
format: date-time
- name: timeFormat
in: query
description: '**[Optional]** Time format of the timestamps in the return payload.'
schema:
type: string
enum:
- milliseconds
- ms
- iso
- iso8601
- hr
- human_readable
default: hr
- name: x-amberdata-blockchain-id
in: header
description: '**[Optional]** The id of the blockchain for which you want data from. Defaults to `ethereum-mainnet` if not specified. Use the [Information Protocols](https://docs.amberdata.io/reference/defi-lending-information-protocols) API to view the supported protocol and blockchain id combinations.'
schema:
type: string
enum:
- ethereum-mainnet
- polygon-mainnet
- avalanche-mainnet
- arbitrum-mainnet
- optimism-mainnet
responses:
'200':
description: '200'
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
title:
type: string
example: OK
description:
type: string
example: Successful request
payload:
type: object
properties:
data:
type: object
properties:
metrics:
type: array
items:
type: object
properties:
timestamp:
type: string
example: 2023-04-15 23:59:59 999
totalDepositedUSD:
type: number
example: 6222493181.885701
totalBorrowedUSD:
type: number
example: 1823899948.8358312
cumulativeLiquidatedUSD:
type: number
example: 1191296637.9286466
cumulativeProtocolRevenueUSD:
type: number
example: 37393417.20677932
cumulativeInterestAccumulatedUSD:
type: number
example: 306905185.2241058
intervalProtocolRevenueUSD:
type: number
example: 19426.00786467653
intervalInterestAccumulatedUSD:
type: number
example: 129690.42546114429
intervalNumberOfDeposits:
type: integer
example: 194
intervalNumberOfWithdraws:
type: integer
example: 167
intervalNumberOfRepays:
type: integer
example: 84
intervalNumberOfBorrows:
type: integer
example: 135
intervalNumberOfLiquidations:
type: integer
example: 0
intervalNumberOfUsers:
type: integer
example: 184
intervalDepositedUSD:
type: number
example: 76866301.15099154
intervalWithdrawnUSD:
type: number
example: 54899588.095887944
intervalRepaidUSD:
type: number
example: 27420866.29421422
intervalBorrowedUSD:
type: number
example: 30527102.567837324
intervalLiquidatedUSD:
type: number
example: 0
intervalFlashLoanedUSD:
type: number
example: 4162717.1348569775
deprecated: false
tags:
- Lending
/lending/{protocolId}/assets/{assetId}/metrics/summary:
get:
summary: Lending Asset Summary Metrics
description: This API provides aggregated insights into the asset markets across various lending protocols.
operationId: lending-asset-summary-metrics
parameters:
- name: protocolId
in: path
schema:
type: string
enum:
- aavev2
- aavev3
- compoundv2
- makerdao
default: aavev3
required: true
- name: startDate
in: query
description: '**[Optional]** Payload only includes data after this date (inclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`'
schema:
type: string
format: date-time
- name: endDate
in: query
description: '**[Optional]** Payload only includes data before this date (exclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`'
schema:
type: string
format: date-time
- name: timeFormat
in: query
description: '**[Optional]** Time format of the timestamps in the return payload.'
schema:
type: string
enum:
- milliseconds
- ms
- iso
- iso8601
- hr
- human_readable
default: hr
- name: x-amberdata-blockchain-id
in: header
description: '**[Optional]** The id of the blockchain for which you want data from. Defaults to `ethereum-mainnet` if not specified. Use the [Information Protocols](https://docs.amberdata.io/reference/defi-lending-information-protocols) API to view the supported protocol and blockchain id combinations.'
schema:
type: string
enum:
- ethereum-mainnet
- avalanche-mainnet
- arbitrum-mainnet
- optimism-mainnet
- name: assetId
in: path
description: '**[Examples]** `USDC | WETH`. The requested asset must exist on the specified protocol.'
schema:
type: string
default: WETH
required: true
- name: market
in: query
description: '**[Optional]** Applies only when `protocolId = makerdao`. Get only the aggregate data for the specific asset market.'
schema:
type: string
responses:
'200':
description: '200'
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
title:
type: string
example: OK
description:
type: string
example: Successful request
payload:
type: object
properties:
data:
type: object
properties:
metrics:
type: array
items:
type: object
properties:
timestamp:
type: string
example: 2023-01-27 23:59:59 999
totalDepositedUSD:
type: number
example: 798407.1054579312
totalBorrowedUSD:
type: number
example: 693408.5213470148
cumulativeLiquidatedUSD:
type: number
example: 0
intervalDepositedUSD:
type: number
example: 802410.1450574565
intervalWithdrawnUSD:
type: number
example: 4025.045964467924
intervalRepaidUSD:
type: number
example: 28431.264610794253
intervalBorrowedUSD:
type: number
example: 721813.6375024171
intervalLiquidatedUSD:
type: number
example: 0
intervalFlashLoanedUSD:
type: number
example: 0
deprecated: false
tags:
- Lending
/lending/{protocolId}/wallets/{address}/portfolio:
get:
summary: Track Positions - Lending Wallets
description: This API retrieves the balances of a given address within supported lending protocols.
operationId: track-positions-lending-wallet
parameters:
- name: protocolId
in: path
schema:
type: string
enum:
- aavev2
- aavev3
- compoundv2
- compoundv3
- makerdao
default: aavev3
required: true
- name: x-amberdata-blockchain-id
in: header
description: '**[Optional]** The id of the blockchain for which you want protocol data from. Defaults to `ethereum-mainnet` if not specified. Use the [Information Protocols](https://docs.amberdata.io/reference/defi-lending-information-protocols) API to view the supported protocol and blockchain id combinations.'
required: true
schema:
type: string
enum:
- ethereum-mainnet
- polygon-mainnet
- avalanche-mainnet
- arbitrum-mainnet
- optimism-mainnet
default: polygon-mainnet
- name: address
in: path
description: The address for which the portfolio summary is desired. Example address is for `aavev3` plus `polygon-mainnet` **only**.
schema:
type: string
default: '0x884d6fa3a4b349880486ad4d7c833ca968c785d8'
required: true
- name: timeFormat
in: query
description: '**[Optional]** Time format of the timestamps in the return payload.'
schema:
type: string
enum:
- milliseconds
- ms
- iso
- iso8601
- hr
- human_readable
default: hr
- name: endDate
in: query
description: '**[Optional]** If provided, returns the balances of the address at this date. Enables historical look-back of the portfolio.
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`
**[Warning]** Cannot be combined with `blockNumber`, use only one, either `endDate` or `blockNumber`.'
schema:
type: string
- name: blockNumber
in: query
description: '**[Optional]** If provided, returns the balances of the address when this block was finalized. Enables historical look-back of the portfolio.
**[Warning]** Cannot be combined with `endDate`, use only one, either `blockNumber` or `endDate`.'
schema:
type: integer
format: int32
responses:
'200':
description: '200'
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
default: 0
title:
type: string
example: OK
description:
type: string
example: Successful request
payload:
type: object
properties:
metadata:
type: object
properties:
next:
type: string
example: null
data:
type: object
properties:
timestamp:
type: string
example: 2022-11-07 20:02:00 000
totalLiquidityETH:
type: number
example: 1.960386955045967
default: 0
totalLiquidityUSD:
type: number
example: 3141.9905883303727
default: 0
totalCollateralETH:
type: number
example: 1.960386955045967
default: 0
totalCollateralUSD:
type: number
example: 3141.9905883303727
default: 0
totalBorrowedETH:
type: number
example: 0.8354476352995496
default: 0
totalBorrowedUSD:
type: number
example: 1339.005343
default: 0
availableToBorrowETH:
type: number
example: 0.5745894213541245
default: 0
availableToBorrowUSD:
type: number
example: 920.9174491811094
default: 0
netWorthETH:
type: number
example: 1.1249393197464175
default: 0
netWorthUSD:
type: number
example: 1802.985245330373
default: 0
lifetimeRewardsETH:
type: integer
example: 0
default: 0
lifetimeRewardsUSD:
type: integer
example: 0
default: 0
unclaimedRewardsETH:
type: integer
example: 0
default: 0
unclaimedRewardsUSD:
type: integer
example: 0
default: 0
healthFactor:
type: number
example: 1.805087884251727
default: 0
loanToValueRatio:
type: number
example: 0.719264659981688
default: 0
liquidationThresholdRatio:
type: number
example: 0.769264659981688
default: 0
positions:
type: array
items:
type: object
properties:
assetId:
type: string
example: '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6'
assetSymbol:
type: string
example: WBTC
positionType:
type: string
example: Lend
isCollateral:
type: boolean
example: true
default: true
loanToValueRatio:
type: number
example: 0.7
default: 0
liquidationThresholdRatio:
type: number
example: 0.75
default: 0
amountNative:
type: number
example: 0.09259605
default: 0
amountUSD:
type: number
example: 1931.4029813334043
default: 0
interestRateAPY:
type: number
example: 0.00035615996484214454
default: 0
interestRateType:
type: string
example: Stable
deprecated: false
tags:
- Lending
/lending/wallets/{walletAddress}/returns:
get:
summary: Profit & Loss Analytics in DeFi Lending
description: Analyze a wallet's historical yield, net worth and interest owed from lending and borrowing assets across different DeFi protocols.
operationId: profit-and-loss-analytics-in-defi-lending
parameters:
- name: walletAddress
in: path
description: The address to analyze.
**Note** Across different blockchains, a single user will most likely have different addresses i.e. the address on ethereum-mainnet will not be the same address on avalanche-mainnet.
schema:
type: string
default: '0x884d6fa3a4b349880486ad4d7c833ca968c785d8'
required: true
- name: startDate
in: query
description: '**[Optional]** Payload only includes data after this date (inclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`'
schema:
type: string
format: date-time
- name: endDate
in: query
description: '**[Optional]** Payload only includes data after this date (inclusive).
**[Formats]** `seconds | milliseconds | iso8601`
**[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`'
schema:
type: string
format: date-time
- name: x-amberdata-blockchain-id
in: header
description: '**[Optional]** The id of the blockchain for which you want data from. Defaults to `ethereum-mainnet` if not specified.'
schema:
type: string
enum:
- ethereum-mainnet
- avalanche-mainnet
- arbitrum-mainnet
- optimism-mainnet
- name: timeFormat
in: query
description: '**[Optional]** Time format of the timestamps in the return payload.'
schema:
type: string
enum:
- milliseconds
- ms
- iso
- iso8601
- hr
- human_readable
default: hr
responses:
'200':
description: '200'
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
title:
type: string
example: OK
description:
type: string
example: Successful request
payload:
type: object
properties:
metadata:
type: object
properties:
blockchainId:
type: string
example: ethereum-mainnet
data:
type: object
properties:
metrics:
type: array
items:
type: object
properties:
timestamp:
type: string
example: 2023-02-01 23:59:59 999
totalLiquidityUSD:
type: number
example: 8656.285473022097
totalCollateralUSD:
type: number
example: 4358.700898606331
totalBorrowedUSD:
type: number
example: 0
netWorthUSD:
type: number
example: 8656.285473022097
changeInLendInterestUSD:
type: number
example: 0.5259982184550633
changeInBorrowInterestUSD:
type: number
example: 0.0014350103195127153
marketValueLendInterestUSD:
type: number
example: 0.3368423914981944
marketValueBorrowInterestUSD:
type: number
example: 0
cumulativeLendInterestUSD:
type: number
example: 19.6001513365206
cumulativeBorrowInterestUSD:
type: number
example: 0.049160105311165075
netWorthInProtocols:
type: array
items:
type: object
properties:
protocolId:
type: string
example: aavev2
totalLiquidityUSD:
type: number
example: 4358.700898606331
totalCollateralUSD:
type: number
example: 4358.700898606331
totalBorrowedUSD:
type: number
example: 0
netWorthUSD:
type: number
example: 4358.700898606331
changeInLendInterestUSD:
type: number
example: 0.3338916490191206
changeInBorrowInterestUSD:
type: number
example: 0.0014350103195127153
marketValueLendInterestUSD:
type: number
example: 0.18517998485067053
marketValueBorrowInterestUSD:
type: number
example: 0
cumulativeLendInterestUSD:
type: number
example: 11.058956431389353
cumulativeBorrowInterestUSD:
type: number
example: 0.049160105311165075
deprecated: false
tags:
- Lending
components:
securitySchemes:
sec0:
type: apiKey
in: header
x-default: API_KEY
name: x-api-key
x-readme:
headers: []
explorer-enabled: true
proxy-enabled: true
x-readme-fauxas: true