Last Candle Missing in Historical Hourly Data

infoankit10
Hello Guys,

I am using the Python Kiteconnect package to fetch historical hourly candle data and I found that the last data candle (after 3:15 PM) is missing for all days. Which is breaking the continuity for my data analysis. For reference please have a look at below sample result of the last 3 days' data for AARTIIND stock.

Also, I am not sure about the role of the 9:15 AM daily candle i.e. what is it signify?

77 1226.00 2021-02-12 09:15:00+05:30 1229.95 1211.95 1211.95 61952
78 1217.70 2021-02-12 10:15:00+05:30 1226.75 1214.00 1226.45 32108
79 1224.75 2021-02-12 11:15:00+05:30 1237.00 1217.70 1218.00 116307
80 1219.60 2021-02-12 12:15:00+05:30 1226.00 1214.00 1223.80 35875
81 1211.55 2021-02-12 13:15:00+05:30 1221.00 1205.00 1219.55 44360
82 1213.25 2021-02-12 14:15:00+05:30 1219.85 1211.00 1211.55 19594
83 1210.05 2021-02-12 15:15:00+05:30 1216.00 1210.00 1214.95 10997
84 1220.55 2021-02-15 09:15:00+05:30 1235.00 1214.65 1220.05 27267
85 1219.30 2021-02-15 10:15:00+05:30 1225.00 1218.80 1220.55 58567
86 1219.20 2021-02-15 11:15:00+05:30 1221.00 1215.50 1220.00 21232
87 1215.50 2021-02-15 12:15:00+05:30 1219.90 1215.00 1218.45 58976
88 1215.05 2021-02-15 13:15:00+05:30 1216.00 1209.95 1215.50 40089
89 1219.05 2021-02-15 14:15:00+05:30 1219.70 1214.50 1215.05 33886
90 1215.00 2021-02-15 15:15:00+05:30 1220.60 1213.00 1220.35 21239
91 1216.20 2021-02-16 09:15:00+05:30 1221.95 1211.40 1221.95 26250
92 1210.95 2021-02-16 10:15:00+05:30 1217.00 1208.00 1216.20 24403
93 1215.00 2021-02-16 11:15:00+05:30 1216.00 1210.05 1210.95 80378
94 1215.50 2021-02-16 12:15:00+05:30 1215.95 1215.00 1215.00 20357
95 1219.95 2021-02-16 13:15:00+05:30 1220.00 1215.50 1215.50 15421
96 1227.05 2021-02-16 14:15:00+05:30 1230.70 1219.00 1219.95 68200
97 1229.00 2021-02-16 15:15:00+05:30 1229.00 1227.00 1227.05 24606


