chore: code formatting
This commit is contained in:
@@ -14,17 +14,15 @@ export default async function({login, q, imports, data, account}, {enabled = fal
|
|||||||
console.debug(`metrics/compute/${login}/plugins > crypto > querying api for crypto`)
|
console.debug(`metrics/compute/${login}/plugins > crypto > querying api for crypto`)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: coin
|
data: coin,
|
||||||
} = await imports.axios.get(`https://api.coingecko.com/api/v3/coins/${id}`,
|
} = await imports.axios.get(`https://api.coingecko.com/api/v3/coins/${id}`, {
|
||||||
{
|
|
||||||
params: {
|
params: {
|
||||||
market_data:true
|
market_data: true,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!coin) {
|
if (!coin)
|
||||||
throw {error: {message: "Crypto currency not found"}}
|
throw {error: {message: "Crypto currency not found"}}
|
||||||
}
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: {prices},
|
data: {prices},
|
||||||
@@ -32,11 +30,10 @@ export default async function({login, q, imports, data, account}, {enabled = fal
|
|||||||
params: {
|
params: {
|
||||||
vs_currency,
|
vs_currency,
|
||||||
days,
|
days,
|
||||||
precision
|
precision,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
const chart = imports.Graph.timeline(
|
const chart = imports.Graph.timeline(
|
||||||
prices.map((y, _) => ({x: new Date(y[0]), y: y[1]})),
|
prices.map((y, _) => ({x: new Date(y[0]), y: y[1]})),
|
||||||
{
|
{
|
||||||
@@ -44,13 +41,13 @@ export default async function({login, q, imports, data, account}, {enabled = fal
|
|||||||
|
|
||||||
high: Math.max(...prices.map((y, _) => y[1])),
|
high: Math.max(...prices.map((y, _) => y[1])),
|
||||||
|
|
||||||
points: false, text: false,
|
points: false,
|
||||||
|
text: false,
|
||||||
width: 480 * (1 + data.large),
|
width: 480 * (1 + data.large),
|
||||||
height: 200
|
height: 200,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
//Results
|
//Results
|
||||||
return {
|
return {
|
||||||
chart,
|
chart,
|
||||||
@@ -70,4 +67,3 @@ export default async function({login, q, imports, data, account}, {enabled = fal
|
|||||||
throw imports.format.error(error)
|
throw imports.format.error(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user