diff --git a/pkg/indicator/v2/volume_profile.go b/pkg/indicator/v2/volume_profile.go index d9d3f8fef..9d108413e 100644 --- a/pkg/indicator/v2/volume_profile.go +++ b/pkg/indicator/v2/volume_profile.go @@ -16,11 +16,11 @@ const DefaultValueAreaPercentage = 0.68 type VolumeProfileStream struct { *types.Float64Series - VP VolumeProfile + VP VolumeProfileDetails window int } -// VolumeProfile is a histogram of market price and volume. +// VolumeProfileDetails is a histogram of market price and volume. // Intent is to show the price points with most volume during a period. // The profile gives key features such as: // @@ -31,7 +31,7 @@ type VolumeProfileStream struct { // Value area low (VAL) // // Session High/Low -type VolumeProfile struct { +type VolumeProfileDetails struct { // Bins is the histogram bins. Bins []float64 @@ -65,7 +65,7 @@ type VolumeLevel struct { Volume float64 } -func NewVolumeProfile(source KLineSubscription, window int) *VolumeProfileStream { +func VolumeProfile(source KLineSubscription, window int) *VolumeProfileStream { prices := HLC3(source) volumes := Volumes(source) diff --git a/pkg/indicator/v2/volume_profile_test.go b/pkg/indicator/v2/volume_profile_test.go index cdd20b91b..b3ae4cf20 100644 --- a/pkg/indicator/v2/volume_profile_test.go +++ b/pkg/indicator/v2/volume_profile_test.go @@ -24,14 +24,14 @@ func TestVolumeProfile(t *testing.T) { stream := &types.StandardStream{} kLines := KLines(stream, "", "") - ind := NewVolumeProfile(kLines, 10) + ind := VolumeProfile(kLines, 10) for _, candle := range candles { stream.EmitKLineClosed(candle) } assert.InDelta(t, 36512.7, ind.VP.Low, 0.01, "VP.LOW") - assert.InDelta(t, 36512.7, ind.VP.VAL, 0.01, "VP.VAL") - assert.InDelta(t, 36518.574, ind.VP.POC, 0.01, "VP.POC") - assert.InDelta(t, 36530.322, ind.VP.VAH, 0.01, "VP.VAH") + assert.InDelta(t, 36600.811, ind.VP.VAL, 0.01, "VP.VAL") + assert.InDelta(t, 36612.559, ind.VP.POC, 0.01, "VP.POC") + assert.InDelta(t, 36618.433, ind.VP.VAH, 0.01, "VP.VAH") assert.InDelta(t, 36617.433, ind.VP.High, 0.01, "VP.HIGH") }