Skip to content

main_trade_mod.py

What this file is

Demonstration script focused on trade modification flows: placing, modifying, and closing orders. It shows common sequences like order_send → order_modify → order_close with minimal boilerplate.

Tips for working with this demo

  • Normalize before modify. Use price/lot normalization helpers to satisfy broker constraints.
  • Convert pips↔price consistently to avoid off-by-one tick rejections.
  • Respect freeze levels. Some brokers block SL/TP changes near current price — plan distances.
  • Check order state. Re‑query tickets before modifying; ensure it's still open and prices changed.
  • Log results. Store the returned ticket and the final SL/TP to trace outcomes.

Output

Expect a short log of placement → modification → close results (ticket, prices, statuses).

Trade Modification Output