Skip to content

Commit 1b4d96e

Browse files
Eng 8702,eng 8703,eng 8704 (#18072)
* added boiler plate code * added price endpoint action * added hourly ohlcv action * added daily ohlcv endpoint action * added moonshot tokens endpoint action * added tm grades tokens endpoint action * added tm grades historical tokens endpoint action * added fundamental grades tokens endpoint action * added fundamental grades historical tokens endpoint action * added technology grades tokens endpoint action * added technology grades historical tokens endpoint action * added market metrics tokens endpoint action * added ai reports tokens endpoint action * added crypto investors tokens endpoint action * added top market cap tokens endpoint action * added resistance and support tokens endpoint action * added hourly trading signals tokens endpoint action * added quantmetrics tokens endpoint action * added scenario analysis tokens endpoint action * added correlation tokens endpoint action * added indices tokens endpoint action * added indices holdings tokens endpoint action * added indices performance tokens endpoint action * updated readme * Update README.md * feat: improve component documentation and validation - Add markdown formatting to all example values with backticks - Highlight date formats (`YYYY-MM-DD`) in prop descriptions - Add `min: 1` validation to all page props across 19 action files - Remove verbose pagination descriptions in favor of built-in validation - Standardize prop definitions using `propDefinitions` from app file - Convert comma-separated string props to `string[]` type for better UX - Remove redundant `if ($ && $.export)` checks from all actions - Remove custom `try/catch` blocks to leverage Pipedream's native error handling - Clean up `handleApiError` utility function and related imports - Fix prop descriptions to use proper options instead of text descriptions - Update README.md to be more concise and professional per feedback This refactor improves code maintainability, user experience, and follows Pipedream component best practices for validation, error handling, and documentation formatting. * chore: clean up token_metrics component and update dependencies - Remove unused generateEndpointProps function from utils.mjs - Update pnpm-lock.yaml to ensure PR checks run properly - Clean up code by removing dead code that was never imported or used * Update components/token_metrics/actions/get-market-metrics/get-market-metrics.mjs * style: apply code formatting and linting fixes to token_metrics component - Fix import formatting across all action files - Remove trailing whitespace from constants and other files - Add proper newline endings to package.json - Apply consistent spacing and formatting throughout - Improve code readability and maintain style consistency --------- Co-authored-by: Guilherme Falcão <48412907+GTFalcao@users.noreply.github.com>
1 parent e538276 commit 1b4d96e

File tree

30 files changed

+2612
-67
lines changed

30 files changed

+2612
-67
lines changed

components/token_metrics/README.md

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,82 @@
11
# Overview
22

3-
The Token Metrics API offers access to a trove of cryptocurrency data, including analytics, rankings, and predictions that leverage artificial intelligence and expert insights. With this API, you can automate investment strategies, integrate up-to-date crypto data into your applications, and stay informed with the latest market trends. When used on Pipedream, it allows you to build robust, serverless workflows that can react to various triggers and integrate with numerous services for a seamless data handling experience.
3+
The Token Metrics API integration for Pipedream provides comprehensive access to cryptocurrency data, analytics, and AI-powered insights. This component enables seamless integration of advanced token metrics, market analysis, and trading intelligence into your automated workflows.
4+
5+
Token Metrics delivers institutional-grade cryptocurrency analytics, including AI-generated reports, trading signals, fundamental and technical analysis, market metrics, and performance data across thousands of digital assets.
6+
7+
# Key Features
8+
9+
- **Comprehensive Token Data**: Access detailed information for thousands of cryptocurrencies including prices, market metrics, and historical data
10+
- **AI-Powered Analytics**: Leverage AI-generated reports, trading signals, and investment analysis
11+
- **Advanced Grading Systems**: Access TM Grades, Fundamental Grades, and Technology Grades for informed decision-making
12+
- **Market Intelligence**: Get market metrics, correlation analysis, and scenario-based price predictions
13+
- **Professional Indices**: Access crypto indices with holdings and performance data
14+
- **OHLCV Data**: Retrieve hourly and daily Open, High, Low, Close, Volume data
15+
- **Quantitative Metrics**: Advanced quantitative analysis and resistance/support levels
16+
17+
# Authentication
18+
19+
To use the Token Metrics API component, you'll need:
20+
21+
1. A Token Metrics account with API access
22+
2. An API key from your Token Metrics dashboard
23+
24+
The API uses API key authentication via the `x-api-key` header. Your API key should be kept secure and not shared publicly.
25+
26+
## Setup Instructions
27+
28+
1. Sign up for a Token Metrics account at https://www.tokenmetrics.com/api
29+
2. Navigate to your [api keys dashboard](https://app.tokenmetrics.com/en/api?tab=keys) and generate an API key
30+
3. In Pipedream, connect the Token Metrics app using your API key
31+
4. The API key will be automatically included in all requests via the `x-api-key` header
32+
33+
# Available Components
34+
35+
This component provides pre-built actions for all major Token Metrics API endpoints, covering token data, AI-powered analytics, market metrics, trading signals, grading systems, and more. All actions support filtering, pagination, and use API key authentication.
436

537
# Example Use Cases
638

7-
- **Crypto Alert System**: Build a workflow on Pipedream that monitors the Token Metrics API for significant changes in crypto ratings or predictions. When certain thresholds are met, use the integrated Twilio app to send SMS alerts, ensuring you or your audience stay up-to-date on important market movements.
39+
- **Automated Trading Systems**: Monitor AI-generated trading signals and execute automated trades
40+
- **Portfolio Management**: Track cryptocurrency portfolios with comprehensive token metrics and grades
41+
- **Market Research**: Generate detailed investment analysis using AI reports and fundamental data
42+
- **Risk Management**: Monitor market conditions, correlations, and implement risk strategies
43+
- **Price Monitoring**: Track token prices and receive alerts on significant market movements
44+
45+
# API Endpoint
46+
47+
Base URL: `https://api.tokenmetrics.com/v2`
48+
49+
All requests require the `x-api-key` header for authentication.
50+
51+
# Rate Limits & Usage
52+
53+
Please refer to the [Token Metrics API documentation](https://developers.tokenmetrics.com/) for current rate limits, usage guidelines, and pricing information.
54+
55+
# Data Filtering & Pagination
56+
57+
Actions support comprehensive filtering by token identifiers, market criteria, date ranges, and standard pagination controls. See the [Token Metrics API documentation](https://developers.tokenmetrics.com/) for specific filter options.
58+
59+
# Error Handling
60+
61+
The component includes comprehensive error handling for common scenarios:
62+
63+
- **401 Unauthorized**: Invalid or expired API key
64+
- **403 Forbidden**: Insufficient API key permissions
65+
- **429 Rate Limited**: API rate limit exceeded
66+
- **5xx Server Errors**: Token Metrics API server issues
67+
68+
# Support & Resources
69+
70+
## Official Token Metrics Resources
71+
72+
- **API Dashboard**: [app.tokenmetrics.com/en/api](https://app.tokenmetrics.com/en/api) - Manage your API keys and access
73+
- **API Pricing Plans**: [app.tokenmetrics.com/en/api-plans](https://app.tokenmetrics.com/en/api-plans) - View pricing and plan details
74+
- **Token Metrics API Documentation**: [developers.tokenmetrics.com](https://developers.tokenmetrics.com/) - Complete API reference
75+
- **API Support (Telegram)**: [t.me/tokenmetricsapi](https://t.me/tokenmetricsapi) - Developer community and support
76+
- **Contact Us**: [tokenmetrics.com/contact-us](https://www.tokenmetrics.com/contact-us) - General support and inquiries
877

9-
- **Investment Tracker**: Create a Pipedream workflow that pulls daily investment insights and portfolio analytics from the Token Metrics API and logs them to a Google Sheets document. This allows for easy tracking and historical data analysis, helping to refine investment strategies over time.
78+
## Community & Support
1079

11-
- **Market Dashboard Sync**: Use Pipedream to set up a workflow where market data and analytics from the Token Metrics API are fetched periodically and pushed to a real-time dashboard built with Geckoboard. This keeps your team or clients informed with the latest crypto market trends and forecasts.
80+
- **Pipedream Community**: For integration and workflow assistance
81+
- **Component Issues**: Report bugs or request features via the Pipedream platform
82+
- **Email Support**: support@tokenmetrics.com for API-related issues
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import tokenMetrics from "../../token_metrics.app.mjs";
2+
import { ENDPOINTS } from "../../common/constants.mjs";
3+
import {
4+
buildParams, generateFilterSummary,
5+
} from "../../common/utils.mjs";
6+
7+
const endpoint = ENDPOINTS.AI_REPORTS;
8+
9+
export default {
10+
key: "token_metrics-get-ai-reports",
11+
name: "Get AI Reports",
12+
description: `${endpoint.description}. [See the documentation](https://developers.tokenmetrics.com/reference/ai-reports)`,
13+
version: "0.0.1",
14+
type: "action",
15+
props: {
16+
tokenMetrics,
17+
// Filter props using propDefinitions from the app
18+
tokenId: {
19+
propDefinition: [
20+
tokenMetrics,
21+
"tokenId",
22+
],
23+
description: "Select Token IDs to get AI reports for. Example: `37493,3484`",
24+
},
25+
symbol: {
26+
propDefinition: [
27+
tokenMetrics,
28+
"symbol",
29+
],
30+
description: "Select token symbols to get AI reports for. Example: `APX,PAAL`",
31+
},
32+
// Pagination props
33+
limit: {
34+
propDefinition: [
35+
tokenMetrics,
36+
"limit",
37+
],
38+
description: "Limit the number of items in response. Defaults to 50",
39+
default: 50,
40+
},
41+
page: {
42+
propDefinition: [
43+
tokenMetrics,
44+
"page",
45+
],
46+
min: 1,
47+
default: 1,
48+
},
49+
},
50+
async run({ $ }) {
51+
// Build parameters using utility function
52+
const params = buildParams(this, endpoint.filters);
53+
54+
const response = await this.tokenMetrics.getAiReports({
55+
$,
56+
params,
57+
});
58+
59+
// Generate summary using utility function
60+
const filterSummary = generateFilterSummary(this, endpoint.filters);
61+
62+
// Use $ context for export
63+
const dataLength = response.data?.length || 0;
64+
$.export("$summary", `Successfully retrieved AI reports for ${dataLength} tokens${filterSummary}`);
65+
66+
return response;
67+
},
68+
};
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import tokenMetrics from "../../token_metrics.app.mjs";
2+
import { ENDPOINTS } from "../../common/constants.mjs";
3+
import {
4+
buildParams, generateFilterSummary,
5+
} from "../../common/utils.mjs";
6+
7+
const endpoint = ENDPOINTS.CORRELATION;
8+
9+
export default {
10+
key: "token_metrics-get-correlation",
11+
name: "Get Correlation",
12+
description: `${endpoint.description}. [See the documentation](https://developers.tokenmetrics.com/reference/correlation)`,
13+
version: "0.0.1",
14+
type: "action",
15+
props: {
16+
tokenMetrics,
17+
// Filter props based on endpoint configuration and API documentation
18+
tokenId: {
19+
propDefinition: [
20+
tokenMetrics,
21+
"tokenId",
22+
],
23+
},
24+
symbol: {
25+
propDefinition: [
26+
tokenMetrics,
27+
"symbol",
28+
],
29+
},
30+
category: {
31+
propDefinition: [
32+
tokenMetrics,
33+
"category",
34+
],
35+
description: "Select categories to filter results. Example: `layer-1,nft`",
36+
},
37+
exchange: {
38+
propDefinition: [
39+
tokenMetrics,
40+
"exchange",
41+
],
42+
description: "Select exchanges to filter results. Example: `gate,binance`",
43+
},
44+
// Pagination props
45+
limit: {
46+
propDefinition: [
47+
tokenMetrics,
48+
"limit",
49+
],
50+
description: "Limit the number of items in response. Defaults to 50",
51+
default: 50,
52+
},
53+
page: {
54+
propDefinition: [
55+
tokenMetrics,
56+
"page",
57+
],
58+
min: 1,
59+
default: 1,
60+
},
61+
},
62+
async run({ $ }) {
63+
// Build parameters using utility function
64+
const params = buildParams(this, endpoint.filters);
65+
66+
const response = await this.tokenMetrics.getCorrelation({
67+
$,
68+
params,
69+
});
70+
71+
// Generate summary using utility function
72+
const filterSummary = generateFilterSummary(this, endpoint.filters);
73+
74+
// Use $ context for export
75+
const dataLength = response.data?.length || 0;
76+
$.export("$summary", `Successfully retrieved correlation data for ${dataLength} tokens${filterSummary}`);
77+
78+
return response;
79+
},
80+
};
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import tokenMetrics from "../../token_metrics.app.mjs";
2+
import { ENDPOINTS } from "../../common/constants.mjs";
3+
import {
4+
buildParams, generateFilterSummary,
5+
} from "../../common/utils.mjs";
6+
7+
const endpoint = ENDPOINTS.CRYPTO_INVESTORS;
8+
9+
export default {
10+
key: "token_metrics-get-crypto-investors",
11+
name: "Get Crypto Investors",
12+
description: `${endpoint.description}. [See the documentation](https://developers.tokenmetrics.com/reference/crypto-investors)`,
13+
version: "0.0.1",
14+
type: "action",
15+
props: {
16+
tokenMetrics,
17+
// Pagination props
18+
limit: {
19+
propDefinition: [
20+
tokenMetrics,
21+
"limit",
22+
],
23+
description: "Limit the number of items in response. Defaults to 50",
24+
default: 50,
25+
},
26+
page: {
27+
propDefinition: [
28+
tokenMetrics,
29+
"page",
30+
],
31+
min: 1,
32+
default: 1,
33+
},
34+
},
35+
async run({ $ }) {
36+
// Build parameters using utility function
37+
const params = buildParams(this, endpoint.filters);
38+
39+
const response = await this.tokenMetrics.getCryptoInvestors({
40+
$,
41+
params,
42+
});
43+
44+
// Generate summary using utility function
45+
const filterSummary = generateFilterSummary(this, endpoint.filters);
46+
47+
// Use $ context for export
48+
const dataLength = response.data?.length || 0;
49+
$.export("$summary", `Successfully retrieved ${dataLength} crypto investors${filterSummary}`);
50+
51+
return response;
52+
},
53+
};
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import tokenMetrics from "../../token_metrics.app.mjs";
2+
import { ENDPOINTS } from "../../common/constants.mjs";
3+
import {
4+
buildParams, generateFilterSummary,
5+
} from "../../common/utils.mjs";
6+
7+
const endpoint = ENDPOINTS.DAILY_OHLCV;
8+
9+
export default {
10+
key: "token_metrics-get-daily-ohlcv",
11+
name: "Get Daily OHLCV",
12+
description: `${endpoint.description}. [See the documentation](https://developers.tokenmetrics.com/reference/daily-ohlcv)`,
13+
version: "0.0.1",
14+
type: "action",
15+
props: {
16+
tokenMetrics,
17+
// Filter props based on endpoint configuration and screenshot
18+
tokenId: {
19+
propDefinition: [
20+
tokenMetrics,
21+
"tokenId",
22+
],
23+
},
24+
symbol: {
25+
propDefinition: [
26+
tokenMetrics,
27+
"symbol",
28+
],
29+
},
30+
tokenName: {
31+
propDefinition: [
32+
tokenMetrics,
33+
"tokenName",
34+
],
35+
description: "Select crypto asset names to filter results. Example: `Bitcoin`",
36+
},
37+
startDate: {
38+
propDefinition: [
39+
tokenMetrics,
40+
"startDate",
41+
],
42+
description: "Start Date accepts date as a string - `YYYY-MM-DD` format. Note: The Start Date cannot be earlier than the past 30 days from the current date. Example: `2025-01-01`",
43+
},
44+
endDate: {
45+
propDefinition: [
46+
tokenMetrics,
47+
"endDate",
48+
],
49+
description: "End Date accepts date as a string - `YYYY-MM-DD` format. Example: `2025-01-23`",
50+
},
51+
// Pagination props
52+
limit: {
53+
propDefinition: [
54+
tokenMetrics,
55+
"limit",
56+
],
57+
description: "Limit the number of items in response. Defaults to 50",
58+
default: 50,
59+
},
60+
page: {
61+
propDefinition: [
62+
tokenMetrics,
63+
"page",
64+
],
65+
min: 1,
66+
default: 1,
67+
},
68+
},
69+
async run({ $ }) {
70+
// Build parameters using utility function
71+
const params = buildParams(this, endpoint.filters);
72+
73+
const response = await this.tokenMetrics.getDailyOhlcv({
74+
$,
75+
params,
76+
});
77+
78+
// Generate summary using utility function
79+
const filterSummary = generateFilterSummary(this, endpoint.filters);
80+
81+
// Use $ context for export
82+
const dataLength = response.data?.length || 0;
83+
$.export("$summary", `Successfully retrieved ${dataLength} daily OHLCV records${filterSummary}`);
84+
85+
return response;
86+
},
87+
};

0 commit comments

Comments
 (0)