Kumo Charts

@kumo-charts/core/volume-profile

API 레퍼런스는 소스 코드의 주석에서 생성되며 영어로만 제공됩니다.

import { … } from '@kumo-charts/core/volume-profile';

Functions

checkVolumeProfileOptionsfunction소스

function checkVolumeProfileOptions(
  options: VolumeProfileOptions,
  label: string
): Required<VolumeProfileOptions>

The rows and the value area of options as computeVolumeProfile takes them, checked, with their defaults; label names the options in errors. Other fields are left to the caller, for a profile of its own, such as one of trades.

computeVolumeProfilefunction소스

function computeVolumeProfile(
  bars: BarsView | readonly BarInput[],
  from: number,
  to: number,
  options: VolumeProfileOptions = {}
): VolumeProfileData | null

The volume profile of the bars [from, to): a chart's, such as chart.data.source, or bars of your own, checked as chart.data.set() checks them. Each bar's volume is spread evenly over its range from low to high, so finer bars give a sharper profile. null when the bars hold no volume. Runs anywhere, Node included.

fixedRangeVolumeProfilefunction소스

function fixedRangeVolumeProfile(
  options: FixedRangeVolumeProfileOptions = {}
): DrawingTypeDefinition<Anchors<2>>

The fixed range volume profile, fixed-range-volume-profile: the volume traded at each price of the bars from the first anchor's through the second's, computed from the source bars that a running replay has revealed. The anchors set the time range, the bars the price range; without volume there, the frame spans the anchors' prices. The rows are painted under the bars, and the style's color paints the frame. Give it to the drawings module, as drawings([...allDrawings, fixedRangeVolumeProfile()]); the options hold for every drawing of the type.

pointOfControlfunction소스

function pointOfControl(volumes: ArrayLike<number>): number

The point of control of the volumes of rows, from the lowest price up: the row with the most volume. Of rows with as much, the one nearest the middle, and of two as near, the upper one.

valueAreaOffunction소스

function valueAreaOf(
  volumes: ArrayLike<number>,
  poc: number,
  share = DEFAULT_VALUE_AREA
): { low: number; high: number }

The value area of the volumes of rows, from the lowest price up, around the point of control poc: from it, the row above or the row below the area, whichever has more volume (the nearer one to poc on a tie, the upper one when as near), joins the area while the area stays within share of the whole volume, and it stops at the first that would take it past. Gives the indices of its first and last row.

volumeProfileGridfunction소스

function volumeProfileGrid(
  low: number,
  high: number,
  rows: number
): VolumeProfileGrid | null

The rows a volume profile divides the prices from low to high into, as computeVolumeProfile divides those of bars: rows of one height, from 1 to 1000. For a profile of your own, such as one of trades, to match the chart's. null without a range.

volumeProfilesfunction소스

function volumeProfiles(): VolumeProfilesModule

The volume profiles module: chart.volumeProfiles, the volume traded at each price of the bars in view or of each trading day, under the bars of the main pane. The profiles are kept in the chart's state.

Interfaces

FixedRangeVolumeProfileOptionsinterface소스

interface FixedRangeVolumeProfileOptions extends VolumeProfileOptions

Options of fixedRangeVolumeProfile, for every drawing of the type.

width?: number

Length of the row with the most volume, as a share of the range's width. Default 0.6.

upColor?: string

Volume of the bars that closed at or above their open. Default: the theme's up.

downColor?: string

Volume of the bars that closed below their open. Default: the theme's down.

pocColor?: string

The line of the point of control. Default: the first color of the theme's palette.

VolumeProfileinterface소스

interface VolumeProfile

A volume profile on the chart, as chart.volumeProfiles gives it.

readonly id: string
readonly mode: VolumeProfileMode
readonly rows: number
readonly valueArea: number
readonly width: number | null

As given, or null for the default of the mode.

readonly placement: VolumeProfilePlacement
readonly upColor: string | null

As given, or null for the theme's color.

readonly downColor: string | null
readonly pocColor: string | null
readonly visible: boolean

VolumeProfileDatainterface소스

interface VolumeProfileData

The volume traded at each price of a run of bars, as computeVolumeProfile gives it.

readonly rows: readonly VolumeProfileRow[]

Rows of one height, from the lowest price to the highest.

readonly total: number

The volume of every row together.

readonly poc: number

Index of the row with the most volume, the point of control, as pointOfControl.

readonly valueArea: { readonly low: number; readonly high: number }

Indices of the first and the last row of the value area, as valueAreaOf.

VolumeProfileGridinterface소스

interface VolumeProfileGrid

The price rows of a volume profile: count rows step high, from bottom up.

readonly bottom: number
readonly step: number
readonly count: number

VolumeProfileInputinterface소스

interface VolumeProfileInput
id?: string

Generated when omitted.

rows?: number

Number of price rows, from 1 to 1000. Default 24.

valueArea?: number

Share of the volume in the value area, above 0 and at most 1. Default 0.7.

width?: number

Length of the row with the most volume, above 0 and at most 1: a share of the plot's width (visible, default 0.25) or of the trading day's (session, default 0.7).

The edge a profile of the bars in view grows from. Default right.

upColor?: string

Volume of the bars that closed at or above their open. Default: the theme's up.

downColor?: string

Volume of the bars that closed below their open. Default: the theme's down.

pocColor?: string

The line of the point of control. Default: the first color of the theme's palette.

visible?: boolean

Default true.

VolumeProfileOptionsinterface소스

interface VolumeProfileOptions
rows?: number

Number of price rows, from 1 to 1000. Default 24.

valueArea?: number

Share of the volume in the value area, above 0 and at most 1. Default 0.7.

VolumeProfileRowinterface소스

interface VolumeProfileRow

One price row of a volume profile: the volume traded between low and high.

readonly low: number
readonly high: number
readonly up: number

Volume of the bars that closed at or above their open.

readonly down: number

Volume of the bars that closed below their open.

VolumeProfilesApiinterface소스

interface VolumeProfilesApi

Volume profiles under the bars of the main pane: of the bars in view, or of each trading day. They are computed from the source bars, so a daily chart of 1-minute bars puts each day's volume at the prices it traded at, and only from those a running replay has revealed.

set(inputs: readonly VolumeProfileInput[]): void

Replaces every profile. An invalid input throws and changes nothing.

add(input: VolumeProfileInput): string

Adds a profile and returns its id: the one it has, or one the chart numbers for it.

update(id: string, patch: Partial<Omit<VolumeProfileInput, 'id'>>): void

Changes a profile; what the patch leaves out stays. Throws for an unknown id.

remove(id: string): void

Throws for an unknown id.

clear(): void

Removes every profile.

get(id: string): VolumeProfile | null

The profile of an id, or null.

list(): VolumeProfile[]

Every profile, in the order they paint.

Types

VolumeProfileModetype소스

type VolumeProfileMode = 'visible' | 'session'
  • visible: one profile of the bars in view, along an edge of the plot.
  • session: one profile for each trading day of the chart's calendar, from the start of the day.

VolumeProfilePlacementtype소스

type VolumeProfilePlacement = 'left' | 'right'

The edge of the plot a profile of the bars in view grows from.

VolumeProfilesModuletype소스

type VolumeProfilesModule = ChartModule<{
  readonly api: { readonly volumeProfiles: VolumeProfilesApi };
  readonly state: { readonly volumeProfiles: readonly VolumeProfileInput[] };
}>

↑↓ 선택 · Enter 열기 · Esc 닫기