diff --git a/src/libs/osmos.js b/src/libs/osmos.js index 64549e15..5ba235c9 100644 --- a/src/libs/osmos.js +++ b/src/libs/osmos.js @@ -12,6 +12,25 @@ export default class OsmosAPI { return fetch(`${this.host}${url}`).then(res => res.json()) } + async getOHCL4Pairs(from, to) { + this.exe_time = '' + const ohlc = await Promise.all( + [fetch(`https://api.coingecko.com/api/v3/coins/${from}/ohlc?vs_currency=usd&days=7`).then(res => res.json()), + fetch(`https://api.coingecko.com/api/v3/coins/${to}/ohlc?vs_currency=usd&days=7`).then(res => res.json())], + ) + const output = [] + ohlc[0].forEach((e, i) => { + console.log(e, i, ohlc[1][i]) + const price = [e[0]] + for (let j = 1; j <= 4; j += 1) { + price.push(e[j] / ohlc[1][i][j]) + } + output.push(price) + }) + + return output + } + // Custom Module async getPools() { return this.get('/osmosis/gamm/v1beta1/pools?pagination.limit=700') diff --git a/src/views/OsmosisTrade.vue b/src/views/OsmosisTrade.vue index b48032e3..deef01d4 100644 --- a/src/views/OsmosisTrade.vue +++ b/src/views/OsmosisTrade.vue @@ -3,27 +3,16 @@ ------- - + - - #{{ data.id }} {{ formatDenom(data.poolAssets[0].token.denom) }} - {{ formatDenom(data.poolAssets[1].token.denom) }} xx - -
- Height -
-
- {{ data.address || '0' }} -
+ x
@@ -35,7 +24,7 @@