launch configs

This commit is contained in:
Dobromir Popov
2025-08-05 17:36:58 +03:00
parent 468fa0dcd6
commit dc326acf85
2 changed files with 161 additions and 21 deletions

109
.vscode/launch.json vendored
View File

@ -190,6 +190,91 @@
"group": "Universal Data Stream", "group": "Universal Data Stream",
"order": 2 "order": 2
} }
},
{
"name": "🌐 COBY Multi-Exchange Data Aggregation",
"type": "python",
"request": "launch",
"program": "COBY/main.py",
"console": "integratedTerminal",
"justMyCode": false,
"env": {
"PYTHONUNBUFFERED": "1",
"COBY_API_HOST": "0.0.0.0",
"COBY_API_PORT": "8080",
"COBY_WEBSOCKET_PORT": "8081"
},
"preLaunchTask": "Kill Stale Processes",
"presentation": {
"hidden": false,
"group": "COBY System",
"order": 1
}
},
{
"name": "🔍 COBY Debug Mode",
"type": "python",
"request": "launch",
"program": "COBY/main.py",
"args": [
"--debug"
],
"console": "integratedTerminal",
"justMyCode": false,
"env": {
"PYTHONUNBUFFERED": "1",
"COBY_API_HOST": "localhost",
"COBY_API_PORT": "8080",
"COBY_WEBSOCKET_PORT": "8081",
"COBY_LOG_LEVEL": "DEBUG"
},
"preLaunchTask": "Kill Stale Processes",
"presentation": {
"hidden": false,
"group": "COBY System",
"order": 2
}
},
{
"name": "🔧 COBY Development Mode (Auto-reload)",
"type": "python",
"request": "launch",
"program": "COBY/main.py",
"args": [
"--debug",
"--reload"
],
"console": "integratedTerminal",
"justMyCode": false,
"env": {
"PYTHONUNBUFFERED": "1",
"COBY_API_HOST": "localhost",
"COBY_API_PORT": "8080",
"COBY_WEBSOCKET_PORT": "8081",
"COBY_LOG_LEVEL": "DEBUG"
},
"preLaunchTask": "Kill Stale Processes",
"presentation": {
"hidden": false,
"group": "COBY System",
"order": 3
}
},
{
"name": "🏥 COBY Health Check",
"type": "python",
"request": "launch",
"program": "COBY/health_check.py",
"console": "integratedTerminal",
"justMyCode": false,
"env": {
"PYTHONUNBUFFERED": "1"
},
"presentation": {
"hidden": false,
"group": "COBY System",
"order": 4
}
} }
], ],
@ -261,6 +346,30 @@
"order": 5 "order": 5
} }
}, },
{
"name": "🌐 COBY Multi-Exchange System (Full Stack)",
"configurations": [
"🌐 COBY Multi-Exchange Data Aggregation"
],
"stopAll": true,
"presentation": {
"hidden": false,
"group": "COBY System",
"order": 6
}
},
{
"name": "🔧 COBY Development Environment",
"configurations": [
"🔧 COBY Development Mode (Auto-reload)"
],
"stopAll": true,
"presentation": {
"hidden": false,
"group": "COBY System",
"order": 7
}
}
] ]
} }

View File

@ -75,11 +75,13 @@ class COBYApplication:
) )
self.tasks.append(api_task) self.tasks.append(api_task)
# Start exchange connectors (placeholder for now) # Start exchange connectors
logger.info("Exchange connectors would start here...") logger.info("Starting exchange connectors...")
await self._start_exchange_connectors()
# Start data processing pipeline (placeholder for now) # Start data processing pipeline
logger.info("Data processing pipeline would start here...") logger.info("Starting data processing pipeline...")
await self._start_data_processing()
self.running = True self.running = True
logger.info("COBY system started successfully") logger.info("COBY system started successfully")
@ -123,26 +125,55 @@ class COBYApplication:
except Exception as e: except Exception as e:
logger.error(f"Error stopping COBY application: {e}") logger.error(f"Error stopping COBY application: {e}")
async def _run_api_server(self, app, host: str, port: int): async def _start_exchange_connectors(self):
"""Run the API server""" """Start exchange connectors"""
try: try:
# Import here to avoid circular imports # Import connectors
import uvicorn from connectors.binance_connector import BinanceConnector
from connectors.kucoin_connector import KucoinConnector
from connectors.coinbase_connector import CoinbaseConnector
config = uvicorn.Config( # Initialize connectors
app, self.connectors = {
host=host, 'binance': BinanceConnector(),
port=port, 'kucoin': KucoinConnector(),
log_level="info", 'coinbase': CoinbaseConnector()
access_log=True }
)
server = uvicorn.Server(config)
await server.serve()
except ImportError: # Start connectors
logger.error("uvicorn not available, falling back to basic server") for name, connector in self.connectors.items():
# Fallback implementation would go here try:
await asyncio.sleep(3600) # Keep running for an hour logger.info(f"Starting {name} connector...")
connector_task = asyncio.create_task(self._run_connector(connector))
self.tasks.append(connector_task)
except Exception as e:
logger.error(f"Failed to start {name} connector: {e}")
except Exception as e:
logger.error(f"Error starting exchange connectors: {e}")
async def _run_connector(self, connector):
"""Run a single connector"""
try:
# Connect to exchange
if await connector.connect():
logger.info(f"Connected to {connector.exchange_name}")
# Subscribe to default symbols
default_symbols = ['BTCUSDT', 'ETHUSDT', 'ADAUSDT', 'SOLUSDT']
for symbol in default_symbols:
try:
await connector.subscribe_orderbook(symbol)
await connector.subscribe_trades(symbol)
logger.info(f"Subscribed to {symbol} on {connector.exchange_name}")
except Exception as e:
logger.warning(f"Failed to subscribe to {symbol} on {connector.exchange_name}: {e}")
# Keep connector running
while connector.is_connected:
await asyncio.sleep(1)
async def main(): async def main():