Support Board
Date/Time: Tue, 26 Nov 2024 00:52:23 +0000
[Programming Help] - Invalid AccountBalanceUpdate Json message received from DTC Server
View Count: 403
[2024-01-17 14:15:46] |
User218244 - Posts: 21 |
My DTC Client application received (at 08:15:48 EST) the following invalid AccountBalanceUpdate Json message from Sierra Chart DTC Server: "{"Type":600,"RequestID":0,"CashBalance":6181.82,"BalanceAvailableForNewPositions":6310.039954021857,"SecuritiesValue":6310.039954021857,"MarginRequirement":0,"TotalNumberMessages":1,"MessageNumber":1,"NoAccountBalances":0,"Unsolicited":1,"OpenPositionsProfitLoss":0,"DailyProfitLoss":128.219996971339,"AccountCurrency":"USD","TradeAccount":"******","InfoText":"Cash Balance update | Cash balance adjustment | Account: ****** | Balance: 6310.04 | EODAccountValueUsingOpenProfitLossBasedOnSettlement: 6310.04 | AccountValueCaptureTime: none UTC | BalanceFromFirmImportFile: 6181.82 | Change: -128.22 | New NLV: 6181.82 | RecalculateDailyLossLimit: Yes"
Note, in particular, that there is no closing parenthesis to the message and I believe is missing a null terminator. For what its worth, this is the exact Exception from my application: System.ArgumentException: Cannot parse line "{"Type":600,"RequestID":0,"CashBalance":6181.82,"BalanceAvailableForNewPositions":6310.039954021857,"SecuritiesValue":6310.039954021857,"MarginRequirement":0,"TotalNumberMessages":1,"MessageNumber":1,"NoAccountBalances":0,"Unsolicited":1,"OpenPositionsProfitLoss":0,"DailyProfitLoss":128.219996971339,"AccountCurrency":"USD","TradeAccount":"******","InfoText":"Cash Balance update | Cash balance adjustment | Account: ****** | Balance: 6310.04 | EODAccountValueUsingOpenProfitLossBasedOnSettlement: 6310.04 | AccountValueCaptureTime: none UTC | BalanceFromFirmImportFile: 6181.82 | Change: -128.22 | New NLV: 6181.82 | RecalculateDailyLossLimit: Yes" into SierraChart Message "JsonMessage".
---> System.Text.Json.JsonException: Expected end of string, but instead reached end of data. Path: $.InfoText | LineNumber: 0 | BytePositionInLine: 649. ---> System.Text.Json.JsonReaderException: Expected end of string, but instead reached end of data. LineNumber: 0 | BytePositionInLine: 649. Date Time Of Last Edit: 2024-01-17 19:16:29
|
[2024-01-17 15:42:19] |
Sierra_Chart Engineering - Posts: 17178 |
The problem looks like it is on your side. Maybe you are not able to handle the longer JSON message.
Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2024-01-17 19:15:01] |
User218244 - Posts: 21 |
Investigating further, if it is not on your side as you claim, then my best guess is that it was some transient inter-process TCP issue. Of the millions of such TCP messages I've received with this setup, this is the first time such a missing data issue has occurred. Will continue to monitor.
|
[2024-01-17 20:46:27] |
Sierra_Chart Engineering - Posts: 17178 |
We definitely do not see this is as a problem on the Sierra Chart side. We do not see how that could even be the case.
Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2024-01-18 00:24:03] |
User218244 - Posts: 21 |
The end of day account balance at my FCM and showing in Sierra Chart, based on today's trade activity, is incorrect. This is also the first time that has happened. It might be a coincidence, but I suspect not. However, I will have to wait until business hours tomorrow to contact their back office.
|
[2024-01-18 02:26:38] |
Sierra_Chart Engineering - Posts: 17178 |
Yes we are familiar with this. Regarding AMP accounts. This will be correct tonight from what we understand.
Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2024-01-18 05:16:08] |
User218244 - Posts: 21 |
The exact same issue just happened again (at 23:45:52 EST) with another invalid AccountBalanceUpdate Json message: {"Type":600,"RequestID":0,"CashBalance":6215.840000558792,"BalanceAvailableForNewPositions":6087.6200019893,"SecuritiesValue":6087.6200019893,"MarginRequirement":0,"TotalNumberMessages":1,"MessageNumber":1,"NoAccountBalances":0,"Unsolicited":1,"OpenPositionsProfitLoss":0,"DailyProfitLoss":-27.079999441206454,"AccountCurrency":"USD","TradeAccount":"******","InfoText":"Cash Balance update | Cash balance adjustment | Account: ****** | Balance: 6087.62 | EODAccountValueUsingOpenProfitLossBasedOnSettlement: 6114.70 | AccountValueCaptureTime: 2024-01-17 22:55:00 UTC | BalanceFromFirmImportFile: 6242.92 | Change: 128.22 | New NLV: 6242.92 | RecalculateDailyLossLimit: Yes
I see that both of these are "Cash Balance update | Cash balance adjustment" messages of different lengths, and both of them end prematurely exactly after "RecalculateDailyLossLimit: Yes". I suspect that a null character is unintentionally placed after the "Yes" on your end, prematurely ending the message, for these rare types of AccountBalanceUpdate messages. Date Time Of Last Edit: 2024-01-18 05:23:54
|
[2024-01-18 09:04:36] |
Sierra_Chart Engineering - Posts: 17178 |
We do not see how this is a problem on the Sierra Chart side. Are you using a websocket connection?
Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2024-01-18 13:43:23] |
User218244 - Posts: 21 |
I am using a standard Windows socket for IPC with the Sierra Chart DTC Server. Each Json message is simply read from the socket until a null terminator (numeric zero byte) is encountered. As this issue has happened twice, with the message terminating early exactly after "RecalculateDailyLossLimit: Yes", at different positions in the "Cash balance adjustment" Json message (of lengths 649 and 673), the most likely explanation to me is that a null terminator is inadvertently being send by the DTC Server after the "RecalculateDailyLossLimit: Yes" part of the message. One possibility, for example, is related to the fact that in the DTCProtocol.h file the InfoText is defined as being of 96 characters length: const int32_t TEXT_DESCRIPTION_LENGTH = 96;
... char InfoText[TEXT_DESCRIPTION_LENGTH] = {}; whereas the actual partial InfoText received in the above messages were of length 289 and 304, respectively, indicating a possible overflow into memory set to zero. Another possibility is that the entire InfoText string is being encoded into the "Cash balance adjustment" Json message, including its own string null terminator. There are, of course, many other possibilities of how a numeric zero byte could inadvertently be in the Json InfoText value. Date Time Of Last Edit: 2024-01-18 13:54:08
|
To post a message in this thread, you need to log in with your Sierra Chart account: