# dfxfe-depth

> A React component library for visualising historical and streaming financial market data

Latest version **1.0.8** (published 2024-08-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install dfxfe-depth
pnpm add dfxfe-depth
yarn add dfxfe-depth
bun add dfxfe-depth
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2024-08-15 |
| First published | 2024-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 42 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sam |
| Maintainers | samcc |
| Keywords | depth, charts |

## Links

- npm: https://www.npmjs.com/package/dfxfe-depth
- Repository: https://github.com/SamChangi/pennant-depth
- Issues: https://github.com/SamChangi/pennant-depth/issues
- npm.io page: https://npm.io/package/dfxfe-depth

## Dependencies (42)

- [sass](https://npm.io/package/sass.md) ^1.49.9
- [lodash](https://npm.io/package/lodash.md) ^4.17.20
- [d3-axis](https://npm.io/package/d3-axis.md) ^3.0.0
- [d3-drag](https://npm.io/package/d3-drag.md) ^2.0.0
- [d3-time](https://npm.io/package/d3-time.md) ^2.0.0
- [d3-zoom](https://npm.io/package/d3-zoom.md) ^2.0.0
- [d3-array](https://npm.io/package/d3-array.md) 2.8.0
- [d3-scale](https://npm.io/package/d3-scale.md) ^3.2.3
- [d3-shape](https://npm.io/package/d3-shape.md) ^2.0.0
- [date-fns](https://npm.io/package/date-fns.md) ^2.17.0
- [allotment](https://npm.io/package/allotment.md) 1.19.0
- [chroma-js](https://npm.io/package/chroma-js.md) ^2.4.2
- [d3-format](https://npm.io/package/d3-format.md) ^2.0.0
- [internmap](https://npm.io/package/internmap.md) ^2.0.1
- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [decimal.js](https://npm.io/package/decimal.js.md) ^10.4.3
- [@types/node](https://npm.io/package/@types/node.md) ^18.0.0
- [d3-delaunay](https://npm.io/package/d3-delaunay.md) ^6.0.2
- [d3-dispatch](https://npm.io/package/d3-dispatch.md) ^2.0.0
- [@types/react](https://npm.io/package/@types/react.md) ^18.0.14
- [d3-selection](https://npm.io/package/d3-selection.md) ^2.0.0
- [@types/lodash](https://npm.io/package/@types/lodash.md) ^4.14.168
- [d3-transition](https://npm.io/package/d3-transition.md) ^2.0.0
- [eventemitter3](https://npm.io/package/eventemitter3.md) ^5.0.0
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.13.10
- [@types/d3-drag](https://npm.io/package/@types/d3-drag.md) ^2.0.0
- [@types/d3-time](https://npm.io/package/@types/d3-time.md) ^3.0.0
- [@types/d3-zoom](https://npm.io/package/@types/d3-zoom.md) ^2.0.0
- [d3-time-format](https://npm.io/package/d3-time-format.md) ^3.0.0
- [@types/d3-array](https://npm.io/package/@types/d3-array.md) ^2.9.0
- [@types/d3-scale](https://npm.io/package/@types/d3-scale.md) ^3.2.2
- [@types/d3-shape](https://npm.io/package/@types/d3-shape.md) ^2.0.0
- [@types/react-dom](https://npm.io/package/@types/react-dom.md) ^18.0.5
- [@types/d3-dispatch](https://npm.io/package/@types/d3-dispatch.md) ^2.0.0
- [@types/d3-selection](https://npm.io/package/@types/d3-selection.md) ^2.0.0
- [use-resize-observer](https://npm.io/package/use-resize-observer.md) ^9.0.0
- [@types/d3-transition](https://npm.io/package/@types/d3-transition.md) ^2.0.0
- [@types/d3-time-format](https://npm.io/package/@types/d3-time-format.md) ^3.0.0
- [@floating-ui/react-dom](https://npm.io/package/@floating-ui/react-dom.md) ^1.0.1
- [react-virtualized-auto-sizer](https://npm.io/package/react-virtualized-auto-sizer.md) ^1.0.4
- [@d3fc/d3fc-technical-indicator](https://npm.io/package/@d3fc/d3fc-technical-indicator.md) ^8.0.1
- [@types/react-virtualized-auto-sizer](https://npm.io/package/@types/react-virtualized-auto-sizer.md) ^1.0.0

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 1.0.8 (latest) — 2024-08-15
- 1.0.7 — 2024-08-14
- 1.0.6 — 2024-08-13
- 1.0.5 — 2024-08-13
- 1.0.4 — 2024-08-13
- 1.0.3 — 2024-08-13
- 1.0.2 — 2024-08-12
- 1.0.1 — 2024-08-12
- 1.0.0 — 2024-08-12

## README

<!-- [![CI status](https://github.com/vegaprotocol/pennant/actions/workflows/test.yml/badge.svg)](https://github.com/vegaprotocol/pennant/actions/workflows/test.yml)
[![GitHub license](https://img.shields.io/npm/l/pennant?style=plastic)](https://github.com/vegaprotocol/pennant/blob/main/LICENSE)
[![NPM](https://img.shields.io/npm/v/pennant?style=plastic&color=green)](https://npmjs.com/package/pennant/) -->

<br />
<p align="center">
  <a href="https://github.com/samchangi/pennant-depth">
    <img src="./assets/logo.svg" alt="Logo" width="256" height="128" style="image-rendering: pixelated;">
  </a>

  <h3 align="center">Pennant-depth</h3>

  <p align="center">
    A React component library for visualising historical and streaming financial market data.
  </p>

  <p align="center">
    <img src="./assets/candle-chart-screenshot.png" alt="Pennant chart" width="940">
  </p>

  <p align="center">
    <img src="./assets/depth-chart-screenshot.png" alt="Pennant chart" width="950">
  </p>
  
  <p align="center">
    <a href="https://pennant.vega.xyz">View Demo</a>
    ·
    <a href="https://github.com/samchangi/pennant-depth/issues">Report Bug</a>
    ·
    <a href="https://github.com/samchangi/pennant-depth/issues">Request Feature</a>
  </p>
</p>

<details open="open">
  <summary>Table of Contents</summary>
  <ol>
    <li>
      <a href="#about-the-project">About The Project</a>
    </li>
    <li>
      <a href="#getting-started">Getting Started</a>
      <ul>
        <li><a href="#prerequisites">Prerequisites</a></li>
        <li><a href="#installation">Installation</a></li>
      </ul>
    </li>
    <li><a href="#usage">Usage</a></li>
    <li><a href="#contributing">Contributing</a></li>
    <li><a href="#license">License</a></li>
  </ol>
</details>

## About The Project

A React chart component visualising historical and streaming financial market data. Built for the Vega platform but can be embedded in any application.

## Getting Started

Pennant is available from npm.

### Prerequisites

Pennant has `react` and `react-dom` as peer dependencies.

```sh
yarn add react react-dom
```

### Installation

```sh
yarn add dfxfe-depth
```

## Usage

```jsx
import React from "react";
import { CandlestickChart } from "dfxfe-depth";

const dataSource = new DataSource();
const options = {
  chartType: "candle",
  studies: [],
  overlays: [],
};

export const App = () => (
  <CandlestickChart dataSource={dataSource} options={options} interval="I1M" />
);
```

The minimum props required are:

- dataSource
- options
- interval

### Styling pennant

You may customize the styling of pennant components by overriding the default CSS variables.

```css
/**
 * You can override the default pennant variables.
 * Note: this is not a complete list of --pennant- variables.
 */
:root {
  --pennant-color-success: #26ff8a;
  --pennant-color-danger: #ff261a;
}
```

## Data

Pennant displays financial data using a DataSource object you pass as a prop to the React CandlestickChart component. This object must implement the DataSource interface, and typically takes the form of a class.

It provides a set of methods such as `query` and `subscribe` which will be called by the chart to get historical and streaming data respectively.

Several reference implementations are provided.

## Contributing

### Development

We use [Storybook](https://storybook.js.org/).

```sh
yarn storybook
```

Open [http://localhost:6006](http://localhost:6006) to view in the browser.

We try our best to follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. This lets use [standard-version](https://github.com/conventional-changelog/standard-version) for semantic versioning and CHANGELOG generation.

### Building

To build the library run

```sh
yarn build
```

The output can be found in the `dist` directory.

### Testing

To run the tests

```sh
yarn test
```

### Releasing a new version

We use [standard-version](https://github.com/conventional-changelog/standard-version) for semantic versioning and CHANGELOG generation.
As long as your git commit messages are conventional and accurate, you no longer need to specify the semver type. It will be calculated for you.
An npm script is provided for convenience.

```sh
yarn release
```

If successful you can push up the new commit and tag with

```sh
git push --follow-tags origin main
```

To release as a pre-release use the flag `--prerelease`.

```sh
yarn release -- --prerelease alpha --release-as minor
```

### Adding a new chart type

Add the new chart type in `chart-types.ts`. Add a new case in `helpers-spec.ts` which specifies how to draw the new chart type.

## License

Pennant is available under the [MIT license](https://opensource.org/licenses/MIT).

---
_Source: https://npm.io/package/dfxfe-depth · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
