Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis Timeseries range(latest=True) is incorrect. #3308

Open
eromoe opened this issue Jul 9, 2024 · 0 comments
Open

Redis Timeseries range(latest=True) is incorrect. #3308

eromoe opened this issue Jul 9, 2024 · 0 comments

Comments

@eromoe
Copy link

eromoe commented Jul 9, 2024

Version: redis-5.0.7
Platform: Python 3.9 on Windows 10
Already update to latest docker image redis/redis-stack-server:latet
Description:

first = last

first = rts.ts.range('000001.SZ:raw:price', '-', '+', count=10)
last = rts.ts.range('000001.SZ:raw:price', '-', '+', count=1, latest=True)

print(ts_to_datetime(first[0][0]), ts_to_datetime(last[0][0]))

output same

2024-07-08 15:00:00 2024-07-08 15:00:00

get is correct

last2 = rts.ts.get('000001.SZ:raw:price', latest=True)

print(ts_to_datetime(last2[0]))

2024-07-09 15:00:00

mget is correct

last3 = rts.ts.mget(filters=['tframe=raw', 'code=000001.SZ', ], latest=True)

print(ts_to_datetime(last3[1]['000001.SZ:raw:price'][1]))

2024-07-09 15:00:00

get all

import pandas as pd

lst = rts.ts.range('000001.SZ:raw:price', '-', '+')
df =pd.DataFrame(lst, columns=['ts', 'price'])
df.ts.apply(ts_to_datetime)

output, can see 2024-07-09 15:00:00 is the latest

0      2024-07-08 15:00:00
1      2024-07-09 09:22:33
2      2024-07-09 09:22:42
3      2024-07-09 09:22:51
4      2024-07-09 09:23:00
               ...        
4682   2024-07-09 14:59:24
4683   2024-07-09 14:59:33
4684   2024-07-09 14:59:42
4685   2024-07-09 14:59:51
4686   2024-07-09 15:00:00
Name: ts, Length: 4687, dtype: datetime64[ns]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant