diff --git a/freqtrade/configuration/__init__.py b/freqtrade/configuration/__init__.py index aa06a70c9..8fe65a9b0 100644 --- a/freqtrade/configuration/__init__.py +++ b/freqtrade/configuration/__init__.py @@ -1,5 +1,6 @@ # flake8: noqa: F401 +from freqtrade.configuration.asyncio_config import asyncio_setup from freqtrade.configuration.config_secrets import sanitize_config from freqtrade.configuration.config_setup import setup_utils_configuration from freqtrade.configuration.config_validation import validate_config_consistency diff --git a/freqtrade/configuration/asyncio_config.py b/freqtrade/configuration/asyncio_config.py new file mode 100644 index 000000000..0fdfe51ad --- /dev/null +++ b/freqtrade/configuration/asyncio_config.py @@ -0,0 +1,9 @@ +import asyncio +import sys + + +def asyncio_setup() -> None: + # Set eventloop for win32 setups + + if sys.platform == "win32": + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy) diff --git a/freqtrade/main.py b/freqtrade/main.py index 8161e20a6..67584c5b7 100755 --- a/freqtrade/main.py +++ b/freqtrade/main.py @@ -15,6 +15,7 @@ if sys.version_info < (3, 9): # pragma: no cover from freqtrade import __version__ from freqtrade.commands import Arguments +from freqtrade.configuration import asyncio_setup from freqtrade.constants import DOCS_LINK from freqtrade.exceptions import ConfigurationError, FreqtradeException, OperationalException from freqtrade.loggers import setup_logging_pre @@ -33,6 +34,7 @@ def main(sysargv: Optional[List[str]] = None) -> None: return_code: Any = 1 try: setup_logging_pre() + asyncio_setup() arguments = Arguments(sysargv) args = arguments.get_parsed_arg()