Support Board
Date/Time: Tue, 11 Mar 2025 05:07:30 +0000
Post From: SerraChart as a DTC Protocol Client
[2023-11-03 16:46:25] |
d9e5c763 - Posts: 111 |
After the last post, the problems described above have been largely resolved. For the record, I'm writing down the key points I remember below: Do not use MARKET_DATA_UPDATE_TRADE to update trade data. This message type will ignore the millisecond data. Although I have not found this mentioned in the documentation or elsewhere, it is indeed the case. The solution is to use MARKET_DATA_UPDATE_TRADE_WITH_UNBUNDLED_INDICATOR_2. Although it also ignores the microseconds part of the data, this is clearly not a problem. Both message types will use the microseconds part to ensure that each trade data timestamp is unique. This is mentioned in the documentation section "Intraday Data File Format." The key to ensuring the continuity of real-time and historical data written to the SCID file is to ensure that historical data must include the latest trade data when sent after receiving a request, especially when EndDateTime is 0. Previously, I unnecessarily wrote a piece of code to ensure that MARKET_DATA_UPDATE_TRADE and HISTORICAL_PRICE_DATA_TICK_RECORD_RESPONSE data are connected and do not overlap, which seems unnecessary and could even disrupt Sierra Chart's own processing mechanism. Use HISTORICAL_PRICE_DATA_RECORD_RESPONSE instead of HISTORICAL_PRICE_DATA_TICK_RECORD_RESPONSE to send historical data, even for tick-level data. There's a detail not mentioned in the documentation and the proto file that initially led me to choose HISTORICAL_PRICE_DATA_TICK_RECORD_RESPONSE. It is known from the C++ header files that HISTORICAL_PRICE_DATA_RECORD_RESPONSE's t_DateTime can actually be t_DateTimeWithMicrosecondsInt. The software handles this automatically, so only by using HISTORICAL_PRICE_DATA_RECORD_RESPONSE can you send tick data with millisecond precision. Now, only on some very thinly traded products, such as those that only have a trade every few minutes, there may be inconsistencies between the data written to the SCID file and the actual data. However, these are easily detectable. Once detected, there's no problem as long as Sierra Chart re-downloads the data. The method of checking remains the same: extract the SCID data, generate the specified candlestick data, such as for 5 minutes, continuously produce a certain number, such as 5 bars of 5-minute candlestick data, and compare it with the exchange data. If there are inconsistencies, they always involve the physical trading volume being more than the server's. That is, there may be overlaps, but no cases of missing data. |