Links

0x_portfolio

Get the account's positions and assets in the 0x protocol.
You can specify the account address and then you can query the account's Staked assets in the 0x protocol. Using this API, you are able to acknowledge the detailed information like staked token infos and USD amount of each token as well as the sections. Some DeFi investigations and strategies can be made by calling this API.
Supported on Ethereum.

Parameters

Object - An object with the following fields (required):
  • protocol(string, optional) - "0x", If you don't specify the protocol, the API can return position data for all supported DeFi protocols.
  • accountAddress(hex string, required) - The account you intend to check.

Returns

Object - An object with the following fields:
  • id(integer number) - json-rpc id.
  • jsonrpc(string) - json-rpc version.
  • result(object) - an object with the following fields:
    • data(object array, defined below) - response datas of the portfolioItemObject, click to view the detailed object description.

Example

Request

curl
TypeScript
curl --location --request POST 'https://apis.blockvision.org/v1/<api key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 1,
"jsonrpc": "2.0",
"method": "account_defiPortfolio",
"params": {
"protocol":"0x",
"accountAddress": "0xe1bdcd3b70e077d2d66adcbe78be3941f0bf380b"
}
}'
import { BlockvisionProvider, BvNetwork } from 'blockvision-sdk'
​
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockvisionProvider(BvNetwork['ETH_MAINNET'])
​
// Access the BlockVision DeFi API
bv.getAccountDeFiPortfolio({
protocol: '0x',
accountAddress: '0xe1bdcd3b70e077d2d66adcbe78be3941f0bf380b'
}).then(console.log)

Result

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"data": [
{
"websiteUrl": "https://www.0x.org",
"logo": "https://apis.blockvision.org/static/img/logo/zrx.png",
"protocol": "0x",
"proxy": "",
"usdAmount": "2293484",
"positionInfos": [
{
"logo": "https://apis.blockvision.org/static/img/logo/zrx.png",
"contractAddress": "0xba7f8b5fb1b19c1211c5d49550fcd149177a5eaf",
"symbol": "ZRX",
"usdValue": "2293484",
"section": "Staked",
"balanceTokens": [
{
"contractAddress": "0xe41d2489571d322189246dafa5ebde1f4699f498",
"symbol": "ZRX",
"balance": "9150000.00",
"usdValue": "2293484"
}
]
}
]
}
]
}
}