markcheno / go-talib

A pure Go port of TA-Lib (http://ta-lib.org)
MIT License
769 stars 214 forks source link

adding GroupCandles function #9

Closed saniales closed 6 years ago

saniales commented 6 years ago

Added a function to group candles, from function doc

// GroupCandles groups a set of candles in another set of candles, basing on a grouping factor.
//
// This is pretty useful if you want to transform, for example, 15min candles into 1h candles using same data.
//
// This avoid calling multiple times the exchange for multiple contexts.
//
// Example:
//     To transform 15 minute candles in 30 minutes candles you have a grouping factor = 2
//
//     To transform 15 minute candles in 1 hour candles you have a grouping factor = 4
//
//     To transform 30 minute candles in 1 hour candles you have a grouping factor = 2

added also tests and reformatted code to fix some bugs and align with the rest of the library standards (old candles as first elements, it was against it before, with new candles as first elements)

markcheno commented 6 years ago

Thanks for the contribution!

saniales commented 6 years ago

open source is love <3