tr8dr / tseries-patterns

trend / momentum and other patterns in financial timeseries
MIT License
237 stars 71 forks source link

Can support cum return in percent for stock/future? #9

Closed coolsnake closed 3 years ago

coolsnake commented 3 years ago

Thank you for this good utility.

I noticed that the prices are converted to cumulative returns by cumr = np.log(prices / prices[0]) * 1e4 I think it is used for forex( bps )

Can it support cumulative return in percent for stock/future?

Thanks.

tr8dr commented 3 years ago

Sure, could be made as a parameter to the code. Let me find the locations and adjust

tr8dr commented 3 years ago

assuming you were referring to the AmplitudeBasedLabeler, I adjusted the label function to take an optional scale parameter as in:

labeler.label (prices, scale = 1e2)

This will then use a return-based scale (x 100). You may need to adjust other parameters such as minamp appropriately. For equities intra-day I use basis points. If you are evaluating on daily returns then understand why bps might be unattractive.