From 9948723e1afbea2fa56327f70821ea75b4b64688 Mon Sep 17 00:00:00 2001 From: Raphael Deem Date: Sun, 24 Nov 2024 23:10:51 -0800 Subject: [PATCH] fix init --- order_manager/manager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/order_manager/manager.py b/order_manager/manager.py index bf3469e..18216d4 100644 --- a/order_manager/manager.py +++ b/order_manager/manager.py @@ -2,8 +2,9 @@ from utils.logger import logger class OrderManager: - async def __init__(self, engine, brokers): + def __init__(self, engine, brokers): logger.info('Initializing OrderManager') + self.engine = engine self.db_manager = DBManager(engine) self.brokers = brokers @@ -11,6 +12,7 @@ async def reconcile_orders(self, orders): logger.info('Reconciling orders', extra={'orders': orders}) for order in orders: await self.reconcile_order(order) + # Commit the transaction async def reconcile_order(self, order): logger.info(f'Reconciling order {order.id}', extra={'order_id': order.id, 'broker': order.broker, 'symbol': order.symbol, 'quantity': order.quantity, 'price': order.price, 'side': order.side, 'status': order.status, 'type': order.type, 'time_in_force': order.time_in_force, 'created_at': order.created_at, 'updated_at': order.updated_at, 'filled_at': order.filled_at, 'filled_quantity': order.filled_quantity, 'remaining_quantity': order.remaining_quantity, 'canceled_at': order.canceled_at, 'failed_at': order.failed_at, 'message': order.message})