unit8co / darts

A python library for user-friendly forecasting and anomaly detection on time series.
https://unit8co.github.io/darts/
Apache License 2.0
8.07k stars 880 forks source link

[BUG] How to prevent darts from caring about the date frequency #2500

Closed valentin-fngr closed 2 months ago

valentin-fngr commented 2 months ago

Describe the bug I am trying to train TFT to predict the price movement of a stock given 10 other stocks. I removed after hours trading and non weekdays from my dataframe. Therefore, I only have data from monday to friday - from 9:30am to 4pm. I do not need DARTS to populate these after hours dates with nan values ........... How can I get rid of this ?

Thanks

madtoinou commented 2 months ago

Hi @valentin-fngr,

You can find some workaround in the issue #1650 and based on your description, you will probably have to define a custom calendar with a mask for both the business days, trading hours and the holidays.

Another approach, less elegant, would be to convert your index to RangeIndex instead of DatetimeIndex but you would lose information.

Let me know which solution worked for you.

valentin-fngr commented 2 months ago

Hi, Thanks for your reply.

I ended up going with the RangeIndex for now. I think that I can still use the year, month, day as static covariate as long as I convert my index to RangeIndex.

I will take a look at masking in the future.