Asset Sentiment Comparison
Track and compare sentiment metrics across multiple crypto assets to identify potential market trends and opportunities. IN THIS RECIPE- Instantiate Client
- Fetch Sentiment Data
- Compare Results
Overview Code Example
This is the initial code snippet to get started:Example Output
When you run this code, you’ll see output similar to:Installation
For the latest version of the Messari SDK-TS, use:Detailed Recipe Steps
1. Instantiate Client
First, instantiate the MessariSDK
from@messari/sdk-ts
. You’ll need to provide your API key during initialization or set it as an
environment variable.
2. Fetch Sentiment Data
Next, use the client.signal.v0.sentiment.list()
method to
retrieve sentiment data for all tracked assets. You can sort the results
by market cap, rank, or combined sentiment using the sort
parameter.
For specific assets, you can either filter the results from the list
endpoint or use the
client.signal.v0.sentiment.assets.retrieve()
method with a specific
asset ID.
3. Compare Results
The response contains various sentiment metrics for each asset:
- sentimentScore: Overall sentiment (0-100) compared to 20-day baseline
- sentimentMomentumScore: Day-over-day change in sentiment
- positivePostPercent/negativePostPercent: Percentage of positive/negative posts
- tweetVolume: Total number of tweets about the asset in the last 7 days
You can compare these metrics across assets to identify opportunities, such as assets with improving sentiment despite stagnant prices, or extreme sentiment conditions that might signal potential market reversals.
For more details on available sentiment endpoints and metrics, see theSentiment API documentation.