Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@tradecanvas/commons

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tradecanvas/commons

Shared types and utilities for @tradecanvas/chart

latest
Source
npmnpm
Version
0.9.0
Version published
Maintainers
1
Created
Source

@tradecanvas/commons

Shared types, utilities, constants, themes, i18n, and market presets for the @tradecanvas/chart library.

Live Demo | GitHub | Documentation

Install

You don't need to install this package directly. It's included as a dependency of @tradecanvas/chart.

npm install @tradecanvas/chart

What's Inside

Types

All TypeScript interfaces and types used across the library:

  • OHLCBar, DataSeries, TimeFrame -- data format
  • ChartOptions, ChartType, FeaturesConfig -- chart configuration
  • Theme, ThemeName -- theming
  • IndicatorPlugin, IndicatorDescriptor, IndicatorConfig -- indicators
  • DrawingToolType, DrawingState, DrawingStyle -- drawing tools
  • TradingPosition, TradingOrder, TradingConfig -- trading overlay
  • DataAdapter, StreamConfig, ConnectionState -- real-time streaming
  • ChartEventType, ChartEvent -- events
  • MarketConfig, TradingSession -- market configuration

Themes

import { DARK_THEME, LIGHT_THEME } from '@tradecanvas/commons'

19 customizable properties: background, text, candleUp, candleDown, grid, crosshair, volumeUp, volumeDown, and more.

Constants

  • Default chart options and feature flags
  • Market presets: MARKET_HOSE, MARKET_HNX, MARKET_UPCOM, MARKET_CRYPTO, MARKET_NYSE
  • Vietnamese stock market color schemes

Utilities

  • computePriceRange() -- compute visible price range from OHLC data
  • timeframeToMs() -- convert timeframe string to milliseconds
  • formatNumber(), formatVND(), formatVolumeLoc() -- number formatting
  • Color, math, precision, and data manipulation helpers

i18n

Built-in locales: English (en), Vietnamese (vi). Extensible via registerLocale().

Direct Usage

If you need just the types or utilities without the full chart:

import type { OHLCBar, TimeFrame, ChartType } from '@tradecanvas/commons'
import { DARK_THEME, computePriceRange, timeframeToMs } from '@tradecanvas/commons'

License

MIT

Keywords

trading

FAQs

Package last updated on 02 Jun 2026

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