Converting Websocket Tick Data to OHLC Candlesticks for different timeframes.

I went through several discussions around this topic but did not find something that solved my problem. Currently I fetch the Historical 15 min Candles from the Kite api (from let's say 20 days ago to now) and then run my TA strategy on it. I am also using the Websockets to store the tick data using separate threads into InfluxDB. For Live trading, I need to update the Historical TimeSeries Data with the new candles. Here lies the problem.

a) How do I tie the 2 together. (Basically Generate the new Candlesticks and then append it to the Historical Candles as how do i guarantee the times - of where the Historical Candles Data ended and where to add the new Live candles)
b) Any good code-piece in Java for converting Tick Data to Candle Data. (Also is it better to do this in memory in Java or pull data from InfluxDb) ?

Warm Regards,
  • sujith
    We don't have code for this.
    You can go through this thread to get started.
  • phantomdrake
    Oh sure Sujith but i had gone through that thread. The more important questions is the timing issue between the Historical Data and Live Tick Data generated candles. How do you tie them up together ? Any good clues might help. Looking for a clean solution.
  • sujith
    You do get tick timestamp now. You can consider that to generate candles.
    A candle will contain OHLC formed using the logic mentioned in that thread.
    You will dump these candle data in your database and use it for all your calculations.
Sign In or Register to comment.