Wait for candle completion

ganeshv02
Hi Folks,

I am using historical_data api to get futures data every X seconds. I noticed that the trades are placed before the candle is fully formed which sometimes results in false trades. How do I wait for candle completion? I am using 3minute Bank Nifty chart.

Is there a simple way to achieve this using API or have to write python code to verify the minute % 3 ==0 to assume candle is formed?

any help is appreciated
  • rakeshr
    @ganeshv02
    We won't recommend using Historical data APIs to fetch live time constrain data, as it's not meant for the same. You should use Websocket streaming, go through this thread.
  • ganeshv02
    @rakeshr - Thanks for your response. The reason for using historical data api is - I need to calculate MACD (26,12,9) and RSI(14) for example so I need at least one month of data to get accurate figures. Isn't it ?
  • sujith
    @ganeshv02,
    You need to generate candles and store them at your end using the live market data provided via Websockets API.
  • sujith
    You can use that as the data source for your strategies.
Sign In or Register to comment.