cinar / indicator

Indicator is a Golang module providing various stock technical analysis indicators for trading.
GNU Affero General Public License v3.0
460 stars 92 forks source link

Why is volume an []int64 and not []float64 ? #126

Closed larscom closed 10 months ago

larscom commented 10 months ago

Hi,

Im exploring this lib and kinda new to this stuff, and one thing i don't understand is why the func VolumeWeightedAveragePrice for example and many other funcs expects a volume of type []int64?

Inside that func the []int64 gets converted to []float64 anyway.

https://github.com/cinar/indicator/blob/39599886ef85be4c92879d12753a6c0708c57187/volume_indicators.go#L154

If any one has an answer for me, im pleased ;-)

Thanks!

cinar commented 10 months ago

Hi @larscom, when I started building this project, the data source that I used for the data had the volume as int64, so I followed that convention. However, it is a good point. What data source you are seeing volume as float64? I can certainly make it a float64 moving forward too?

larscom commented 10 months ago

hi @cinar, my data source is binance or bitvavo (crypto). Their volume is always a floating point number. Besides that i think it makes sense to make volume a float64 anyhow.

cinar commented 10 months ago

It is a good point. I can see that it does make sense for crypto data. Let me see if I can change this.

cinar commented 10 months ago

Hi @larscom, please check the fix-126 branch and let me know if it solves the problem for you.

larscom commented 10 months ago

Hi @larscom, please check the fix-126 branch and let me know if it solves the problem for you.

Looking good to me!

cinar commented 10 months ago

Awesome, please try it with release v1.3.0.