From 2d7dcca15c71ad0d3efcf5433d44643a43c3f82d Mon Sep 17 00:00:00 2001 From: Raphael Deem Date: Wed, 24 Jul 2024 17:07:13 -0700 Subject: [PATCH] sync futures more --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 735d172..50d721c 100644 --- a/main.py +++ b/main.py @@ -9,7 +9,7 @@ from ui.app import create_app from utils.config import parse_config, initialize_brokers, initialize_strategies from utils.logger import logger # Import the logger -from utils.utils import is_market_open +from utils.utils import is_market_open, is_futures_market_open from data.sync_worker import sync_worker # Import the sync worker SYNC_WORKER_INTERVAL_SECONDS = 60 * 5 @@ -173,6 +173,8 @@ async def start_sync_worker(config_path): logger.info('Sync worker started successfully') if is_market_open(): await asyncio.sleep(SYNC_WORKER_INTERVAL_SECONDS) + elif config.get('futures_enabled', False) and is_futures_market_open(): + await asyncio.sleep(SYNC_WORKER_INTERVAL_SECONDS) else: logger.info('Market is closed, sleeping for 30 minutes') await asyncio.sleep(60 * 30)