mgbam commited on
Commit
a94a20c
Β·
verified Β·
1 Parent(s): 6a1e668

Update app/app.py

Browse files
Files changed (1) hide show
  1. app/app.py +3 -4
app/app.py CHANGED
@@ -8,7 +8,7 @@ import asyncio
8
  import os
9
  from contextlib import asynccontextmanager
10
  import json
11
- import time # Added import
12
  from datetime import datetime, timezone
13
 
14
  import httpx
@@ -16,7 +16,7 @@ import socketio
16
  from fastapi import FastAPI
17
  from fastapi.staticfiles import StaticFiles
18
 
19
- # Relative imports now work perfectly because of the package structure
20
  from .price_fetcher import PriceFetcher
21
  from .arbitrage_analyzer import ArbitrageAnalyzer
22
  from .broker import signal_broker
@@ -31,7 +31,6 @@ socket_app = socketio.ASGIApp(sio)
31
  @asynccontextmanager
32
  async def lifespan(app: FastAPI):
33
  print("πŸš€ Initializing Sentinel Arbitrage Engine v10.0...")
34
- # Use a single httpx client for the application's lifespan
35
  async with httpx.AsyncClient() as client:
36
  app.state.price_fetcher = PriceFetcher(client)
37
  app.state.arbitrage_analyzer = ArbitrageAnalyzer(client)
@@ -49,7 +48,7 @@ async def lifespan(app: FastAPI):
49
  except asyncio.CancelledError: print("Engine shut down gracefully.")
50
 
51
  async def run_arbitrage_detector(price_fetcher, analyzer):
52
- """The core engine loop. Now directly emits events via Socket.IO."""
53
  last_opportunity_time = 0
54
  while True:
55
  try:
 
8
  import os
9
  from contextlib import asynccontextmanager
10
  import json
11
+ import time
12
  from datetime import datetime, timezone
13
 
14
  import httpx
 
16
  from fastapi import FastAPI
17
  from fastapi.staticfiles import StaticFiles
18
 
19
+ # --- RELATIVE IMPORTS FOR PACKAGE STRUCTURE ---
20
  from .price_fetcher import PriceFetcher
21
  from .arbitrage_analyzer import ArbitrageAnalyzer
22
  from .broker import signal_broker
 
31
  @asynccontextmanager
32
  async def lifespan(app: FastAPI):
33
  print("πŸš€ Initializing Sentinel Arbitrage Engine v10.0...")
 
34
  async with httpx.AsyncClient() as client:
35
  app.state.price_fetcher = PriceFetcher(client)
36
  app.state.arbitrage_analyzer = ArbitrageAnalyzer(client)
 
48
  except asyncio.CancelledError: print("Engine shut down gracefully.")
49
 
50
  async def run_arbitrage_detector(price_fetcher, analyzer):
51
+ """The core engine loop. Directly emits events via Socket.IO."""
52
  last_opportunity_time = 0
53
  while True:
54
  try: