하위 그래프(TheGraph)를 통한 유니스왑의 일일 가격 데이터

7318 단어 uniswapblockchain

일일 데이터



# thegraph.sh
curl -v \
  -X POST "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2" \
  -H "Content-Type: application/json" \
  -d \
'{"query": "{tokenDayDatas(first: 3, orderBy: date, orderDirection: desc, where: { token: \"0x5caf454ba92e6f2c929df14667ee360ed9fd5b26\"}) { id date token { id symbol } priceUSD } }",
  "variables":null
}'



$ sh ./thegraph.sh | jq



{
  "data": {
    "tokenDayDatas": [
      {
        "date": 1600819200,
        "id": "0x5caf454ba92e6f2c929df14667ee360ed9fd5b26-18528",
        "priceUSD": "2.806800389425393983069918593327176",
        "token": {
          "id": "0x5caf454ba92e6f2c929df14667ee360ed9fd5b26",
          "symbol": "DEV"
        }
      },
      {
        "date": 1600732800,
        "id": "0x5caf454ba92e6f2c929df14667ee360ed9fd5b26-18527",
        "priceUSD": "3.03633060835788742357890476280017",
        "token": {
          "id": "0x5caf454ba92e6f2c929df14667ee360ed9fd5b26",
          "symbol": "DEV"
        }
      },
      {
        "date": 1600646400,
        "id": "0x5caf454ba92e6f2c929df14667ee360ed9fd5b26-18526",
        "priceUSD": "3.233086904554954033846620475375757",
        "token": {
          "id": "0x5caf454ba92e6f2c929df14667ee360ed9fd5b26",
          "symbol": "DEV"
        }
      }
    ]
  }
}

업데이트: 2020.09.24

반실시간 데이터



ETH-USD 가격



$ curl -X POST "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2" -H "Content-Type: application/json" -d \
'{"query": "{bundle(id: 1) { id ethPrice } }",
  "variables":null
}'



{"data":{"bundle":{"ethPrice":"338.9406833562309124607125730378295","id":"1"}}}

DEV-ETH 가격



$ curl -X POST "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2" -H "Content-Type: application/json" -d \
'{"query": "{token(id: \"0x5caf454ba92e6f2c929df14667ee360ed9fd5b26\") { id derivedETH } }",
  "variables":null
}'



{"data":{"token":{"derivedETH":"0.008128160843209088915463402585521696","id":"0x5caf454ba92e6f2c929df14667ee360ed9fd5b26"}}}

좋은 웹페이지 즐겨찾기