INNER CODE UNIT · Python
create_order
codedpro/mt5-trade-split-manager · server.py:236
async def create_order(order: OrderCommand):
"""Place order on MT5 via TCP (split into 1-10 positions by the EA)."""
# The command sent to the EA always carries an explicit volume_split; when
# the client omits it we inject the legacy-compatible default here.
volume_split = order.volume_split
if volume_split is None:
volume_split = default_volume_split(len(order.tp_levels))
command = {
"action": "PLACE_ORDER",
"data": {
"order_type": order.order_type,
"symbol": order.symbol,
"price": order.price,
"sl": order.sl,
"tp_levels": order.tp_levels,
"volume_split": volume_split,
"lot_size": order.lot_size,
"deviation": order.deviation,