Skip to main content
This tutorial walks you through building a small web app in TypeScript that will:
  1. Fetch DOGGOTOTHEMOON (“BTC-840000:3”) candlestick data from Maestro’s Market Price API.
  2. Render it as an interactive candlestick chart using the TradingView lightweight-charts library.

Overview

TradingView - Lightweight Charts™

TradingView is a popular web-based platform renowned for its comprehensive and user-friendly charting tools. Users can access a variety of charts for different financial instruments, like stocks, cryptocurrencies, forex, and futures. These charts can be customized with numerous technical indicators and drawing tools to analyze market trends and patterns. TradingView’s Lightweight Charts is a compact, interactive library designed to create financial charts that are both fast and easy to integrate. Here’s a basic guide on how to use it with the Maestro Market Price API.

Prerequisites

  • Node.js ≥14 and npm (or Yarn) installed
  • A Maestro API key
  • Basic familiarity with TypeScript, fetch, and bundling (e.g. with esbuild, webpack, or Vite)

Step-by-Step Instructions

1. Bootstrap a New Project

Bash
Here’s what your initial package.json should look like:
JSON
Next, create a minimal tsconfig.json:
JSON

2. Project Structure

Text

3. Write the HTML Shell

Create src/index.html:
HTML

4. Fetch & Transform Candle Data

Create src/main.ts:
Text

5. Initialize & Draw the Chart

Append to src/main.ts:
Text

6. Bundle & Serve

Add these scripts to package.json:
JSON
Then:
Bash

Interactive TradingView Chart

If you’re able to see a chart like this displayed in your browser, then you have successfully fetched data through the API and rendered the chart.

7. Next Steps & Customization

The following considerations can help you to extend this tutorial to fit more of your application’s needs.
  • You can make the chart data mempool-aware- meaning it returns data about trades that have not yet been confirmed- by passing in an optional boolean value to fetchCandles(), such as const candles = await fetchCandles(true);
  • Time Range: add from/to (Unix seconds) to fetchCandles()
  • Carry: url.searchParams.set('carry','true') fills gaps with synthetic candles
  • Styling: tweak createChart options
  • Interactivity: add crosshair, tooltips, mouse events

🎉 You’re Done!

You now have a live candlestick chart of DOGGOTOTHEMOON using Maestro’s Market Price API with the TradingView lightweight-charts library. Customize it further with indicators, multi‑symbol support, or integrate it into your DeFi dashboard. Be sure to review Maestro’s rate limits and pricing tiers to select the plan that best fits your application’s needs.
SupportIf you are experiencing any trouble with the above, reach out on Discord.