APPOLO / BUILD 212 PUBLIC IMPLEMENTATION EVIDENCE SOURCE: APPOLO_LIVE/final_executor_engine.py PRIVATE SOURCE SHA-256: 317e45c9e2b26b2b02a95891ef25a524eef21d7bde9514295bd9f0956962c0c5 PUBLICATION: selected execution-boundary excerpt BOUNDARY: strategy/entry logic, account identifiers, credentials and private workstation paths are not published. WHAT THIS PROVES - The executor consumes final authority state instead of inventing strategy decisions. - MetaTrader 5 is initialized explicitly. - A TRADE_ACTION_DEAL request is built with symbol, volume, side, price, SL and TP. - mt5.order_send(request) is the broker mutation boundary. - Success is recognized only from the MT5 return code before state is marked executed. SOURCE EXCERPT 0525: governor_permission = governor.get("final_permission", "ALLOW") 0526: 0527: authority_symbol = final_authority.get("symbol") 0528: authority_permission = final_authority.get("final_permission") 0529: authority_execution_allowed = bool(final_authority.get("execution_allowed")) 0530: authority_order_send_allowed = bool(final_authority.get("order_send_allowed")) 0531: authority_final_lot = float(final_authority.get("final_lot") or 0.0) 0532: authority_hard_blocks = final_authority.get("hard_blocks", []) 0533: 0534: authority_aligned = ( 0535: authority_symbol 0536: and symbol 0537: and str(authority_symbol).upper().strip() == str(symbol).upper().strip() 0538: ) 0539: 0540: authority_override_allowed = bool( 0541: authority_aligned 0542: and authority_execution_allowed 1178: try: 1179: import MetaTrader5 as mt5 1180: 1181: if not mt5.initialize(path=r"[MT5_TERMINAL_PATH]"): 1182: status["reason"] = f"MT5 initialize failed: {mt5.last_error()}" 1183: return stop(status) 1184: 1185: if not symbol or direction not in ["BUY", "SELL"]: 1186: mt5.shutdown() 1187: status["reason"] = "Invalid symbol/direction." 1188: return stop(status) 1189: 1190: open_positions = mt5.positions_get() or [] 1191: same_symbol_positions = [ 1192: p for p in open_positions 1284: request = { 1285: "action": mt5.TRADE_ACTION_DEAL, 1286: "symbol": symbol, 1287: "volume": lot, 1288: "type": order_type, 1289: "price": price, 1290: "sl": float(plan["stop_loss"]), 1291: "tp": float(plan["take_profit"]), 1292: "deviation": 20, 1293: "magic": MAGIC, 1294: "comment": f"APPOLO_{execution_mode}", 1295: "type_time": mt5.ORDER_TIME_GTC, 1296: "type_filling": filling_type, 1297: } 1339: return stop(status) 1340: result = mt5.order_send(request) 1341: result_dict = result._asdict() if result is not None else None 1342: mt5.shutdown() 1343: 1344: status["broker_filling_mode"] = broker_filling_mode 1345: status["used_type_filling"] = filling_type 1346: status["request"] = request 1347: status["result"] = result_dict 1348: 1349: if result is not None and result.retcode == 10009: 1350: status["executed"] = True 1351: status["reason"] = f"{execution_mode} {symbol} order executed successfully." 1352: 1353: save_signal_execution(signal_id, plan) 1354: 1355: plan["status"] = "EXECUTED" 1356: plan["executed_at"] = now_iso()