Getting weekly and monthly data OHLC candles by using historical data API ?

ravimeetra
ravimeetra edited May 2020 in Python client
Hi Team ,
1.
In our historical data API , the function call is

def historical_data(self, instrument_token, from_date, to_date, interval, continuous=False, oi=False)

The candle record interval. Possible values are:
· minute
· day
· 3minute
· 5minute
· 10minute
· 15minute
· 30minute
· 60minute
Do we not have the option of interval for week and month candles.

How can we get the weekly and monthly candles with this API call?

2.
Also when we make calls for historical data with different intervals , from what time is the initial data set to .What I mean is say I want to get 5 minute candle data from 2020-04-01 10 :03 :04 (10 hrs , 3 mins 04 sec) to 2020-04-19 11:04:02 (11 hrs, 04 mins ,02 sec).
So will the start candle start from 10:03:04 or 10 :03:00 or 10:05 :00 . Also at what interval will it end on . Please clarify both ..
What happens if the requested date for starting or ending is a holiday.?

Hope the questions are clear
3. Also how the data is stored in your system , that is, Is it continuous data from 9:00 to 3:30 each day and all holidays excluded ?

Thanks
  • ravimeetra
    Adding one more question to it:
    4.If on today during live trading hours i.e between 9:15 and before 3:30 , if I call the historical function with interval as "day". Will today's candle be included in that. If so why and what will be the values for the current days candle.

    Same goes for other time intervals , say if I call "30 min" interval and the time is 9:18and I call historical function with 30 minute interval . will this candle include today's candle ,if so what will be the values for the same.
  • rakeshr
    @ravimeetra
    Do we not have the option of interval for week and month candles.
    No
    How can we get the weekly and monthly candles with this API call?
    You need to generate weekly or monthly candles at your end using day candle data. You can have the required logic/loop to accumulate 7 days or 30 days of data at your end and generate OHLC for weekly or monthly candles.
  • rakeshr
    rakeshr edited May 2020
    I want to get 5 minute candle data from 2020-04-01 10 :03 :04 (10 hrs , 3 mins 04 sec) to 2020-04-19 11:04:02 (11 hrs, 04 mins ,02 sec)..So will the start candle start from 10:03:04 or 10 :03:00 or 10:05 :00 . Also at what interval will it end on . Please clarify both ..
    Data will from 10:04 to 11:05 and will be grouped into defined 5-minute candles(10:00,10:05,10:1,....,10:55,11:00,etc).
    What happens if the requested date for starting or ending is a holiday.?
    We show the required historical data available between the requested period. If both to and from lies on the same day as a holiday, it will return a blank array.
  • rakeshr
    Also how the data is stored in your system, that is, Is it continuous data from 9:00 to 3:30 each day and all holidays excluded ?
    We store minute wise on the trading day for the trading period. Rest other 5 minutes, 10 minutes, etc candles are formed from them.

  • rakeshr
    If on today during live trading hours i.e between 9:15 and before 3:30 , if I call the historical function with interval as "day". Will today's candle be included in that. If so why and what will be the values for the current days candle.
    Yes, it will show today's candle as well, if today's date lies between to and from in the requested interval.
    OHLCV value will be shown up till API request time.
    But, we strongly recommend not to use Historical data APIs for frequent polling during the llve trading hours as it's not designed for that.
    Instead, you can form candle at your end using streaming data from WebSocket. Go through this thread.
  • ravimeetra
    Thanks rakesh!!
This discussion has been closed.