@admin and Team,
I had spent sometime in python SDK to see whats the issue. In the SmartWebSocketV2 file in GitHub (https://github.com/angel-one/smartapi-python/blob/AMX-3393-Smart-Api-Python-Library/SmartApi/smartWebSocketV2.py )
line 310 that is converting byte string to token is not working. If I simply comment it out and give the token number directly it can now print Ticks.
def _parse_binary_data(self, binary_data):
try:
parsed_data = {
"subscription_mode": self._unpack_data(binary_data, 0, 1, byte_format="B")[0],
"exchange_type": self._unpack_data(binary_data, 1, 2, byte_format="B")[0],
#"token": SmartWebSocketV2._parse_token_value(binary_data[2:27]),
"token": 234876,
"sequence_number": self._unpack_data(binary_data, 27, 35, byte_format="q")[0],
"exchange_timestamp": self._unpack_data(binary_data, 35, 43, byte_format="q")[0],
"last_traded_price": self._unpack_data(binary_data, 43, 51, byte_format="q")[0]
}
lines 353 to 360. This functions needs a re look.
@staticmethod
def _parse_token_value(binary_packet):
token = ""
for i in range(len(binary_packet)):
if binary_packet[i] == b'\x00':
return token
token += binary_packet[i].encode("UTF-8")
return token
I could re write the function but I would request the team to have a look .