> ## Documentation Index
> Fetch the complete documentation index at: https://docs.amberdata.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Profit & Loss Analytics in DeFi Lending

> Analyze a wallet's historical yield, net worth and interest owed from lending and borrowing assets across different DeFi protocols.



## OpenAPI

````yaml get /lending/wallets/{walletAddress}/returns
openapi: 3.1.0
info:
  title: Defi API
  version: '2'
servers:
  - url: https://api.amberdata.com/defi
security:
  - sec0: []
paths:
  /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. <BR><BR>**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).<BR>**[Formats]** `seconds | milliseconds |
            iso8601`<BR>**[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).<BR>**[Formats]** `seconds | milliseconds |
            iso8601`<BR>**[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
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      x-default: API_KEY
      name: x-api-key

````