Skip to content

Instantly share code, notes, and snippets.

@sayon-bitquery
Last active November 1, 2023 14:34
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sayon-bitquery/13532e09703ce541e51ac8850c58f4c3 to your computer and use it in GitHub Desktop.
Save sayon-bitquery/13532e09703ce541e51ac8850c58f4c3 to your computer and use it in GitHub Desktop.
tradingview-2:7
export const endpoint = 'https://graphql.bitquery.io';
export const GET_COIN_INFO =`
{
ethereum(network: bsc) {
dexTrades(
options: {desc: ["block.height", "transaction.index"], limit: 1}
exchangeAddress: {is: "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73"}
baseCurrency: {is: "0x2170ed0880ac9a755fd29b2688956bd959f933f8"}
quoteCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}
)
{
block {
height
timestamp {
time(format: "%Y-%m-%d %H:%M:%S")
}
}
transaction {
index
}
baseCurrency {
name
symbol
decimals
}
quotePrice
}
}
}
`;
export const GET_COIN_BARS = `
{
ethereum(network: bsc) {
dexTrades(
options: {asc: "timeInterval.minute"}
date: {since: "2021-06-20T07:23:21.000Z", till: "2021-06-23T15:23:21.000Z"}
exchangeAddress: {is: "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73"}
baseCurrency: {is: "0x2170ed0880ac9a755fd29b2688956bd959f933f8"},
quoteCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"},
tradeAmountUsd: {gt: 10}
)
{
timeInterval {
minute(count: 15, format: "%Y-%m-%dT%H:%M:%SZ")
}
volume: quoteAmount
high: quotePrice(calculate: maximum)
low: quotePrice(calculate: minimum)
open: minimum(of: block, get: quote_price)
close: maximum(of: block, get: quote_price)
}
}
}
`;
@sayon-bitquery
Copy link
Author

These are the updated GraphQL queries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment