Files
aitbc/apps/exchange/scripts/seed_market.py
aitbc 6895770510 refactor: reorganize agent services into agent_coordination package and improve error handling
- Moved agent services to agent_coordination bounded context package:
  - agent_integration.py → agent_coordination/integration.py
  - agent_performance_service.py → agent_coordination/performance.py
  - agent_service.py → agent_coordination/agent_service.py
  - agent_security.py → agent_coordination/security.py
- Deleted agent_communication.py (988 lines removed)
- Updated import paths across routers to use new agent
2026-05-12 17:24:15 +02:00

61 lines
2.1 KiB
Python
Executable File

#!/usr/bin/env python3
"""Seed initial market price for the exchange"""
import sqlite3
from datetime import datetime, timezone
from aitbc.constants import DATA_DIR
import logging
logger = logging.getLogger(__name__)
def seed_initial_price():
"""Create initial trades to establish market price"""
import os
db_path = os.getenv("EXCHANGE_DATABASE_URL", f"sqlite:///{DATA_DIR}/data/exchange/exchange.db").replace("sqlite://///", "")
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
# Create some initial trades at different price points
initial_trades = [
(1000, 0.00001), # 1000 AITBC at 0.00001 BTC each
(500, 0.0000105), # 500 AITBC at slightly higher
(750, 0.0000095), # 750 AITBC at slightly lower
(2000, 0.00001), # 2000 AITBC at base price
(1500, 0.000011), # 1500 AITBC at higher price
]
for amount, price in initial_trades:
total = amount * price
cursor.execute('''
INSERT INTO trades (amount, price, total, created_at)
VALUES (?, ?, ?, ?)
''', (amount, price, total, datetime.now(timezone.utc)))
# Also create some initial orders for liquidity
initial_orders = [
('BUY', 5000, 0.0000095), # Buy order
('BUY', 3000, 0.00001), # Buy order
('SELL', 2000, 0.0000105), # Sell order
('SELL', 4000, 0.000011), # Sell order
]
for order_type, amount, price in initial_orders:
total = amount * price
cursor.execute('''
INSERT INTO orders (order_type, amount, price, total, remaining, user_address)
VALUES (?, ?, ?, ?, ?, ?)
''', (order_type, amount, price, total, amount, 'aitbcexchange00000000000000000000000000000000'))
conn.commit()
conn.close()
logger.info("Seeded initial market data")
logger.info(f"Created {len(initial_trades)} historical trades")
logger.info(f"Created {len(initial_orders)} liquidity orders")
logger.info("Initial price range: 0.0000095 - 0.000011 BTC")
logger.info("The exchange should now show real prices")
if __name__ == "__main__":
seed_initial_price()