Skip to content

Lifecycle recipes

Start a demo copier with explicit settings, then pause it. Start is active immediately: pausing afterward is not atomic and cannot prevent a trade in between. Use demo accounts with no existing positions while learning. This fragment belongs inside your application function; supply the account objects and handle failures explicitly.

from pycopier import CopierService, StartRequest
service = CopierService("copy.mrpc.pro:443", os.environ["MRPC_API_KEY"])
try:
    # master and slave are Account objects for disposable demo accounts.
    started = await service.start(StartRequest(master=master, slave=slave,
        risk_type="FixedLot", risk_value="0.01", copy_sl=True, copy_tp=True,
        copy_pending_orders=False, reverse_copy=False))
    if not started.ok:
        raise RuntimeError(started.error)
    paused = await service.pause(started.copier_id, True)
    if not paused.ok:
        raise RuntimeError(paused.error)
finally:
    await service.close()

Resume deliberately

Use the same Pause method with false (paused: false in Ruby). Check the reply and re-read List. A billing suspension can refuse a resume. Do not auto-resume every paused copier on application startup.

Remove after inspection

Call the Remove method with the saved copier ID only after checking test positions and pending orders. Check the reply, then confirm the relationship no longer appears in List. Removal is not a substitute for closing positions.

For REST, use /Remove with id, userKey, and the ApiKey header. Inspect the JSON response as well as HTTP status. /UserCopiers lists the owner’s current relationships. The published OpenAPI contract describes the current REST routes and parameters.

Monitor before trusting replication

Start/List/Pause/Remove tests validate management behavior. For a full acceptance test, open and close one demo position and compare both tickets, actual lots, and trade logs. See the test checklist.