Codaone / DEXBot

Trading Bot for the BitShares Decentralized Exchange
Other
247 stars 127 forks source link

Develop plugin-like infrastructure #500

Open bitphage opened 5 years ago

bitphage commented 5 years ago

We need to run a non-market worker tasks inside dexbot, like history downloading or analysis workers or whatever.

To achieve this, we may extend WorkerInfrastructure() class by importing and launching "plugin" tasks.

bitphage commented 5 years ago

I researched this topic a bit. In current WorkerInfrastructure() it's possible to initialize plugin tasks as a regular workers and allow them to set subscribe callbacks. Later, it will require a major refactoring when switching to asyncio core.

Another approach is to write plugins in async manner and run them inside a separate thread with dedicated asyncio loop. Example: https://hackernoon.com/controlling-python-async-creep-ec0a0f4b79ba . This will require much less refactoring later. Caveat: pybitshares is not thread-safe, so plugin thread will require a separate BitShares() instance.