indicator: add VOLUME api

This commit is contained in:
c9s 2023-06-30 10:37:42 +08:00
parent b29c1aa972
commit 064932ea9d
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 8 additions and 0 deletions

View File

@ -69,6 +69,10 @@ func (i *IndicatorSet) CLOSE(interval types.Interval) *indicator.PriceStream {
return closePrices return closePrices
} }
func (i *IndicatorSet) VOLUME(interval types.Interval) *indicator.PriceStream {
return indicator.Volumes(i.KLines(interval))
}
func (i *IndicatorSet) RSI(iw types.IntervalWindow) *indicator.RSIStream { func (i *IndicatorSet) RSI(iw types.IntervalWindow) *indicator.RSIStream {
return indicator.RSI2(i.CLOSE(iw.Interval), iw.Window) return indicator.RSI2(i.CLOSE(iw.Interval), iw.Window)
} }

View File

@ -51,3 +51,7 @@ func HighPrices(source KLineSubscription) *PriceStream {
func OpenPrices(source KLineSubscription) *PriceStream { func OpenPrices(source KLineSubscription) *PriceStream {
return Price(source, KLineOpenPriceMapper) return Price(source, KLineOpenPriceMapper)
} }
func Volumes(source KLineSubscription) *PriceStream {
return Price(source, KLineVolumeMapper)
}