Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 19:14:34 +0000



Post From: SerraChart as a DTC Protocol Client

[2023-09-05 18:44:05]
d9e5c763 - Posts: 108
Upon further observation, I've discovered another reason why the data doesn't align correctly during multiple dis/connect dtc data feed. Although I am sending JSON data into Sierra Chart like this:
JSON data: {"Type": 107, "SymbolID": 1, "AtBidOrAsk": 2, "Price": 25731.2, "Volume": "7", "DateTime": 1693937669.857} | 2023-09-05 18:14:29.899
which includes millisecond-level information of type "t_DateTimeWithMilliseconds," I am certain that in the Time and Sales Window in Sierra Chart, I can only see data with second-level precision (even though the options can display numbers like .000001, it seems to be just an issue of floating-point precision).

Additionally, when reading the scid binary files, I find that the stored information also has second-level precision as the smallest unit. Although HISTORICAL_PRICE_DATA_REQUEST only supports "t_DateTime" precision, I can indeed determine the specific information to be passed by reading the tail of the scid file when I receive an HISTORICAL_PRICE_DATA_REQUEST. However, because there is millisecond-level precision loss in this process, I am unable to do so.

output_file_name = f"datas/{product}_OKX.scid"
record_struct = struct.Struct('Q f f f f I I I I')
record_length = struct.calcsize('Q f f f f I I I I')

with open(output_file_name, 'rb') as scid_file:
scid_file.seek(-record_length, os.SEEK_END)
record_data = scid_file.read(record_length)
timestamp, _, _, _, _, _, _, _, _ = struct.unpack('Q f f f f I I I I', record_data)
scid_last_timestamp = int((timestamp / 1000) + int((dt(1899, 12, 30) - dt(1970, 1, 1)).total_seconds() * 1000))
print(f"SCID LAST TIMESTAMP: {scid_last_timestamp}")

I recall that Sierra Chart had a major update in the past, involving changes to the SCID file format, requiring all files to be re-downloaded because the timestamp format had been altered. Could it be that JSON data doesn't support this level of time precision? Because it seems that there isn't such a problem with CME data feed
Date Time Of Last Edit: 2023-09-05 19:01:41