diff --git a/data_process/blockPriceInUsd.js b/data_process/blockPriceInUsd.js new file mode 100644 index 0000000..e6c929c --- /dev/null +++ b/data_process/blockPriceInUsd.js @@ -0,0 +1,22 @@ +const fse = require('fs-extra'); +const OcapSDK = require('@arcblock/node-ocap'); + +const client = new OcapSDK({ + dataSource: 'btc' // btc, eth +}); + +(async () => { + try { + result = []; + for (let height = 1; height < 100000; height++) { + const { blockByHeight: block } = await client.blockByHeight({ + height + }); + console.log(height, block.priceInUsd); + result.push(block.priceInUsd); + } + fse.writeJSONSync(require, result); + } catch (err) { + console.log(err); + } +})(); diff --git a/data_process/line-smooth.html b/data_process/line-smooth.html new file mode 100644 index 0000000..20250d5 --- /dev/null +++ b/data_process/line-smooth.html @@ -0,0 +1,54 @@ + + + + + + + + +
+ + + + + + + + + + + + + + + diff --git a/data_process/priceFlow.js b/data_process/priceFlow.js new file mode 100644 index 0000000..beb98cc --- /dev/null +++ b/data_process/priceFlow.js @@ -0,0 +1,55 @@ +const fse = require('fs-extra'); +const OcapSDK = require('@arcblock/node-ocap'); + +const token = 'eth'; + +const client = new OcapSDK({ + dataSource: token // btc, eth +}); + +(async () => { + try { + const data = []; + let { cryptoHistoryPrice: result } = await client.doRawQuery(` + { + cryptoHistoryPrice(startDate: "2016-01-01T00:00:00Z", endDate: "2018-09-01T00:00:00Z", token: "${token}") { + data { + date + price + } + page { + cursor + next + total + } + } + } + `); + console.log(result); + data.push(...result.data); + let cursor = result.page.cursor; + while (result.page.next) { + result = (await client.doRawQuery(` + { + cryptoHistoryPrice(startDate: "2016-01-01T00:00:00Z", endDate: "2018-09-01T00:00:00Z", token: "${token}", paging: { cursor: "${cursor}" }) { + data { + date + price + } + page { + cursor + next + total + } + } + } + `)).cryptoHistoryPrice; + console.log(result, data.length); + data.push(...result.data); + cursor = result.page.cursor; + } + fse.writeJsonSync(`${token}-prices.json`, data); + } catch (err) { + console.log(err); + } +})();