npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pennant

v1.17.0

Published

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

Downloads

1,322

Readme

CI status GitHub license NPM

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.