New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

binary-charts

Package Overview
Dependencies
Maintainers
2
Versions
533
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

binary-charts

Binary trade and contract visualisation library, written in React

  • 9.2.7
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
21
decreased by-76.4%
Maintainers
2
Weekly downloads
 
Created
Source

Binary Charts

Build Status Coverage Status Code Climate

Demos

Install by running:

npm install binary-charts --save

Or by including the file via CDN and a script tag:

<script src="https://unpkg.com/binary-charts@3.16.0/lib/binary-charts.js"></script>

See Demos

npm install
npm start
open localhost:9001

Build

To build the project:

npm install
npm run compile

To run unit tests:

npm test

For live rebuild during development:

webpack --watch
open example/index.html

Usage

Install in your project:

npm i binary-charts --save

Render the component and pass ticks array to visualize:

<BinaryCharts ticks={ticks} />

Ticks array is in a format [{ epoch, quote }]. Like:

var ticks = [
    { epoch: 123, quote: 95.4 },
    { epoch: 124, quote: 95.3 },
    { epoch: 125, quote: 95.6 }
];

API

PropsDefaultDescription
contractN/Adescription of a bought contract, check response of https://developers.binary.com/api/#proposal_open_contract
idN/Aid of dom element
noDatafalseif true, indicate no data for chart, message 'Data not available` will be shown
pipSize0decimal places of data to be shown, if zero, 9.02 will be shown as 9
onRangeChangeN/Afunction with signature (count, type) => void, called when user clicked one of the range selector buttons, useful when library client want to load more data when user click those buttons
showAllRangeSelectortrueenable all rangeSelector button if true, disable out of range button if false, eg. If all your data is within 1 hour, the 1D button will be disabled
symbolN/Astring represent symbol of data, eg. 'R_100'
shiftMode'fixed'only allowed fixed or dynamic, if fixed, no of data shown will be fix when new data is added, if dynamic, the scroller will expand when new data added
ticks[ ]data for charts, can be in ticks structure or ohlc structure, check below for data shape
theme'light'light or 'dark'
type'area'can be either area or candlestick, defines chart type
onTypeChangeN/Afunction with signature (type) => void, called when user change chart type WIP
tradeN/Aan object describe proposal that user might want to buy, check request of https://developers.binary.com/api/#proposal
trading timesN/Atrading times of symbol, check https://developers.binary.com/api/#trading_times

Ticks data structure

TICKS:

[
    {
        epoch: number,
        quote: number
    },
    ...
]

OHLC:

[
    {
        epoch: number,
        open: number,
        high: number,
        low: number,
        close: number,
    },
    ...
]

Contract visualization

The component can optionally display the trade parameters or contract already bought.

<BinaryCharts ticks={ticks} trade={trade} />

or

<BinaryCharts ticks={ticks} contract={contract} />

Trade and contract properties have the exact format as accepted or returned by the API.

Trading Times

You can optionally provide a trading times object and the Chart will display plot lines visialising open, close and settlement times.

Dynamic data

Dynamically loading more data when needed by the chart will be available soon.

Usage outside React projects

The project is currently lightly dependent on React, but will soon be usable without it. Until then, you can integrate a React component in non-React project like this:

React components as jQuery plugins

Integrating React.js into Existing jQuery Web Applications

Keywords

FAQs

Package last updated on 23 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc