save on_message data

I am working on the websocket python example:

https://github.com/Refinitiv/websocket-api/tree/master/Applications/Examples/EDP/python

I am running the websocket app. I am able to successfully get the response back and close the socket.

I need to collect all the responses while the socket is running and pass the data to another application after the socket is closed.

what would be a good way to do that?


Best Answer

  • Hello @kshishir,

    Elektron Websocket API offers complete flexibility in implementation, what you get is a json-formatted strings, and from the point of the response being received, any paradigm that works with json can be used.

    For example,

    You can put json in a message and send via any messaging that you prefer, this way is the most time-sensitive.

    You can put it in a database, this way requires designing a database structure, but is readily categorize-able and searchable.

    The simplest is probably writing it to a file and reading from a file:

    Read And Write JSON To A File

    Where you should be careful is if your app will re-distribute the streaming content to other users, real time data is exchange-fee-liable, any redistribution must be designed to be exchange-compliant.

Answers