INNER CODE UNIT · Python

from_date

flukelaster/ai-trading-agent · mt5_bridge/main.py:468

    from_date = datetime.now() - timedelta(days=days)
    to_date = datetime.now() + timedelta(days=1)

    deals = mt5.history_deals_get(from_date, to_date)
    if deals is None:
        return mt5_response(True, data=[])

    result = []
    for deal in deals:
        if deal.entry == 1 and deal.type in (0, 1):  # entry=1 means exit, type 0=buy 1=sell
            if symbol and deal.symbol != symbol:
                continue
            result.append({
                "ticket": deal.position_id,
                "deal_ticket": deal.ticket,
                "symbol": deal.symbol,
                "type": "BUY" if deal.type == 1 else "SELL",  # exit type is opposite
                "lot": deal.volume,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…