Any help?
  • rakeshr
    @infoankit10
    found that the last data candle (after 3:15 PM) is missing for all days
    For hourly candle, 3:15 PM will be start candle(as market closes at 3:30 PM for equity market).
    The first candle will be at market start i.e 9:15 AM and then an hourly candle keeps forming for the next period i.e 10:15, 11:15, ..
  • infoankit10
    @rakeshr Thank you for your revert. But doesn't it break the data continuity and how I will get the data between 3:15 PM to 3:30 PM?

    I have tried a few other brokers APIs and their data looks like below and it makes more sense:

    "2021-02-17,15:30:00",1194.55,1196.25,1189.45,1194.00,115694,1380.59,199,
    "2021-02-17,15:14:58",1196.75,1201.90,1193.45,1194.55,237969,2849.12,657,
    "2021-02-17,14:14:58",1195.10,1197.20,1183.50,1197.00,230141,2740.28,650,
    "2021-02-17,13:14:59",1198.45,1199.75,1187.95,1195.40,269681,3219.35,689,
    "2021-02-17,12:14:59",1198.00,1204.50,1197.00,1198.00,267216,3209.08,657,
    "2021-02-17,11:15:00",1222.60,1223.05,1196.35,1198.15,387495,4694.48,696,
    "2021-02-17,10:14:59",1220.40,1231.90,1199.35,1222.25,1058657,12876.11,851,
    "2021-02-16,15:30:00",1215.60,1222.00,1214.50,1220.60,265958,3242.30,228,
    "2021-02-16,15:14:57",1199.90,1218.60,1198.20,1216.00,548501,6625.21,762,
    "2021-02-16,14:14:59",1197.50,1202.95,1194.45,1199.95,241700,2898.54,776,
    "2021-02-16,13:14:59",1203.00,1206.55,1190.35,1197.50,381668,4577.36,713,
    "2021-02-16,12:14:59",1198.00,1205.30,1194.50,1202.05,639051,7663.55,726,
    "2021-02-16,11:15:00",1209.80,1210.25,1193.30,1198.30,593252,7112.37,756,
    "2021-02-16,10:14:56",1173.00,1216.00,1163.50,1210.80,1044709,12465.13,856,
    "2021-02-15,15:30:00",1174.95,1176.00,1167.70,1173.00,91760,1074.84,177,
    "2021-02-15,15:14:57",1171.85,1179.00,1169.80,1175.45,213088,2501.12,593,
    "2021-02-15,14:14:57",1172.60,1173.00,1168.30,1171.75,115866,1356.70,475,
    "2021-02-15,13:14:59",1168.65,1175.00,1165.75,1172.55,597410,6990.14,618,
    "2021-02-15,12:14:58",1167.90,1171.00,1163.00,1168.75,182955,2136.10,610,
    "2021-02-15,11:14:57",1164.05,1176.70,1158.15,1167.50,530988,6204.77,766,
    "2021-02-15,10:15:00",1154.90,1165.00,1137.40,1164.90,445597,5135.38,772,


    Please let me know your further thoughts on this?
  • rakeshr
    how I will get the data between 3:15 PM to 3:30 PM?
    You are missing the candle formation logic. The first hourly candle of 9:15 AM is formed for the period between 09:15 AM to 10:14:59 AM. So, 3:15 PM candle is formed for the last period between 3:15 PM to 3:30 PM.
  • infoankit10
    @rakeshr are you sure about this?

    Because if this is the case then Zerodha's 3:15 PM candle data should match with other vendor's 3:30 PM data.

    I have provided the sample data below from Zerodha and Spider broker and you can notice the difference between 2021-02-11,15:30:00 and 2021-02-11 15:15:00

    Date Open High Low Close
    2021-02-11,10:15:00 1142.80 1145.45 1136.70 1137.15
    2021-02-11,11:15:00 1137.15 1147.00 1133.50 1146.50
    2021-02-11,12:14:56 1146.95 1151.00 1141.00 1148.55
    2021-02-11,13:14:56 1148.10 1154.50 1146.00 1152.05
    2021-02-11,14:15:00 1152.50 1152.50 1145.10 1149.50
    2021-02-11,15:15:00 1149.50 1157.60 1149.05 1156.20
    2021-02-11,15:30:00 1156.55 1158.50 1150.95 1153.00
    2021-02-12,10:14:52 1158.80 1163.95 1151.00 1156.00
    2021-02-12,11:15:00 1156.45 1157.90 1153.05 1155.75
    2021-02-12,12:14:58 1156.10 1157.90 1143.40 1148.75
    2021-02-12,13:14:51 1148.00 1155.75 1141.65 1143.55
    2021-02-12,14:14:58 1143.35 1143.75 1128.05 1130.45
    2021-02-12,15:14:55 1129.70 1144.85 1129.00 1144.70
    2021-02-12,15:30:00 1144.70 1149.80 1141.90 1145.20


    Date Open High Low Close
    2021-02-11 09:15:00 1142.80 1145.45 1136.75 1137.15
    2021-02-11 10:15:00 1137.15 1147.00 1133.50 1146.50
    2021-02-11 11:15:00 1147.00 1151.00 1141.00 1148.55
    2021-02-11 12:15:00 1148.55 1154.50 1146.00 1152.05
    2021-02-11 13:15:00 1152.05 1152.50 1145.10 1149.55
    2021-02-11 14:15:00 1149.50 1157.55 1149.00 1156.80
    2021-02-11 15:15:00 1156.20 1158.45 1150.30 1154.00
    2021-02-12 09:15:00 1158.80 1163.65 1151.00 1156.00
    2021-02-12 10:15:00 1156.45 1157.90 1152.40 1155.75
    2021-02-12 11:15:00 1155.75 1158.00 1143.50 1148.75
    2021-02-12 12:15:00 1148.75 1155.75 1141.65 1143.55
    2021-02-12 13:15:00 1143.55 1143.75 1128.05 1130.00
    2021-02-12 14:15:00 1130.00 1144.85 1129.00 1144.70
    2021-02-12 15:15:00 1144.70 1149.90 1141.85 1145.20


    Do let me know if that makes any logic to you and any further inputs from your side?

    Thanks
    Ankit
  • rakeshr
    are you sure about this?
    Yes, that's how we form the candle.
    Because if this is the case then Zerodha's 3:15 PM candle data should match with other vendor's 3:30 PM data.
    No, values can differ between two different charting platforms. Go through this article to know more about this difference.
  • infoankit10
    @rakeshr if I accept your understanding for a moment and as you said for example 01:15 PM candle will represent the data between 01:15 PM to 02:15 PM.

    It means I should not receive this candle in historical data until 02:15 PM.

    But, here is another twist, I just fetch the historical data from Kite and it returned me the following results:

    close date high low open volume
    1237.95 2021-02-19 09:15:00+05:30 1239.90 1228.90 1234.30 24272
    1226.25 2021-02-19 10:15:00+05:30 1238.00 1224.45 1237.95 69989
    1220.00 2021-02-19 11:15:00+05:30 1226.25 1216.80 1226.25 51123
    1220.50 2021-02-19 12:15:00+05:30 1222.35 1219.00 1220.00 14419
    1197.10 2021-02-19 13:15:00+05:30 1220.65 1195.05 1220.50 34021


    So how it could return the 13:15:00 result before 14:15:00 PM?

    Any further thoughts?
  • rakeshr
    It means I should not receive this candle in historical data until 02:15 PM.
    No, you will start receiving the candle data post 01:15 PM i.e these candles are still forming/live, not yet completed. So, if you query the 01:15 PM hour candle multiple times before its completion i.e 02:15 PM. You will see, HLC(high, low, and close) value being changing i.e forming live.
  • amr
    amr edited January 4
    @rakeshr Considering 15 minute candles, if 9:15 candle has the values for 9:15-9:30 (or 9:29:59) then what is the value for 9:15 (that is the 9:00 to 9:15 candle)?

    and why the kite app doesn't follow this logic in its charts? Shouldn't the app also show 15:30 candles in all minute/hour time frames?
Sign In or Register to comment.