launch configs
This commit is contained in:
109
.vscode/launch.json
vendored
109
.vscode/launch.json
vendored
@ -190,6 +190,91 @@
|
||||
"group": "Universal Data Stream",
|
||||
"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
|
||||
}
|
||||
},
|
||||
{
|
||||
"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
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
|
73
COBY/main.py
73
COBY/main.py
@ -75,11 +75,13 @@ class COBYApplication:
|
||||
)
|
||||
self.tasks.append(api_task)
|
||||
|
||||
# Start exchange connectors (placeholder for now)
|
||||
logger.info("Exchange connectors would start here...")
|
||||
# Start exchange connectors
|
||||
logger.info("Starting exchange connectors...")
|
||||
await self._start_exchange_connectors()
|
||||
|
||||
# Start data processing pipeline (placeholder for now)
|
||||
logger.info("Data processing pipeline would start here...")
|
||||
# Start data processing pipeline
|
||||
logger.info("Starting data processing pipeline...")
|
||||
await self._start_data_processing()
|
||||
|
||||
self.running = True
|
||||
logger.info("COBY system started successfully")
|
||||
@ -123,26 +125,55 @@ class COBYApplication:
|
||||
except Exception as e:
|
||||
logger.error(f"Error stopping COBY application: {e}")
|
||||
|
||||
async def _run_api_server(self, app, host: str, port: int):
|
||||
"""Run the API server"""
|
||||
async def _start_exchange_connectors(self):
|
||||
"""Start exchange connectors"""
|
||||
try:
|
||||
# Import here to avoid circular imports
|
||||
import uvicorn
|
||||
# Import connectors
|
||||
from connectors.binance_connector import BinanceConnector
|
||||
from connectors.kucoin_connector import KucoinConnector
|
||||
from connectors.coinbase_connector import CoinbaseConnector
|
||||
|
||||
# Initialize connectors
|
||||
self.connectors = {
|
||||
'binance': BinanceConnector(),
|
||||
'kucoin': KucoinConnector(),
|
||||
'coinbase': CoinbaseConnector()
|
||||
}
|
||||
|
||||
# Start connectors
|
||||
for name, connector in self.connectors.items():
|
||||
try:
|
||||
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)
|
||||
|
||||
config = uvicorn.Config(
|
||||
app,
|
||||
host=host,
|
||||
port=port,
|
||||
log_level="info",
|
||||
access_log=True
|
||||
)
|
||||
server = uvicorn.Server(config)
|
||||
await server.serve()
|
||||
|
||||
except ImportError:
|
||||
logger.error("uvicorn not available, falling back to basic server")
|
||||
# Fallback implementation would go here
|
||||
await asyncio.sleep(3600) # Keep running for an hour
|
||||
|
||||
|
||||
async def main():
|
||||
|
Reference in New Issue
Block a user