symphony.bdk.core.service.datafeed.abstract_datafeed_loop.AbstractDatafeedLoop#
- class symphony.bdk.core.service.datafeed.abstract_datafeed_loop.AbstractDatafeedLoop(datafeed_api: symphony.bdk.gen.agent_api.datafeed_api.DatafeedApi, session_service: symphony.bdk.core.service.session.session_service.SessionService, auth_session: symphony.bdk.core.auth.auth_session.AuthSession, config: symphony.bdk.core.config.model.bdk_config.BdkConfig)#
Bases:
abc.ABC
Base class for implementing the datafeed services.
A datafeed services can help a bot subscribe or unsubscribe to a RealTimeEventListener and handle the received event by the subscribed listeners.
- __init__(datafeed_api: symphony.bdk.gen.agent_api.datafeed_api.DatafeedApi, session_service: symphony.bdk.core.service.session.session_service.SessionService, auth_session: symphony.bdk.core.auth.auth_session.AuthSession, config: symphony.bdk.core.config.model.bdk_config.BdkConfig)#
- Parameters
datafeed_api – DatafeedApi to request the service
session_service – the SessionService to get user session information
auth_session – the AuthSession instance used to get session and key manager tokens
config – the bot configuration
Methods
__init__
(datafeed_api, session_service, ...)- param datafeed_api
DatafeedApi to request the service
start
()Start the datafeed event service
stop
([hard_kill, timeout])Stop the datafeed event service
subscribe
(listener)Subscribes a new listener to the datafeed loop instance.
unsubscribe
(listener)Removes a given listener from the datafeed loop instance.
- abstract async start()#
Start the datafeed event service
- Returns
None
- async stop(hard_kill: bool = False, timeout: Optional[float] = None)#
Stop the datafeed event service
- Parameters
hard_kill – if set to True, tasks running listener methods will be cancelled immediately. Otherwise, tasks will be awaited until completion.
timeout – timeout in seconds to wait for tasks completion when loop stops. None means wait until completion. Ignored if hard_kill set to True.
- Returns
None
- subscribe(listener: symphony.bdk.core.service.datafeed.real_time_event_listener.RealTimeEventListener)#
Subscribes a new listener to the datafeed loop instance.
- Parameters
listener – the RealTimeEventListener to be added.
- unsubscribe(listener: symphony.bdk.core.service.datafeed.real_time_event_listener.RealTimeEventListener)#
Removes a given listener from the datafeed loop instance.
- Parameters
listener – the RealTimeEventListener to be removed.