Price-by-Volume Profile Construction
Install and import#
npm install fintech-algorithmsimport { priceByVolumeProfileConstruction } from "fintech-algorithms/geometric-chart-patterns/level-confluence-and-zone-scoring/price-by-volume-profile-construction";Signature#
priceByVolumeProfileConstruction(input)Aggregates eligible point-in-time trades into deterministic tick-aligned price-by-volume bins.
Parameters#
| Name | Type | Notes |
|---|---|---|
input | { tick_size: number; bin_size_ticks: number; window_end: string; trades: { trade_id: string; timestamp: string; price: number; volume: number; final: boolean }[] } | Record containing tick_size, bin_size_ticks, window_end, and chronologically ordered unique trades. |
Returns#
{ state, tick_size, bin_size_ticks, bin_width, total_volume, trade_count, eligible_trade_count, rows }
One calculated profile record; each row contains bin index, bounds, midpoint, volume, and volume share.
Errors#
- When tick/bin settings, window time, trade identity, chronology, price, or volume is invalid — throws
Complexity: time ,
space .
Worked example#
executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.
Input#
{
"tick_size": 0.25,
"bin_size_ticks": 2,
"window_end": "2026-08-03T10:30:00Z",
"trades": [
{
"trade_id": "T01",
"timestamp": "2026-08-03T10:00:00Z",
"price": 99,
"volume": 10,
"final": true
},
{
"trade_id": "T02",
"timestamp": "2026-08-03T10:02:00Z",
"price": 99.25,
"volume": 15,
"final": true
},
{
"trade_id": "T03",
"timestamp": "2026-08-03T10:04:00Z",
"price": 99.5,
"volume": 25,
"final": true
}
]
}Call#
priceByVolumeProfileConstruction(input)Returns#
object with 8 fields: state, tick_size, bin_size_ticks, bin_width, total_volume, trade_count, eligible_trade_count, rows
{
"state": "calculated",
"tick_size": 0.25,
"bin_size_ticks": 2,
"bin_width": 0.5,
"total_volume": 340,
"trade_count": 12,
"eligible_trade_count": 12,
"rows": [
{
"bin_index": 198,
"lower": 99,
"upper": 99.5,
"midpoint": 99.25,
"volume": 25,
"share": 0.073529411765
},
{
"bin_index": 199,
"lower": 99.5,
"upper": 100,
"midpoint": 99.75,
"volume": 45,
"share": 0.132352941176
},
{
"bin_index": 200,
"lower": 100,
"upper": 100.5,
"midpoint": 100.25,
"volume": 152,
"share": 0.447058823529
}
]
}Other exports#
This module also exports
calculate, pocValueAreaHvnLvnDetection, fibonacciRetracementExtensionProjection, psychologicalRoundNumberLevelGeneration, multiSourceSupportResistanceZoneFusion, supportResistanceZoneStrengthDecayScoring, supportResistanceRoleReversalStateMachine, breakoutAndRetestDetection, marketWideZoneProximityScannerRanking. Every module additionally exports run as an alias of its
primary function, and a meta object carrying its catalog id, domain, family,
shape and article URL.
Diagrams#
Calculation flow#
Price-by-Volume Profile Construction calculation flow
flowchart LR
S1["Validate ordered unique finalized trades against windo"]
S2["Convert each price to an integer tick index"]
S3["Map the tick index to one halfopen bin"]
S4["Accumulate positive trade volume and retain emptyprint"]
S5["Sort rows and reconcile shares to eligible total volum"]
S1 --> S2
S2 --> S3
S3 --> S4
S4 --> S5
S5 --> D{"a price exactly on a bin boundary enters the upper halfope"}
D --> O["rows + diagnostics"]
O --> A["Audit: The output is a deterministic function of validated inputs"]
How it works#
This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.
References#
- Volume profile indicators: basic concepts — TradingView
- Session volume profile charts explained — TradingView
- Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation — Andrew W. Lo, Harry Mamaysky, and Jiang Wang
- Evidence boundary