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

pennant

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pennant

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

  • 1.17.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
402
increased by47.79%
Maintainers
1
Weekly downloads
 
Created
Source

CI status GitHub license NPM


Logo

Pennant

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

Pennant chart

Pennant chart

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License

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.

yarn add react react-dom

Installation

yarn add pennant

Usage

import React from "react";
import { CandlestickChart } from "pennant";

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.

/**
 * 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.

yarn storybook

Open http://localhost:6006 to view in the browser.

We try our best to follow the Conventional Commits specification. This lets use standard-version for semantic versioning and CHANGELOG generation.

Building

To build the library run

yarn build

The output can be found in the dist directory.

Testing

To run the tests

yarn test

Releasing a new version

We use 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.

yarn release

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

git push --follow-tags origin main

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

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.

Keywords

FAQs

Package last updated on 25 Mar 2024

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