mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-09 12:17:24 -04:00
Compare commits
3 Commits
v0.3.0-alp
...
v0.3.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 34d3317571 | |||
| 9813a3c9fd | |||
| 3535746eb7 |
10
ROADMAP.md
10
ROADMAP.md
@@ -150,7 +150,15 @@ curl -X POST http://localhost:5000/simulate/to-date \
|
|||||||
- Integration with monitoring systems (Prometheus, Grafana)
|
- Integration with monitoring systems (Prometheus, Grafana)
|
||||||
- Alerting recommendations
|
- Alerting recommendations
|
||||||
- Backup and disaster recovery guidance
|
- Backup and disaster recovery guidance
|
||||||
- Database migration strategy
|
- Database migration strategy:
|
||||||
|
- Automated schema migration system for production databases
|
||||||
|
- Support for ALTER TABLE and table recreation when needed
|
||||||
|
- Migration version tracking and rollback capabilities
|
||||||
|
- Zero-downtime migration procedures for production
|
||||||
|
- Data integrity validation before and after migrations
|
||||||
|
- Migration script testing framework
|
||||||
|
- Note: Currently migrations are minimal (pre-production state)
|
||||||
|
- Pre-production recommendation: Delete and recreate databases for schema updates
|
||||||
- Upgrade path documentation (v0.x to v1.0)
|
- Upgrade path documentation (v0.x to v1.0)
|
||||||
- Version compatibility guarantees going forward
|
- Version compatibility guarantees going forward
|
||||||
|
|
||||||
|
|||||||
@@ -289,9 +289,8 @@ def _migrate_schema(cursor: sqlite3.Cursor) -> None:
|
|||||||
"""
|
"""
|
||||||
Migrate existing database schema to latest version.
|
Migrate existing database schema to latest version.
|
||||||
|
|
||||||
Note: Cannot add CHECK constraints to existing columns via ALTER TABLE.
|
Note: For pre-production databases, simply delete and recreate.
|
||||||
The "downloading_data" status in jobs table requires a fresh database
|
This migration is only for preserving data during development.
|
||||||
or manual migration if upgrading from an older schema version.
|
|
||||||
"""
|
"""
|
||||||
# Check if positions table exists and has simulation_run_id column
|
# Check if positions table exists and has simulation_run_id column
|
||||||
cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='positions'")
|
cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='positions'")
|
||||||
@@ -300,23 +299,10 @@ def _migrate_schema(cursor: sqlite3.Cursor) -> None:
|
|||||||
columns = [row[1] for row in cursor.fetchall()]
|
columns = [row[1] for row in cursor.fetchall()]
|
||||||
|
|
||||||
if 'simulation_run_id' not in columns:
|
if 'simulation_run_id' not in columns:
|
||||||
# Add simulation_run_id column to existing positions table
|
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
ALTER TABLE positions ADD COLUMN simulation_run_id TEXT
|
ALTER TABLE positions ADD COLUMN simulation_run_id TEXT
|
||||||
""")
|
""")
|
||||||
|
|
||||||
# Check if jobs table exists and has warnings column
|
|
||||||
cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='jobs'")
|
|
||||||
if cursor.fetchone():
|
|
||||||
cursor.execute("PRAGMA table_info(jobs)")
|
|
||||||
columns = [row[1] for row in cursor.fetchall()]
|
|
||||||
|
|
||||||
if 'warnings' not in columns:
|
|
||||||
# Add warnings column to existing jobs table
|
|
||||||
cursor.execute("""
|
|
||||||
ALTER TABLE jobs ADD COLUMN warnings TEXT
|
|
||||||
""")
|
|
||||||
|
|
||||||
|
|
||||||
def _create_indexes(cursor: sqlite3.Cursor) -> None:
|
def _create_indexes(cursor: sqlite3.Cursor) -> None:
|
||||||
"""Create database indexes for query performance."""
|
"""Create database indexes for query performance."""
|
||||||
|
|||||||
@@ -191,11 +191,24 @@ class ModelDayExecutor:
|
|||||||
if not model_config:
|
if not model_config:
|
||||||
raise ValueError(f"Model {self.model_sig} not found in config")
|
raise ValueError(f"Model {self.model_sig} not found in config")
|
||||||
|
|
||||||
# Initialize agent
|
# Get agent config
|
||||||
|
agent_config = config.get("agent_config", {})
|
||||||
|
log_config = config.get("log_config", {})
|
||||||
|
|
||||||
|
# Initialize agent with properly mapped parameters
|
||||||
agent = BaseAgent(
|
agent = BaseAgent(
|
||||||
model_name=model_config.get("basemodel"),
|
|
||||||
signature=self.model_sig,
|
signature=self.model_sig,
|
||||||
config=config
|
basemodel=model_config.get("basemodel"),
|
||||||
|
stock_symbols=agent_config.get("stock_symbols"),
|
||||||
|
mcp_config=agent_config.get("mcp_config"),
|
||||||
|
log_path=log_config.get("log_path"),
|
||||||
|
max_steps=agent_config.get("max_steps", 10),
|
||||||
|
max_retries=agent_config.get("max_retries", 3),
|
||||||
|
base_delay=agent_config.get("base_delay", 0.5),
|
||||||
|
openai_base_url=model_config.get("openai_base_url"),
|
||||||
|
openai_api_key=model_config.get("openai_api_key"),
|
||||||
|
initial_cash=agent_config.get("initial_cash", 10000.0),
|
||||||
|
init_date=config.get("date_range", {}).get("init_date", "2025-10-13")
|
||||||
)
|
)
|
||||||
|
|
||||||
# Register agent (creates initial position if needed)
|
# Register agent (creates initial position if needed)
|
||||||
|
|||||||
Reference in New Issue
Block a user