
This tutorial walks you through building a small web app in TypeScript that will:
- Fetch DOGGOTOTHEMOON (“BTC-840000:3”) candlestick data from Maestro’s Market Price API.
- 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
package.json
should look like:
JSON
tsconfig.json
:
JSON
2. Project Structure
Text
3. Write the HTML Shell
Createsrc/index.html
:
HTML
4. Fetch & Transform Candle Data
Createsrc/main.ts
:
Text
5. Initialize & Draw the Chart
Append tosrc/main.ts
:
Text
6. Bundle & Serve
Add these scripts topackage.json
:
JSON
Bash
- esbuild bundles your code into
main.js
. - live-server serves
src/index.html
at http://127.0.0.1:8080.
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 tofetchCandles()
, such asconst candles = await fetchCandles(true);
- Time Range: add
from
/to
(Unix seconds) tofetchCandles()
- 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.