Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-tradingview-wrapper

Shinichi5274MIT1.0.15

React component for rendering the TradingView Advanced Real-Time Chart Widget

tradingview, tradingview widget, tradingview widget react

readme

Install

yarn add react-tradingview-wrapper or npm install --save react-tradingview-wrapper

Usage

Basic example

import TradingView from 'react-tradingview';

const App = () => (
  <TradingView symbol="NASDAQ:AAPL" />
);

All given props are passed on to the widget config. See this page for the TradingView Advanced Real-Time Chart API.

Advanced example

import TradingView, { Themes } from 'react-tradingview-wrapper';

const App = () => (
  <TradingView
    symbol="NASDAQ:AAPL"
    theme={Themes.DARK}
    locale="fr"
    autosize
  />
);

Constants and API differences

react-tradingview-wrapper exports constants for the following things:

  • Interval types: IntervalTypes.D and IntervalTypes.W
  • Themes: Themes.LIGHT and Themes.DARK
  • BarStyles:
    • BarStyles.BARS
    • BarStyles.CANDLES
    • BarStyles.HOLLOW_CANDLES
    • BarStyles.HEIKIN_ASHI
    • BarStyles.LINE
    • BarStyles.AREA
    • BarStyles.RENKO
    • BarStyles.LINE_BREAK
    • BarStyles.KAGI
    • BarStyles.POINT_AND_FIGURE

You don't have to use these constants.

react-tradingview-wrapper also makes it possible to use numbers for interval, popup_width and popup_height instead of strings, but this is not required.

changelog

Version 1.2.2

Released 2018-01-21

  • Switched from Component to PureComponent so that the widget doesn't rerender when the props didn't change

Version 1.2.1

Released 2018-01-21

  • Fixed component not rerendering when props changed
  • The widget container now has a width and height of 100% when the autosize prop is true
  • Changed script element and container element IDs

Version 1.2.0

Released 2018-01-21

  • Added description to package.json
  • Refactored some little things
  • Removed unnecessary jest config
  • Removed unused dependencies
  • Made tests work again by adding react and react-dom as devDependencies
  • Updated outdated dependencies
  • Added babel-core devDependency to remove warnings

Version 1.1.2

Released 2018-01-20

  • Fixed indenting mistake

Version 1.1.1

Released 2018-01-20

  • Added LICENSE file
  • Fixed typo in README
  • The widget now renders inside an article element instead of a div element

Version 1.1.0

Released 2018-01-20

  • Added constants
  • Added missing prop-types
  • Updated README
  • Added changelog
  • Updated tests
  • Fixed webpack config indenting

Version 1.0.1

Released 2018-01-20

  • Added autosize prop
  • Updated README

Version 1.0.0

Released 2018-01-20

  • Initial release