diff options
Diffstat (limited to 'services/order-executor/src/order_executor/main.py')
| -rw-r--r-- | services/order-executor/src/order_executor/main.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/services/order-executor/src/order_executor/main.py b/services/order-executor/src/order_executor/main.py index 7f0578d..ab6ef4f 100644 --- a/services/order-executor/src/order_executor/main.py +++ b/services/order-executor/src/order_executor/main.py @@ -1,4 +1,5 @@ """Order Executor Service entry point.""" + import asyncio from decimal import Decimal @@ -21,7 +22,9 @@ async def run() -> None: config = ExecutorConfig() log = setup_logging("order-executor", config.log_level, config.log_format) metrics = ServiceMetrics("order_executor") - notifier = TelegramNotifier(bot_token=config.telegram_bot_token, chat_id=config.telegram_chat_id) + notifier = TelegramNotifier( + bot_token=config.telegram_bot_token, chat_id=config.telegram_chat_id + ) db = Database(config.database_url) await db.connect() @@ -69,12 +72,18 @@ async def run() -> None: event = Event.from_dict(msg) if event.type == EventType.SIGNAL: signal = event.data - log.info("processing_signal", signal_id=str(signal.id), symbol=signal.symbol) + log.info( + "processing_signal", signal_id=str(signal.id), symbol=signal.symbol + ) await executor.execute(signal) - metrics.events_processed.labels(service="order-executor", event_type="signal").inc() + metrics.events_processed.labels( + service="order-executor", event_type="signal" + ).inc() except Exception as exc: log.error("message_processing_failed", error=str(exc)) - metrics.errors_total.labels(service="order-executor", error_type="processing").inc() + metrics.errors_total.labels( + service="order-executor", error_type="processing" + ).inc() if messages: # Advance last_id to avoid re-reading — broker.read returns decoded dicts, # so we track progress by re-reading with "0" for replaying or "$" for new only. |
