bmoscon / cryptofeed

Cryptocurrency Exchange Websocket Data Feed Handler
Other
2.14k stars 666 forks source link

How to use Restful API (POST) to control the status of Feedhandler? #1026

Open mauyin opened 2 months ago

mauyin commented 2 months ago

Hi all, currently I am implement a Django API server to control the status of Feedhandler, I want to send POST request to and the request are like this {"action": "run"}, {"action":"close"}, to start / close the feedhandler, but when I try running the server together with the feedhandler, the error occur:

RuntimeError: There is no current event loop in thread 'Thread-1 (process_request_thread)'.

and I cannot close the feedhandler gracefully, and I cannot start again after closing the feedhandler.

Could I ask for some advise on how to construct a API client to trigger and stop the feedhandler? Thank you

globophobe commented 2 months ago

Can you send curl requests to whatever api you’ve implemented with cryptofeed?

bmoscon commented 2 months ago

what you are describing is not supported by the library