0

I want to use OHLC time series at different frequencies (1min, 5min, etc.) - but from the same timeframe (ex: 13:00 to 14:00) - and the corresponding indicator values at each frequency to train a model with Tensorflow/Keras/Pandas. Is it possible and how?

Minichua
  • 185
  • 14

1 Answers1

0

You could try interleaving the tokens, so if you have 60 1-minute resolution and 12 5-minute resolution data points, you can do the following. Your RNN might be able to figure out after a while that your tokens are in clumps of six: 5 1-minute tokens, and then 1 5-minute token.

one_minute_data = list(range(60)) 
five_minute_data = list('abcdefghijkl')

ratio = 5

interleaved = []

i, j, k = 0, 0, 0
while i < len(one_minute_data) and j < len(five_minute_data):
    for _ in range(ratio):
        interleaved[k] = one_minute_data[i]
        i += 1
        k += 1
    interleaved[k] = five_minute_data[j]
    j += 1
    k += 1

assert i == len(one_minute_data) - 1
assert j == len(five_minute_data) - 1
Yaoshiang
  • 1,713
  • 5
  • 15
  • Not what I thought about. I would like to use them as two different datasets as there may be different information in the indicators of each timeframe. – Minichua Aug 27 '23 at 07:08
  • You might try it and see. DNNs are good at learning in environments like this. For example, ViT has no 2D spatial information at all, and yet it performs well (and better than a bag of tokens). This isn't SQL where algorithms are fragile. – Yaoshiang Aug 28 '23 at 16:13
  • I will give it a try – Minichua Sep 02 '23 at 11:21