Holding Cost Trend
Description
Returns holding cost data for a specified address and token on the blockchain. Supports querying cost changes over a time range by specifying the token, chain, and time period.
Use cases:
- Track holding cost changes for a specific address
- Analyze cost basis ranges for position building
- Evaluate holding strategy and cost management of an address
Update frequency: Updated once per day
Endpoint
- Method:
POST - Path:
/open/v1/chain/trade/token/holdTrend
Credits
- Cost:
2
Prerequisites
Obtain vsTokenId
| Condition | Description | How to obtain |
|---|---|---|
| vsTokenId available | Use cached vsTokenId; no repeat lookup | Auto-extracted from context |
| vsTokenId missing | Call POST /vs-token/list | Prerequisite API call |
Obtain coinKey
| Condition | Description | How to obtain |
|---|---|---|
| coinKey available | Use cached coinKey; no repeat lookup | Auto-extracted from context |
| coinKey missing | Call POST /vs-token/detail to get coinKey for each chain | Prerequisite API call |
Obtain address
| Condition | Description | How to obtain |
|---|---|---|
| address available | Use known holding address | User input |
| address missing | Call POST /chain/trade/token/holdPage to query holding address list | Prerequisite API call |
Request parameters
Parameters are sent as JSON in the request body.
| Field | Type | Required | Description |
|---|---|---|---|
| vsTokenId | long | Yes | Token ID |
| coinKey | string | Yes | Token coinKey (chain + contract address); obtain from token details |
| address | string | Yes | Address |
| startTime | long | No | Start time (millisecond timestamp) |
| endTime | long | Yes | End time (millisecond timestamp) |
Response fields
Structure of each object in the data array:
| Field | Type | Serialized | Description |
|---|---|---|---|
| vsTokenId | long | string | Token ID |
| symbol | string | string | Token symbol |
| name | string | string | Token name |
| date | long | long | Time (millisecond timestamp) |
| balance | number | string | Balance |
| holding | number | string | Holding cost |
| holdingPrice | number | string | Holding price |
| price | number | string | Token price |
Field semantics
| Field | Meaning | Tip |
|---|---|---|
| holding | Holding cost | Average buy cost for tokens at this address; used to calculate P&L |
| holdingPrice | Holding price | Price metric derived from holding cost |
Example
json
{
"vsTokenId": 1, // Token ID
"coinKey": "BTC_BTC", // Token coinKey (chain + contract address); obtain from token details
"address": "3M219KR5vEneNb47ewrPfWyb5jQ2DjxRP6", // Address
"endTime": 1773479265534 // End time
}cURL (Linux/macOS)
bash
curl --location --request POST 'http://${host}/api/open/v1/chain/trade/token/holdTrend' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: xxxxx' \
--header 'X-TIMESTAMP: xxxxx' \
--header 'X-SIGN: xxxxx' \
--header 'Accept: */*' \
--data-raw '{
"vsTokenId": 1,
"coinKey": "BTC_BTC",
"address": "3M219KR5vEneNb47ewrPfWyb5jQ2DjxRP6",
"endTime": 1773479265534
}'cURL (Windows CMD)
cmd
curl --location --request POST "http://${host}/api/open/v1/chain/trade/token/holdTrend" ^
--header "Content-Type: application/json" ^
--header "X-API-KEY: xxxxx" ^
--header "X-TIMESTAMP: xxxxx" ^
--header "X-SIGN: xxxxx" ^
--header "Accept: */*" ^
--data-raw "{ \"vsTokenId\": 1, \"coinKey\": \"BTC_BTC\", \"address\": \"3M219KR5vEneNb47ewrPfWyb5jQ2DjxRP6\", \"endTime\": 1773479265534}"Success response example
json
{
"code": 200,
"message": "success",
"data": [
{
"vsTokenId": "1", // Token ID
"symbol": "BTC", // Token symbol
"name": "Bitcoin", // Token name
"date": 1542038400000, // Time
"balance": "0", // Balance
"holding": "0", // Holding cost
"holdingPrice": "0", // Holding price
"price": "6359.49" // Token price
},
{
"vsTokenId": "1",
"symbol": "BTC",
"name": "Bitcoin",
"date": 1542124800000,
"balance": "1",
"holding": "5738.35",
"holdingPrice": "5738.35",
"price": "5738.35"
},
{
"vsTokenId": "1",
"symbol": "BTC",
"name": "Bitcoin",
"date": 1542211200000,
"balance": "0",
"holding": "0",
"holdingPrice": "0",
"price": "5648.03"
}
// ... more data omitted
],
"requestId": "xxx-xxx-xxx"
}