mirror of
https://github.com/triqbit/mt5-ai-xauusd-trader.git
synced 2026-11-02 06:56:15 +00:00
- Create src/core/trade_logger.py with tables for trades, model_signals, performance_metrics, and risk_events. - Implement TradeLogger class with methods for logging signals, trade executions, risk events, and updating closed trades. - Add read_performance_report() for Sharpe Ratio, Profit Factor, and Max Drawdown calculation. - Configure Alembic for database migrations and generate initial migration. - Integrate TradeLogger into RiskManager for risk event logging. - Integrate TradeLogger into main execution loop for signal and trade lifecycle tracking. - Update timestamps to use timezone-aware datetime.now(timezone.utc) for Python 3.12 compatibility. - Add comprehensive integration tests. Co-authored-by: triqbit <242833443+triqbit@users.noreply.github.com>
27 lines
635 B
Mako
27 lines
635 B
Mako
"""${message}
|
|
|
|
Revision ID: ${up_revision}
|
|
Revises: ${down_revision | comma,n}
|
|
Create Date: ${create_date}
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
${imports if imports else ""}
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = ${repr(up_revision)}
|
|
down_revision: Union[str, None] = ${repr(down_revision)}
|
|
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
|
|
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
|
|
|
|
|
|
def upgrade() -> None:
|
|
${upgrades if upgrades else "pass"}
|
|
|
|
|
|
def downgrade() -> None:
|
|
${downgrades if downgrades else "pass"}
|