Skip to content

Commit ef0d9bd

Browse files
feat: update TM grades, price prediction, and market metrics endpoints for v3 API
- Add slug parameter to tm-grades and tm-grades-historical endpoints - Rename scenario-analysis to price-prediction endpoint - Update SCENARIO_ANALYSIS constant to PRICE_PREDICTION in constants - Add token_name and slug parameters to price-prediction endpoint - Update getPricePrediction method name in token_metrics.app.mjs - Update market-metrics component version to 0.1.0 - Remove old scenario-analysis directory after migration - Update all affected component versions to 0.1.0
1 parent 593acd6 commit ef0d9bd

File tree

6 files changed

+43
-15
lines changed

6 files changed

+43
-15
lines changed

components/token_metrics/actions/get-market-metrics/get-market-metrics.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
key: "token_metrics-get-market-metrics",
1111
name: "Get Market Metrics",
1212
description: `${endpoint.description}. [See the documentation](https://developers.tokenmetrics.com/reference/market-metrics)`,
13-
version: "0.0.2",
13+
version: "0.1.0",
1414
type: "action",
1515
props: {
1616
tokenMetrics,

components/token_metrics/actions/get-scenario-analysis/get-scenario-analysis.mjs renamed to components/token_metrics/actions/get-price-prediction/get-price-prediction.mjs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import {
44
buildParams, generateFilterSummary,
55
} from "../../common/utils.mjs";
66

7-
const endpoint = ENDPOINTS.SCENARIO_ANALYSIS;
7+
const endpoint = ENDPOINTS.PRICE_PREDICTION;
88

99
export default {
10-
key: "token_metrics-get-scenario-analysis",
11-
name: "Get Scenario Analysis",
12-
description: `${endpoint.description}. [See the documentation](https://developers.tokenmetrics.com/reference/scenario-analysis)`,
13-
version: "0.0.1",
10+
key: "token_metrics-get-price-prediction",
11+
name: "Get Price Prediction",
12+
description: `${endpoint.description}. [See the documentation](https://developers.tokenmetrics.com/reference/price-prediction)`,
13+
version: "0.1.0",
1414
type: "action",
1515
props: {
1616
tokenMetrics,
@@ -21,12 +21,24 @@ export default {
2121
"tokenId",
2222
],
2323
},
24+
tokenName: {
25+
propDefinition: [
26+
tokenMetrics,
27+
"tokenName",
28+
],
29+
},
2430
symbol: {
2531
propDefinition: [
2632
tokenMetrics,
2733
"symbol",
2834
],
2935
},
36+
slug: {
37+
propDefinition: [
38+
tokenMetrics,
39+
"slug",
40+
],
41+
},
3042
// Pagination props
3143
limit: {
3244
propDefinition: [
@@ -49,7 +61,7 @@ export default {
4961
// Build parameters using utility function
5062
const params = buildParams(this, endpoint.filters);
5163

52-
const response = await this.tokenMetrics.getScenarioAnalysis({
64+
const response = await this.tokenMetrics.getPricePrediction({
5365
$,
5466
params,
5567
});
@@ -59,7 +71,7 @@ export default {
5971

6072
// Use $ context for export
6173
const dataLength = response.data?.length || 0;
62-
$.export("$summary", `Successfully retrieved scenario analysis for ${dataLength} tokens${filterSummary}`);
74+
$.export("$summary", `Successfully retrieved price prediction for ${dataLength} tokens${filterSummary}`);
6375

6476
return response;
6577
},

components/token_metrics/actions/get-tm-grades-historical/get-tm-grades-historical.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
key: "token_metrics-get-tm-grades-historical",
1111
name: "Get TM Grades Historical",
1212
description: `${endpoint.description}. [See the documentation](https://developers.tokenmetrics.com/reference/tm-grade-history)`,
13-
version: "0.0.1",
13+
version: "0.1.0",
1414
type: "action",
1515
props: {
1616
tokenMetrics,
@@ -34,6 +34,12 @@ export default {
3434
"symbol",
3535
],
3636
},
37+
slug: {
38+
propDefinition: [
39+
tokenMetrics,
40+
"slug",
41+
],
42+
},
3743
startDate: {
3844
propDefinition: [
3945
tokenMetrics,

components/token_metrics/actions/get-tm-grades/get-tm-grades.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
key: "token_metrics-get-tm-grades",
1111
name: "Get TM Grades",
1212
description: `${endpoint.description}. [See the documentation](https://developers.tokenmetrics.com/reference/tm-grade)`,
13-
version: "0.0.1",
13+
version: "0.1.0",
1414
type: "action",
1515
props: {
1616
tokenMetrics,
@@ -34,6 +34,12 @@ export default {
3434
"symbol",
3535
],
3636
},
37+
slug: {
38+
propDefinition: [
39+
tokenMetrics,
40+
"slug",
41+
],
42+
},
3743
// Pagination props
3844
limit: {
3945
propDefinition: [

components/token_metrics/common/constants.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export const ENDPOINTS = {
8181
"token_id",
8282
"token_name",
8383
"symbol",
84+
"slug",
8485
],
8586
},
8687
TM_GRADES_HISTORICAL: {
@@ -90,6 +91,7 @@ export const ENDPOINTS = {
9091
"token_id",
9192
"token_name",
9293
"symbol",
94+
"slug",
9395
"start_date",
9496
"end_date",
9597
],
@@ -201,12 +203,14 @@ export const ENDPOINTS = {
201203
"fdv",
202204
],
203205
},
204-
SCENARIO_ANALYSIS: {
205-
path: "/scenario-analysis",
206-
description: "Get the price prediction based on different Crypto Market scenario",
206+
PRICE_PREDICTION: {
207+
path: "/price-prediction",
208+
description: "Get price prediction of a crypto asset under different market cap scenarios",
207209
filters: [
208210
"token_id",
211+
"token_name",
209212
"symbol",
213+
"slug",
210214
],
211215
},
212216
CORRELATION: {

components/token_metrics/token_metrics.app.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,13 +423,13 @@ export default {
423423
params,
424424
});
425425
},
426-
async getScenarioAnalysis({
426+
async getPricePrediction({
427427
$ = this,
428428
params = {},
429429
}) {
430430
return this.makeApiCall({
431431
$,
432-
endpoint: "/scenario-analysis",
432+
endpoint: "/price-prediction",
433433
params,
434434
});
435435
},

0 commit comments

Comments
 (0)