đŸ’ŗPortfolio

Quick introduction into our portfolio endpoints.

Fetch is the endpoints you will use in most case, to fetch all assets owned by an address.

Request

https://portfolio-api-public.sonar.watch/v1/portfolio/fetch?useCache=false&address=tEsT1vjsJeKHw9GH5HpnQszn2LWmjR6q1AVCDCj51nd&addressSystem=solana

Here is how this endpoint works,

First it requires an Address in a valid format :

address=tEsT1vjsJeKHw9GH5HpnQszn2LWmjR6q1AVCDCj51nd

Second it requires the AddressSystem of the address (EVM, Solana, Move, etc...) :

addressSystem=solana

Finally you can specify is you wish to use our Cache :

useCache=false

This request will give you a lot of information in returns, let's take a look at it.

Response

First come the timestamp of the fetch, this can be useful in case your using the useCache parameters to true, you will know when those data were fetched.

"date": 1705569483643,

Then you will see a list of fetcherReports, this is the amount of time each Fetchers took to scan the blockchain and look for any positions/assets the address owns.

 "fetcherReports": [
    {
      "id": "wallet-tokens-solana",
      "status": "succeeded",
      "duration": 2563
    },
    {
      "id": "wallet-tokens-solana-native",
      "status": "succeeded",
      "duration": 374
    },
    {
      "id": "wallet-tokens-solana-nfts-underlyings",
      "status": "succeeded",
      "duration": 706
    },

Next comes a list of elements, they represent groups of assets/positions owned by the address, let's take a look at one of those elements :

{
    "type": "borrowlend",
    "networkId": "solana",
    "platformId": "solend",
    "label": "Lending",
    "value": 1.0374513713300928,
    "name": "Main",
    "data": {
        "borrowedAssets": [],
        "borrowedValue": 0,
        "borrowedYields": [],
        "suppliedAssets": [
            {
                "type": "token",
                "networkId": "solana",
                "value": 0.5289251742095228,
                "data": {
                    "address": "SoLEao8wTzSfqhuou8rcYsVoLjthVmiXuEjzdNPMnCz",
                    "amount": 0.004999999017462565,
                    "price": 105.78505562946
                },
                "attributes": {}
            },
            {
                "type": "token",
                "networkId": "solana",
                "value": 0.4418149814241555,
                "data": {
                    "address": "2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf",
                    "amount": 0.39999985323165227,
                    "price": 1.10453785883838
                },
                "attributes": {}
            },
            {
                "type": "token",
                "networkId": "solana",
                "value": 0.04185465624342865,
                "data": {
                    "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
                    "amount": 0.04187194935851372,
                    "price": 0.999587
                },
                "attributes": {}
            },
            {
                "type": "token",
                "networkId": "solana",
                "value": 0.014371347487876853,
                "data": {
                    "address": "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",
                    "amount": 0.00012300023526084263,
                    "price": 116.84
                },
                "attributes": {}
            },
            {
                "type": "token",
                "networkId": "solana",
                "value": 0.010485211965109084,
                "data": {
                    "address": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
                    "amount": 0.010504603463101971,
                    "price": 0.998154
                },
                "attributes": {}
            }
        ],
        "suppliedValue": 1.0374513713300928,
        "suppliedYields": [
            [
                {
                    "apr": 0,
                    "apy": 0
                }
            ],
            [
                {
                    "apr": 0.058423950740065234,
                    "apy": 0.06015940130311925
                }
            ],
            [
                {
                    "apr": 0.05603231269402542,
                    "apy": 0.057627309879028976
                }
            ],
            [
                {
                    "apr": 0,
                    "apy": 0
                }
            ],
            [
                {
                    "apr": 0,
                    "apy": 0
                }
            ]
        ],
        "collateralRatio": null,
        "healthRatio": 1,
        "rewardAssets": [],
        "value": 1.0374513713300928
    }
},

This represent a group of lent assets (type = borrowlend) on Solend platform (platformId = solend) on Solana network (networkId = solana), the name of the element is Main (name = Main) and the total USD value of this element is $1.03 .

Inside the data object you will find the list of assets deposited in the platform which follow the format of BorrowLend type. Learn more about the PortfolioElementBorrowLendData type.

The fetch endpoint is not limited to 1 network, if you fetch an EVM address, it will return all assets on all EVM networks we support.

This endpoint will only returns the assets owned by the address on a specific network, instead of having an addressSystem parameter, you will have to provide a networkId value instead.

NetworkIds can be found using the networks endpoint.

This endpoint can be useful to fetch only the tokens currently owned by the address which did not left the wallet.

It can be used the same way as the fetch endpoint, with an address, an addressSystem and a useCache param.

Those endpoints allows you to know which platform & networks we currently support.

Last updated