I am currently using Elektron feed to get real-time information about prices for different RIC codes. The sample code I got from this link https://github.com/Refinitiv/websocket-api/tree/master/Applications/Examples/python
I added extra modules and modified slightly a code:
_send_market_price_request(self, ric_name) - Inserted RIC codes manually
_on_message(self, message) - I added part which should save the message information to my database
When I do not add part which saves information to my db, I can see JSON messages in the output console from this line
print(message_json)
However, if I modify it as:
print(message_json) cur.execute("""INSERT INTO ENK_OP.ENKadhoc (DataDateTime,Name,MyValueOne) VALUES (cast(TIMESTAMP 'NOW' as date), '{0}', '{1}')""" .format( message_json[0]['Key'].get('Name', 'Unknown'), 1000 )) cur.execute("commit;")
I cannot see any output from print(message_json) and the code starts relogin/get new token every 10 sec.
Could you help to identify why this problem arises, as I believe the save to my db code part should work and does not affect print() function.
My python code is available here: ELEKTRON.txt