Shoonya-Dev / ShoonyaApi-py

139 stars 130 forks source link

'ft' in tick_data is not giving correct timestamp. #81

Closed JagdishKolhe closed 1 year ago

JagdishKolhe commented 1 year ago

In tick data, looks like it is 'feed time' sent in websocket stream is not proper, When I construct OLHC data using tick_data in my machine and try to match it with 1min candle data received using get_time_Series_data function, It has slight difference, this sight difference is due to incorrect 'ft' parameter sent in web-socket live stream

Shoonya-Dev commented 1 year ago

please share the data time series and feed ticks collected for us to analyze the same.

Shoonya-Dev commented 1 year ago

ft is the shoonya server time. time-series data is build with exchange time when available. Hence there will be a variance.

JagdishKolhe commented 1 year ago

Please give me a couple of days to produce it, currently, I am busy with some other important stuff, but once I get time I will share the results. Meanwhile, I am telling you how to recreate it.

Let's take the example data from https://github.com/Shoonya-Dev/ShoonyaApi-py#md-start_websocket 1) starting WebSocket with start_websocket() function 2) subscribe([instruments]) will give data feed.

For example quote event: 03-12-2021 11:54:44{'t': 'tk', 'e': 'NSE', 'ft':'****', 'tk': '11630', 'ts': 'NTPC-EQ', 'pp': '2', 'ls': '1', 'ti': '0.05', 'lp': '118.55', 'h': '118.65', 'l': '118.10', 'ap': '118.39', 'v': '162220', 'bp1': '118.45', 'sp1': '118.50', 'bq1': '26', 'sq1': '6325'} quote event: 03-12-2021 11:54:45{'t': 'tf', 'e': 'NSE', 'tk': '11630', 'ft':'****', 'lp': '118.45', 'ap': '118.40', 'v': '166637', 'sp1': '118.55', 'bq1': '3135', 'sq1': '30'} quote event: 03-12-2021 11:54:46{'t': 'tf', 'e': 'NSE', 'tk': '11630', 'lp': '118.60', 'ft':'****'}

In the above example, we are printing the timestamp of the local machine (whose time is synced with Internet timing): quote event: 03-12-2021 11:54:44 Also we will get 'ft' in feed time. These two timings do not match.

So, constructing OHLC candles using 'ft' or 'local machine time' gives me incorrect data to me.

if 'ft' is shoonya server time, can you please send the exchange_time in the feed?

another possibility, Can you guys please sync shoonya server time with the exchange server time? This will remove/reduce discrepancies in the timestamp

I will share the details log in a couple of days.