Skip to content

bitquery/tradingview-subscription-realtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TradingView Charts - Realtime OHLC

📊 A implementation of TradingView's Advanced Charts powered by Bitquery's real-time OHLC streaming data. Plot DEX trading data with live price updates across multiple blockchains.


What is TradingView Realtime OHLC?

This project integrates TradingView's Advanced Charts with Bitquery's Trading API to display real-time OHLC (Open, High, Low, Close) candlestick charts for cryptocurrency trading pairs. Stream live price data from DEXs on Solana, Ethereum, BSC, and other blockchains directly into TradingView charts.


🚀 Features

  • Real-time OHLC candlestick charts using TradingView
  • Support for multiple blockchains (Solana, Ethereum, BSC, Base, Polygon, Tron)
  • Live price streaming via WebSocket subscriptions
  • Support for DEX-specific data (Pump.fun, Raydium, Uniswap, PancakeSwap, etc.)
  • Per-token charts via base mint (OHLC quoted in USD via the Trading API)
  • Volume and moving averages (SMA, EMA)

📦 Installation

git clone https://github.com/bitquery/tradingview-subscription-realtime.git
cd tradingview-subscription-realtime
npm install

🔑 Access Token

Get your Bitquery Access Token here


🎯 Quick Start

1. Start the development server

npm start

2. Test with token addresses

Pass the token mint address as the base URL parameter (values are in USD):

http://localhost:3000/?base=So11111111111111111111111111111111111111112

Example parameter:

  • base: token mint address (example: SOL wrapped — So11111111111111111111111111111111111111112)

📚 Complete Tutorial

Follow the complete step-by-step tutorial here


🔥 Supported Blockchains


📊 Example Queries

Real-Time Token Prices in USD on Solana

Stream live OHLC price and volume data for all tokens on Solana, quoted directly in USD.

Run Stream ➤

subscription {
  Trading {
    Pairs(
      where: {
        Interval: {Time: {Duration: {eq: 1}}}
        Price: {IsQuotedInUsd: true}
        Market: {Network: {is: "Solana"}}
        Volume: {Usd: {gt: 5}}
      }
    ) {
      Token {
        Name
        Symbol
        Address
      }
      Market {
        Protocol
        Program
        Network
        Name
        Address
      }
      Block {
        Date
        Time
        Timestamp
      }
      Interval {
        Time {
          Start
          Duration
          End
        }
      }
      Volume {
        Base
        Quote
        Usd
      }
      Price {
        Ohlc {
          Close
          High
          Low
          Open
        }
      }
    }
  }
}

Real-Time Token Prices Against SOL/WSOL

Stream real-time OHLC and volume data for Solana tokens specifically paired against SOL or WSOL.

Run Stream ➤

subscription {
  Trading {
    Pairs(
      where: {
        Interval: {Time: {Duration: {eq: 1}}}
        Price: {IsQuotedInUsd: false}
        QuoteToken: {
          Address: {
            in: [
              "So11111111111111111111111111111111111111112"
              "11111111111111111111111111111111"
            ]
          }
        }
        Market: {Network: {is: "Solana"}}
        Volume: {Usd: {gt: 5}}
      }
    ) {
      Token {
        Name
        Symbol
        Address
      }
      QuoteToken {
        Name
        Symbol
        Address
      }
      Market {
        Protocol
        Program
        Network
        Name
        Address
      }
      Volume {
        Base
        Quote
        Usd
      }
      Price {
        Ohlc {
          Close
          High
          Low
          Open
        }
      }
    }
  }
}

PumpAMM 1-second Price Stream

Real-time (1-second interval) price, OHLC, volume, and moving averages for Pump.fun AMM tokens on Solana.

Run Stream ➤

subscription {
  Trading {
    Pairs(
      where: {
        Interval: {Time: {Duration: {eq: 1}}}
        Price: {IsQuotedInUsd: true}
        Market: {
          Network: {is: "Solana"}
          Program: {is: "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA"}
        }
        Volume: {Usd: {gt: 5}}
      }
    ) {
      Market {
        Protocol
        Program
        Network
        Name
        Address
      }
      Block {
        Date
        Time
        Timestamp
      }
      Interval {
        Time {
          Start
          Duration
          End
        }
      }
      Volume {
        Base
        Quote
        Usd
      }
      Price {
        Ohlc {
          Close
          High
          Low
          Open
        }
        IsQuotedInUsd
      }
      Currency {
        Symbol
        Name
        Id
      }
      Token {
        Name
        Symbol
        Address
        Id
      }
      QuoteToken {
        Name
        Symbol
        Id
        Address
      }
    }
  }
}

Uniswap v3 1-second Price Stream

1-second OHLC and volume stream for tokens traded on Uniswap v3 (Ethereum).

Run Stream ➤

subscription {
  Trading {
    Pairs(
      where: {
        Interval: {Time: {Duration: {eq: 1}}}
        Price: {IsQuotedInUsd: true}
        Market: {
          Network: {is: "Ethereum"}
          Address: {is: "0x1f98431c8ad98523631ae4a59f267346ea31f984"}
        }
        Volume: {Usd: {gt: 5}}
      }
    ) {
      Market {
        Protocol
        Program
        Network
        Name
        Address
      }
      Volume {
        Base
        Quote
        Usd
      }
      Price {
        Ohlc {
          Close
          High
          Low
          Open
        }
      }
      Token {
        Name
        Symbol
        Address
      }
    }
  }
}

🎨 Supported DEXs

Solana DEXs

  • Pump.fun AMM - pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA
  • Raydium Launchlab - LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj
  • Heaven DEX - HEAVENoP2qxoeuF8Dj2oT1GHEnu49U5mJYkdeC8BAX2o
  • Meteora DBC - Supported

Ethereum DEXs

  • Uniswap v3 - 0x1f98431c8ad98523631ae4a59f267346ea31f984
  • Sushiswap - 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac
  • PancakeSwap v3 - 0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865

BSC DEXs

  • FourMeme - 0x5c952063c7fc8610ffdb798152d69f0b9550762b

🛠️ Advanced Features

Price Quotation Options

You can choose between two price quotation modes:

  1. USD Pricing (IsQuotedInUsd: true)

    • OHLC values are in USD
    • Useful for fiat-based trading bots and dashboards
  2. Quote Currency Pricing (IsQuotedInUsd: false)

    • OHLC values are in the quote token (e.g., USDC, SOL)
    • Useful for analyzing token behavior relative to trading pairs

Time Intervals

Available duration intervals:

  • 1 second (Duration: {eq: 1})
  • 5 minutes (Duration: {eq: 300})
  • 1 hour (Duration: {eq: 3600})
  • Full list of intervals

Volume Filtering

Filter out low-volume or outlier trades:

Volume: {Usd: {gt: 5}}  # Minimum $5 USD volume

📖 API Documentation


🤝 Contributing

  1. Fork this repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📜 License

MIT License. Free to use and modify.


💬 Support


🌟 Related Projects


Built with ❤️ by Bitquery

About

Build TradingView Charts for Streaming Data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors