Make talib support multi timescale. #581
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For example, I have 1 minute scale tick data, and I'd like add 5 minute/ 15 minute feature upon .
I wrote a function
This generate 5 minute SMA features for each 1 minute tick .
you can think
arr = np.arange(1000).astype(float)
as a stock close price at minute level .It is a 1000 time tick collection.
On every tick , I need calculate
sma5
ontalib.SMA(arr, 5)
)apply_over(lambda a: talib.SMA(a, 5) , arr, 5)
)apply_over(lambda a: talib.SMA(a, 5) , arr, 15)
)For example:
A series
...,500, 501, 502, 503, 504 , 505,....
At 505,
Using
pandas resmple(freq='5min').first()
would make gaps , shrinkarr
length from1000
to200
. You need do it 5 times with each shift [0,1,2,3,4] and applySMA
to make sure every tick have 5 minute feature, , like what I do inapply_over
Because I really like vectorbt, so share this idea here.