Esta página ainda não foi traduzida, por isso aparece em inglês.

Framework wrappers

Idiomatic wrappers for React, Vue, and Svelte. All three expose the same prop surface and hand you the underlying Chart instance.

Install

npm install @tradecanvas/react   # or @tradecanvas/vue · @tradecanvas/svelte
npm install @tradecanvas/chart   # the core (peer of each wrapper)

React

import { TradeCanvas, type TradeCanvasRef } from '@tradecanvas/react'
import { BinanceAdapter } from '@tradecanvas/chart'
import { useRef } from 'react'

function App() {
  const chartRef = useRef<TradeCanvasRef>(null)

  return (
    <TradeCanvas
      ref={chartRef}
      symbol="BTCUSDT"
      timeframe="5m"
      theme="dark"
      adapter={new BinanceAdapter()}
      onReady={(chart) => {
        chart.on('orderPlace', e => console.log(e.payload))
      }}
    />
  )
}

Vue

<script setup lang="ts">
import { TradeCanvas } from '@tradecanvas/vue'
import { BinanceAdapter } from '@tradecanvas/chart'

const adapter = new BinanceAdapter()
</script>

<template>
  <TradeCanvas
    symbol="BTCUSDT"
    timeframe="5m"
    theme="dark"
    :adapter="adapter"
    @ready="(chart) => console.log('ready', chart)"
  />
</template>

Svelte

<script lang="ts">
  import { TradeCanvas } from '@tradecanvas/svelte'
  import { BinanceAdapter } from '@tradecanvas/chart'

  const adapter = new BinanceAdapter()
</script>

<TradeCanvas
  symbol="BTCUSDT"
  timeframe="5m"
  theme="dark"
  {adapter}
  onReady={(chart) => console.log('ready', chart)}
/>

Shared props

PropTypeNotes
symbolstringRequired.
timeframeTimeFrame'1m' | '5m' | '15m' | '1h' | '4h' | '1d'
themeThemeName'dark' | 'light' | 'darkTerminal'
adapterDataAdapterLive stream source.
historyLimitnumberInitial bars to load.
tradingbooleanEnable trading overlay.
onReady(chart) => voidFires after the chart mounts.
Need something beyond the props? Reach the underlying Chart via onReady, a ref (React / Vue), or bind:chart (Svelte) for the full API — drawings, trading, execution adapters, plugins, resizable panes, and more.