AutomationBot#
- class autofold.bot.AutomationBot(manifold_db_path, dev_api_endpoint=False)#
The AutomationBot is responsible for starting, stopping and maintaining threads and connections to the manifold API, manifold database and manifold subscriber. Additionally, AutomationBot is reponsible for maintaining, adding, removing, starting and stopping automations.
- Parameters:
manifold_db_path (str) – Required. The desired path for the manifold database.
dev_api_endpoint (bool) – Optional. Whether to use the dev.manifold.markets endpoint. Useful for testing. Requires an API key for dev.manifold.markets. Default is False.
Attributes:#
dev_api_endpoint: Whether to use the dev.manifold.markets endpointmanifold_api: The ManifoldAPI instancemanifold_db: The ManifoldDatabase instancemanifold_db_reader: The ManifoldDatabaseReader instancemanifold_db_writer: The ManifoldDatabaseWriter instancemanifold_subscriber: The ManifoldSubscriber instance
- get_id()#
- register_automation(automation_obj, automation_name, run_on_bot_start=True)#
Registers an automation with the bot.
- Parameters:
automation_obj (Strategy) – Required. The automation class to register. Must be a subclass of the Automation class.
automation_name (str) – Required. The name of the automation.
run_on_bot_start (bool) – Optional. Whether the automation should be automatically run when the bot first starts. Default True.
- Raises:
TypeError – if the automation is not a class type.
ValueError – if the automation is not a subclass of Automation.
Example:
bot = ManifoldBot() bot.register_automation(MyCustomAutomation)
- run_automation(automation_name)#
- start()#
- stop(*args)#
Stops the bot’s operation.
Shuts down the API, stops all running automations, and shuts down the thread pool and subscriber.