mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-09 20:27:25 -04:00
Compare commits
3 Commits
v0.3.0-alp
...
v0.3.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| dbd8f0141c | |||
| fb32bb12c5 | |||
| 29af5ddb4c |
@@ -26,12 +26,6 @@ WORKDIR /app
|
|||||||
# Copy application code
|
# Copy application code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Copy data scripts to separate directory (volume mount won't overlay these)
|
|
||||||
RUN mkdir -p /app/scripts && \
|
|
||||||
cp data/get_daily_price.py /app/scripts/ && \
|
|
||||||
cp data/get_interdaily_price.py /app/scripts/ && \
|
|
||||||
cp data/merge_jsonl.py /app/scripts/
|
|
||||||
|
|
||||||
# Create necessary directories
|
# Create necessary directories
|
||||||
RUN mkdir -p data logs data/agent_data
|
RUN mkdir -p data logs data/agent_data
|
||||||
|
|
||||||
|
|||||||
@@ -438,12 +438,19 @@ def _create_indexes(cursor: sqlite3.Cursor) -> None:
|
|||||||
""")
|
""")
|
||||||
|
|
||||||
# Positions table - add index for simulation_run_id and session_id
|
# Positions table - add index for simulation_run_id and session_id
|
||||||
cursor.execute("""
|
# Check if columns exist before creating indexes
|
||||||
CREATE INDEX IF NOT EXISTS idx_positions_run_id ON positions(simulation_run_id)
|
cursor.execute("PRAGMA table_info(positions)")
|
||||||
""")
|
position_columns = [row[1] for row in cursor.fetchall()]
|
||||||
cursor.execute("""
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_positions_session_id ON positions(session_id)
|
if 'simulation_run_id' in position_columns:
|
||||||
""")
|
cursor.execute("""
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_positions_run_id ON positions(simulation_run_id)
|
||||||
|
""")
|
||||||
|
|
||||||
|
if 'session_id' in position_columns:
|
||||||
|
cursor.execute("""
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_positions_session_id ON positions(session_id)
|
||||||
|
""")
|
||||||
|
|
||||||
|
|
||||||
def drop_all_tables(db_path: str = "data/jobs.db") -> None:
|
def drop_all_tables(db_path: str = "data/jobs.db") -> None:
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ class ModelDayExecutor:
|
|||||||
os.environ["RUNTIME_ENV_PATH"] = self.runtime_config_path
|
os.environ["RUNTIME_ENV_PATH"] = self.runtime_config_path
|
||||||
|
|
||||||
# Initialize agent
|
# Initialize agent
|
||||||
agent = self._initialize_agent()
|
agent = await self._initialize_agent()
|
||||||
|
|
||||||
# Run trading session
|
# Run trading session
|
||||||
logger.info(f"Running trading session for {self.model_sig} on {self.date}")
|
logger.info(f"Running trading session for {self.model_sig} on {self.date}")
|
||||||
@@ -209,7 +209,7 @@ class ModelDayExecutor:
|
|||||||
"""Execute model-day simulation (sync entry point)."""
|
"""Execute model-day simulation (sync entry point)."""
|
||||||
return self.execute_sync()
|
return self.execute_sync()
|
||||||
|
|
||||||
def _initialize_agent(self):
|
async def _initialize_agent(self):
|
||||||
"""
|
"""
|
||||||
Initialize trading agent with config.
|
Initialize trading agent with config.
|
||||||
|
|
||||||
@@ -259,6 +259,9 @@ class ModelDayExecutor:
|
|||||||
# - Database initialization is handled by JobManager
|
# - Database initialization is handled by JobManager
|
||||||
# - File-based position tracking is only for standalone/CLI mode
|
# - File-based position tracking is only for standalone/CLI mode
|
||||||
|
|
||||||
|
# Initialize MCP client and AI model
|
||||||
|
await agent.initialize()
|
||||||
|
|
||||||
return agent
|
return agent
|
||||||
|
|
||||||
def _create_trading_session(self, cursor) -> int:
|
def _create_trading_session(self, cursor) -> int:
|
||||||
|
|||||||
Reference in New Issue
Block a user