yairmark / hydro-sdk-charts

Trading Chart SDK. Currently under heavy development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hydro-sdk-charts

WIP: this project is under very active development, and it is not ready for production usage. This warning will be removed when it is reliable.

The hydro-sdk-charts including trade chart and deep chart.

Installation

The package can be installed via NPM:

npm install @wangleiddex/hydro-sdk-charts --save

Usage

TradeChart Example

TradeChart-dark

Data format example TradeChart test data

The example below also shows how to include the css from this package if your build system supports requiring css files (webpack is one that does).

import { TradeChart } from '@wangleiddex/hydro-sdk-charts';
import '@wangleiddex/hydro-sdk-charts/dist/style.css';

<TradeChart
  theme="dark" // or light
  data={testData}
  granularityStr="1d"
  styles={{ upColor: '#00d99f' }}
  clickCallback={result => {
    console.log('result: ', result);
  }}
  clickGranularity={result => {
    console.log('result: ', result);
  }}
/>

TradeChart Props

interface Styles {
  background?: string;
  upColor?: string;
  downColor?: string;
  axisColor?: string;
  barColor?: string;
}

interface Props {
  data: any;
  granularityStr: string; // "1d", "1h", "5m"
  priceDecimals: number;
  theme?: string;
  styles?: Styles;
  clickCallback?: any;
  handleLoadMore?: any;
  clickGranularity?: string;
  defaultChart?: string; // 'candle', 'line'
  // start and end in the data list for current view
  start?: number;
  end?: number;
}

DeepChart Example

DeepChart-dark

Data format example TradeChart test data

import { DeepChart } from '@wangleiddex/hydro-sdk-charts';

<DeepChart
  theme="dark" // or light
  asks={bids}
  bids={asks}
  baseToken="HOT"
  quoteToken="DAI"
  styles={{ bidColor: '#00d99f' }}
  clickCallback={result => {
    console.log('result: ', result);
  }}
/>

DeepChart Props:

interface Styles {
  titleColor?: string;
  axisLabelColor?: string;
  axisColor?: string;
  rowBackgroundColor?: string;
  containerBackgroundColor?: string;
  askColor?: string;
  askColorArea?: string;
  bidColor?: string;
  bidColorArea?: string;
  fontFamily?: string;
}

interface Props {
  bids: any;
  asks: any;
  baseToken: any;
  quoteToken: any;
  theme?: any;
  styles?: Styles;
  priceDecimals?: any;
  amountDecimals?: any;
  clickCallback?: any;
}

About

Trading Chart SDK. Currently under heavy development

License:Apache License 2.0


Languages

Language:TypeScript 86.7%Language:CSS 13.3%