diff --git a/src/libs/osmos.js b/src/libs/osmos.js
index 8a6f403b..c0094085 100644
--- a/src/libs/osmos.js
+++ b/src/libs/osmos.js
@@ -1,3 +1,10 @@
+/*
+ * @Description: file
+ * @Autor: dingyiming
+ * @Date: 2021-11-22 21:20:10
+ * @LastEditors: dingyiming
+ * @LastEditTime: 2021-11-23 10:25:41
+ */
import fetch from 'node-fetch'
import { getLocalChains } from './data/data'
@@ -19,15 +26,21 @@ export default class OsmosAPI {
fetch(`https://api.coingecko.com/api/v3/coins/${to}/ohlc?vs_currency=usd&days=7`).then(res => res.json())],
).then(ohlc => {
const output = []
- console.log(ohlc)
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)
})
+ const result = []
+ for (let i = 0; i < output.length; i += 1) {
+ const itemArr = output[i]
+ result.push({
+ time: itemArr[0],
+ volume: 0,
+ })
+ }
return output
})
}
diff --git a/src/views/OsmosisTrade.vue b/src/views/OsmosisTrade.vue
index 9cf3d182..6ecf6eaf 100644
--- a/src/views/OsmosisTrade.vue
+++ b/src/views/OsmosisTrade.vue
@@ -61,7 +61,7 @@
-
-
+
{
- console.log(data)
- })
+ this.$http.osmosis.getOHCL4Pairs(
+ this.$http.osmosis.getCoinGeckoId(this.base),
+ this.$http.osmosis.getCoinGeckoId(this.target),
+ )
+ .then(data => {
+ this.klineData = data
+ })
},
beforeRouteUpdate(to, from, next) {
const { base, target } = to.params
diff --git a/src/views/components/kline/datafeed.js b/src/views/components/kline/datafeed.js
index 307759a5..5611e04a 100644
--- a/src/views/components/kline/datafeed.js
+++ b/src/views/components/kline/datafeed.js
@@ -46,7 +46,7 @@ class DataFeeds {
onReady(callback) {
const defaultConfiguration = {
symbols_type: [],
- supported_resolutions: ['1', '5', '15', '30', '60', '240', '1D', '1M'],
+ supported_resolutions: ['30', '240', '1D'],
supports_marks: true,
supports_timescale_marks: false,
supports_time: false,
@@ -121,7 +121,7 @@ class DataFeeds {
has_empty_bars: true,
description: '',
has_intraday: true,
- supported_resolutions: ['1', '5', '15', '30', '60', '120', '240', '360', '1D'],
+ supported_resolutions: ['30','240', '1D'],
pricescale: 100000000, // 价格精度
volume_precision: 3, // 数量精度
symbol: symbolName,
diff --git a/src/views/components/kline/index.vue b/src/views/components/kline/index.vue
index 8c2df823..d09797dc 100644
--- a/src/views/components/kline/index.vue
+++ b/src/views/components/kline/index.vue
@@ -18,13 +18,15 @@ const toDouble = time => {
}
export default {
+ props: {
+ list: [],
+ },
data() {
return {
themeLocal: 'dark'
}
},
mounted() {
- console.log(version())
const store = {
ws: new WebSocket('wss://api.huobipro.com/ws'),
@@ -55,7 +57,7 @@ export default {
volume: data.amount,
})
}
-
+ console.log(this.list);
store.onDataCallback(datas, { noData: !datas.length })
}