volumeprofile

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2026 License: MIT Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

crypto-volume-profile

Zero-dependency Python & JavaScript (ESM) library to compute Volume Profile (VPVR), Point of Control (POC), 70% Value Area (VAH / VAL), and turnover-decayed Cost-Basis Chip Distribution (筹码分布) directly from standard OHLCV candlestick arrays.


Python Installation & Quick Start

pip install crypto-volume-profile
from crypto_volume_profile import compute_distribution

res = compute_distribution(bars, mode="profile", bins=120)
print(res.poc, res.val, res.vah)

Model Overview

  1. Triangular Intrabar Spread: Each bar's volume is distributed across [low, high] using a triangular density peaking at the typical price (H + L + C) / 3.
  2. Volume Profile Mode (mode: 'profile'): Accumulates raw volume across price bins without decay, then expands outward from the POC bin until 70% of total volume is enclosed (VAL to VAH).
  3. Chip Distribution Mode (mode: 'chips'): Applies per-bar turnover decay min(0.95, V / (avgV × turnoverBars)) before adding new volume, modeling how older positions turn over as fresh volume trades at newer price levels, and computes profitRatio (fraction of estimated holdings below current close).

Usage

import { computeDistribution } from './src/index.mjs';

const bars = [
  { o: 95000, h: 96200, l: 94500, c: 95800, v: 12400 },
  { o: 95800, h: 97400, l: 95500, c: 97100, v: 18900 },
  { o: 97100, h: 97800, l: 96300, c: 96800, v: 15100 },
];

const chips = computeDistribution(bars, { mode: 'chips', bins: 60, turnoverBars: 30 });
console.log({
  pocPrice: chips.pocPrice,
  valPrice: chips.valPrice,
  vahPrice: chips.vahPrice,
  profitRatioPct: (chips.profitRatio * 100).toFixed(1) + '%',
});

License

MIT © HoldWins


Go Module Installation (pkg.go.dev)

go get github.com/dalangdalang934/crypto-volume-profile@latest
import "volumeprofile" // github.com/dalangdalang934/crypto-volume-profile

prof := volumeprofile.Compute(bars, volumeprofile.Options{Mode: "chips", Bins: 120, ValueAreaRatio: 0.70})

Documentation

Overview

Package volumeprofile computes OHLCV Volume Profile (VPVR), Point of Control (POC), 70% Value Area (VAH / VAL), and turnover-decayed Cost-Basis Chip Distribution.

Live interactive Volume Profile & Chip Distribution tools:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bar

type Bar struct {
	O, H, L, C, V float64
}

Bar represents a single OHLCV candlestick.

type Options

type Options struct {
	Mode           string  // "chips" (decayed) or "profile" (cumulative VPVR)
	Bins           int     // default 120
	TurnoverBars   float64 // default 30
	ValueAreaRatio float64 // default 0.70
}

Options configures profile resolution, turnover decay, and Value Area coverage.

type ProfileResult

type ProfileResult struct {
	MinPrice    float64
	MaxPrice    float64
	Step        float64
	POC         float64
	VAH         float64
	VAL         float64
	ProfitRatio float64
	Prices      []float64
	Weights     []float64
}

ProfileResult contains computed POC, VAH/VAL, profit ratio, and histogram bins.

func Compute

func Compute(bars []Bar, opt Options) *ProfileResult

Compute builds either a turnover-decayed chip distribution ("chips") or standard VPVR ("profile").

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL