@amit123@abhishek384@rakeshr yes that issue started arising since few days. When calling historical_data api we give from_date and to_date and in that arguments, if it contains second, then the return data will have candles which starts from that second and ends at that second and next candle will also be same. For instance if I pass in from_date = datetime.datetime(2023, 12, 14, 10, 32, 18, 655849) and to_date = datetime.datetime(2023, 12, 14, 13, 17, 6, 884108). it will return candles like below: date open high low close volume 0 2023-12-14 10:32:18+05:30 21253.50 21255.95 21235.00 21241.05 78200 1 2023-12-14 10:37:18+05:30 21241.05 21244.00 21232.10 21238.90 39100 2 2023-12-14 10:42:18+05:30 21238.90 21247.40 21228.55 21242.55 65300 3 2023-12-14 10:47:18+05:30 21242.55 21258.80 21242.55 21253.60 56350 4 2023-12-14 10:52:18+05:30 21253.60 21259.00 21242.55 21249.25 39500 5 2023-12-14 10:57:18+05:30 21249.25 21253.40 21245.80 21249.95 23650 6 2023-12-14 11:02:18+05:30 21250.00 21252.20 21245.60 21252.20 18500 7 2023-12-14 11:07:18+05:30 21252.20 21255.00 21247.00 21253.25 25800 8 2023-12-14 11:12:18+05:30 21253.25 21257.30 21246.00 21254.20 34500 9 2023-12-14 11:17:18+05:30 21254.20 21254.20 21245.10 21245.10 17050 10 2023-12-14 11:22:18+05:30 21245.10 21255.20 21245.10 21248.00 25500 11 2023-12-14 11:27:18+05:30 21248.00 21248.70 21242.30 21246.05 18200 12 2023-12-14 11:32:18+05:30 21246.05 21254.90 21245.20 21252.85 27750 13 2023-12-14 11:37:18+05:30 21252.00 21267.60 21250.00 21264.25 62300 14 2023-12-14 11:42:18+05:30 21265.00 21268.00 21260.30 21265.45 42450..... so just a simple solution is to replace seconds as 0 in datetime object. Hope this helps.
1 minute historical data fetched for multiple days in dataframe df
df[df.date.dt.second!=0]
date open high low close volume
35588 2015-06-22 09:15:01 72.599998 72.849998 72.599998 72.699997 3881
35963 2015-06-23 09:15:01 73.599998 73.900002 73.599998 73.800003 14103
36338 2015-06-24 09:15:01 74.000000 74.199997 73.849998 73.900002 4606
37088 2015-06-26 09:15:01 72.199997 72.349998 72.099998 72.300003 2590
37463 2015-06-29 09:15:01 71.000000 71.000000 70.099998 70.400002 7673
37623 2015-06-29 11:54:33 70.000000 70.000000 70.000000 70.000000 34
38589 2015-07-02 09:15:01 74.250000 74.500000 74.250000 74.400002 10713
38782 2015-07-02 12:28:26 73.250000 73.300003 73.250000 73.250000 1015
38964 2015-07-03 09:15:01 73.400002 73.500000 73.349998 73.400002 2105
41589 2015-07-14 09:15:01 78.949997 79.250000 78.849998 78.849998 32744
41964 2015-07-15 09:15:01 79.699997 79.849998 79.550003 79.699997 31103
42714 2015-07-17 09:15:01 84.400002 84.500000 83.699997 83.699997 631703
43089 2015-07-20 09:15:01 82.449997 82.900002 82.199997 82.699997 70128
43173 2015-07-20 10:39:03 82.349998 82.349998 82.349998 82.349998 958
43174 2015-07-20 10:40:25 82.099998 82.300003 82.099998 82.300003 10318
43192 2015-07-20 10:58:10 82.300003 82.400002 82.300003 82.400002 1910
43201 2015-07-20 11:08:05 82.949997 82.949997 82.800003 82.800003 154987
43202 2015-07-20 11:09:23 82.599998 82.699997 82.599998 82.699997 29883
43206 2015-07-20 11:15:48 82.550003 82.550003 82.550003 82.550003 0
43207 2015-07-20 11:17:05 82.449997 82.500000 82.449997 82.449997 36184
43212 2015-07-20 11:22:05 82.449997 82.650002 82.449997 82.599998 7212
43460 2015-07-21 09:15:01 83.900002 84.400002 83.900002 84.400002 27374
44210 2015-07-23 09:15:01 82.699997 82.800003 82.699997 82.800003 2155
44960 2015-07-27 09:15:01 78.900002 78.949997 78.650002 78.949997 3680
45335 2015-07-28 09:15:03 76.000000 76.000000 75.849998 75.900002 6397
49844 2015-08-13 09:23:56 69.699997 69.699997 69.699997 69.699997 0
This is definitely a bug. please fix it as it is a code breaking bug.
Thank you for highlighting this. We are checking on this.
For instance if I pass in from_date = datetime.datetime(2023, 12, 14, 10, 32, 18, 655849) and to_date = datetime.datetime(2023, 12, 14, 13, 17, 6, 884108). it will return candles like below:
date open high low close volume
0 2023-12-14 10:32:18+05:30 21253.50 21255.95 21235.00 21241.05 78200
1 2023-12-14 10:37:18+05:30 21241.05 21244.00 21232.10 21238.90 39100
2 2023-12-14 10:42:18+05:30 21238.90 21247.40 21228.55 21242.55 65300
3 2023-12-14 10:47:18+05:30 21242.55 21258.80 21242.55 21253.60 56350
4 2023-12-14 10:52:18+05:30 21253.60 21259.00 21242.55 21249.25 39500
5 2023-12-14 10:57:18+05:30 21249.25 21253.40 21245.80 21249.95 23650
6 2023-12-14 11:02:18+05:30 21250.00 21252.20 21245.60 21252.20 18500
7 2023-12-14 11:07:18+05:30 21252.20 21255.00 21247.00 21253.25 25800
8 2023-12-14 11:12:18+05:30 21253.25 21257.30 21246.00 21254.20 34500
9 2023-12-14 11:17:18+05:30 21254.20 21254.20 21245.10 21245.10 17050
10 2023-12-14 11:22:18+05:30 21245.10 21255.20 21245.10 21248.00 25500
11 2023-12-14 11:27:18+05:30 21248.00 21248.70 21242.30 21246.05 18200
12 2023-12-14 11:32:18+05:30 21246.05 21254.90 21245.20 21252.85 27750
13 2023-12-14 11:37:18+05:30 21252.00 21267.60 21250.00 21264.25 62300
14 2023-12-14 11:42:18+05:30 21265.00 21268.00 21260.30 21265.45 42450.....
so just a simple solution is to replace seconds as 0 in datetime object.
Hope this helps.