Trading

Place, change and close trades on MT4 and MT5 accounts through the same API you read them with. Each call creates a trade request: the API waits up to about 10 seconds for the broker's answer, and you can read the request and its result for 30 days.

Before you trade

A trading call is refused, and nothing is stored, unless all four of these hold:

RequirementHow to checkWhen it is missing
A Full Access API keyThe key's access on the API keys pageA Read Only key gets 403 ForbiddenError.
The account is connected with its master password and the broker allows tradingtradeAllowed is true on the account403 with E_ACCOUNT_CANNOT_TRADE
The account is deployed and connectedstate is deployed and connectionStatus is connected503 with E_ACCOUNT_NOT_CONNECTED
An MT4 account, or an MT5 account in hedging or netting modemarginMode is hedging or netting on MT5403 with E_TRADING_NOT_SUPPORTED
  • Any Full Access key can trade. A Read Only key cannot, and a key's access is fixed when it is created: to trade, create a Full Access key with Create API Key.
  • Any key, Read Only included, can read trade requests.
  • A key limited to chosen accounts trades only on those accounts. Any other account id returns 404.
  • tradeAllowed and marginMode are null until the account first reports them after connecting. While tradeAllowed is null, or marginMode is null on an MT5 account, a trading call returns 503 with E_ACCOUNT_NOT_CONNECTED: send it again in a few seconds.

Switch an account to the master password

An account connected with its investor password reads data but cannot trade. Send its master password with Update Account (PATCH /v1/accounts/{id}):

  • A deployed account reconnects with the new password: it is undeployed and deployed again, and the call returns it in undeploying. It keeps its id, history, name, tags and metadata, and redeploying within the paid period costs nothing extra.
  • While the account is deploying, the call returns 409 ConflictError and changes nothing. Send it again once the deploy has finished.
  • In any other state the password is stored and used the next time the account deploys.

Once it is connected again, check that tradeAllowed is true. It is refreshed on every heartbeat while the account is connected, and it stays false when the password or the broker does not allow trading.

Code samples

The samples on this page share this setup. Replace the key and the account id with your own.

from fundedops import FundedOps
 
client = FundedOps(api_key="fo_live_...")  # a Full Access key
ACCOUNT_ID = "3f6c1a2e-8b4d-4e0f-9a51-7c2d9e4b8a10"

Switching to the master password, then waiting for the account to connect again:

client.accounts.update(ACCOUNT_ID, password="your-master-password")
account = client.wait_until_connected(ACCOUNT_ID, timeout=300)
print(account.trade_allowed)  # True

Place an order

POST /v1/accounts/{id}/orders opens a position at the market price or places a pending order.

FieldRequiredNotes
typeYesbuy and sell fill at the market price. buy_limit, sell_limit, buy_stop and sell_stop wait at price. buy_stop_limit and sell_stop_limit (MT5 only) place a limit order at stopLimitPrice once the price reaches price.
symbolYesExactly as the broker names it, for example EURUSD.r. List Symbols returns the names the account accepts.
volumeYesLots, from the symbol's volumeMin to its volumeMax and on its volumeStep.
pricePending ordersThe order price. Not allowed on market orders.
stopLimitPriceStop-limit ordersThe price of the limit order.
stopLoss, takeProfitNoPrices.
slippageNoMarket orders only. The largest accepted difference from the current price, in points, 0 to 10,000. Default 20.
commentNoUp to 31 characters: letters, digits, spaces and _ - . : # / +.
magicNoYour own number to tag the order with, 0 to 2,147,483,647.
expirationTypeNoPending orders only. gtc (the default) until cancelled, day until the end of the trading day, specified until expirationTime.
expirationTimeWith specifiedA time in the future. ISO 8601, read as UTC when it has no offset.
fillingModeNoMT5 only. fok fills the whole volume or nothing, ioc fills what is available at once, return keeps what is not filled as an order. Leave it out to use a mode the symbol allows.
expiresInSecondsNo5 to 300, default 30. A request the account has not picked up by then expires, and nothing happens at the broker.

The API checks the request before it reaches the broker and answers 400 ValidationError when:

  • the body has a field the API does not know, so a misspelled stoploss never trades without its stop loss;
  • a market order has price, or a pending order has slippage;
  • the volume is outside the symbol's range or off its lot step. The volume is never rounded: the message names the allowed range and metadata carries code E_INVALID_VOLUME, volumeMin, volumeMax and volumeStep. Get Symbol (GET /v1/accounts/{id}/symbols/{symbol}) has the same three values;
  • the account does not list the symbol, or the broker does not allow the trade for it (metadata.code E_TRADE_DISABLED, or E_CLOSE_ONLY when the symbol only allows closing).

Prices and volumes take up to 10 decimal places.

trade = client.place_order(
    ACCOUNT_ID, "buy", "EURUSD", 0.1,
    stop_loss=1.079, take_profit=1.092,
)
print(trade.status, trade.idempotency_key)
if trade.status == "done":
    print(trade.result.position_ticket, trade.result.price)

A 200 returns the trade request:

{
  "id": "6a2f9c1e-4b7d-4e2a-9f0c-1d3e5b7a9c21",
  "accountId": "3f6c1a2e-8b4d-4e0f-9a51-7c2d9e4b8a10",
  "action": "place_order",
  "status": "done",
  "params": {"type": "buy", "symbol": "EURUSD", "volume": "0.1", "sl": "1.079", "tp": "1.092"},
  "result": {
    "orderTicket": "1834921107",
    "positionTicket": "1834920571",
    "dealTicket": "1612048873",
    "price": 1.08412,
    "volume": 0.1,
    "brokerCode": 10009,
    "message": "Request executed"
  },
  "error": null,
  "createdAt": "2026-11-15T10:32:05.118223Z",
  "expiresAt": "2026-11-15T10:32:35.118223Z",
  "completedAt": "2026-11-15T10:32:05.684512Z"
}

params is the request as the account received it, with every value as text. On the modify endpoints keep leaves a value unchanged and 0 removes a stop loss or take profit.

Idempotency keys

Every trading write needs an Idempotency-Key header: your own id for that trade, 1 to 64 characters of letters, digits and _ . : -. Without a valid key the call returns 400 with metadata.code E_IDEMPOTENCY_KEY_MISSING.

Create a new key for every new trade and store it before you send the request. When you do not know whether a call arrived (a timeout, a dropped connection, a restart, or a 502 or 504 from a proxy on the way), send the same request again with the same key. You get the first request's outcome instead of a second trade.

You send the same key withYou get
The same request, already finishedThe first answer again, with the same status code and body and the header Idempotent-Replayed: true. This applies to 200, 422 and 503 answers.
The same request, still in progress or unknown202 with the request's current status, a Location header and Idempotent-Replayed: true.
A different request422 IdempotencyKeyReusedError with metadata.code E_IDEMPOTENCY_KEY_REUSED. Nothing is sent.
  • Keys are shared by all API keys of your developer account and remembered for 30 days.
  • Requests are compared by their values, not their text: a volume of 0.1 and 0.10 is the same request. The same key sent to another account or another endpoint returns 422 IdempotencyKeyReusedError.
  • expiresInSeconds is not compared: a retry with another value returns the first request.
  • A call refused before it is stored is not remembered. After a 400, 401, 403, 404, 429 or a 503 with E_ACCOUNT_NOT_CONNECTED, fix the cause and send it again with the same key.
  • To send a trade again after it was rejected or expired, use a new key. The old key keeps returning the first answer.

The Python SDK sends a new key (uuid4().hex) with every call unless you pass idempotency_key=. It returns the key as trade.idempotency_key, and every error it raises carries it as err.idempotency_key, so you can retry with it. When the connection fails before any answer arrives (a timeout, a reset), the call raises TradeOutcomeUnknownError with the key: send the same call again with it.

Responses and statuses

A trading write waits up to about 10 seconds for the broker, then answers with the trade request:

Status codeTrade request statusMeaning
200doneThe broker carried it out. result has the tickets and the fill.
202queued, sent or unknownNot finished within the wait. Location is the trade request's path.
422 TradeRejectedErrorrejectedRefused. metadata has code, brokerCode, retryable and tradeRequestId.
503 ServiceUnavailableError, metadata.code E_REQUEST_EXPIREDexpiredNever sent, so nothing happened at the broker. metadata.tradeRequestId identifies it. Send it again with a new key.
StatusFinalMeaning
queuedNoStored, waiting for the account to pick it up.
sentNoThe account has it and is waiting for the broker.
doneYesThe broker carried it out.
rejectedYesRefused. error says why.
expiredYesNot picked up within expiresInSeconds, or picked up too late and never sent. Nothing happened at the broker.
unknownYes, until a late answer arrivesSent to the broker, but the outcome was never confirmed. Check positions and orders before sending it again.

Waiting for the outcome

After a 202, poll Get Trade Request at the Location path until the status is final, or wait for the trade_request.completed webhook described below. The Python SDK's wait_for_trade_request polls for you and returns the final trade request; it raises TimeoutError when timeout passes first.

trade = client.place_order(ACCOUNT_ID, "buy", "EURUSD", 0.1)
if trade.status in ("queued", "sent"):
    trade = client.wait_for_trade_request(ACCOUNT_ID, trade.id, timeout=60)
print(trade.status)

When the status is unknown

The request reached the broker, but no outcome came back: the broker did not answer, the account sent no answer within a minute after expiresAt, or the account lost its connection to the broker while it sent an open or a close (result.brokerCode is 10031 on MT5 or 6 on MT4), so the request may have reached the broker's server. The trade may or may not have happened.

  1. Do not send the trade again yet. The same key only returns unknown again, and a new key could trade twice.
  2. Look for the trade in List Positions, List Pending Orders and List History Deals, for example by its comment or magic.
  3. If you find it, treat the request as done. Send the trade again with a new key only when you are sure it did not happen.

A late answer still counts: the trade request changes to done or rejected, or to expired when the account received it too late and never sent it, and a second trade_request.completed webhook is sent with the real outcome.

When a request expires

A 503 with metadata.code E_REQUEST_EXPIRED means the account did not pick the request up within expiresInSeconds, for example because its connection was briefly down. Nothing was sent to the broker. Check that the trade still makes sense at the current price, then send it again with a new key.

The answer is the same when the account received the request after its time had run out: it does not send it, and the trade request ends expired with error.retryable true.

Modify a pending order

PATCH /v1/accounts/{id}/orders/{ticket} changes a pending order's price, stopLimitPrice (MT5 stop-limit orders), stopLoss, takeProfit, expirationType and expirationTime.

  • A field you leave out keeps its current value. null removes a stop loss or take profit.
  • price, stopLimitPrice and expirationType cannot be null. Send expirationType gtc to remove an expiration, on MT4 too.
  • Send at least one of price, stopLimitPrice, stopLoss, takeProfit or expirationType.
# The stop loss is left at KEEP (the default), so it does not change.
# None removes the take profit.
trade = client.modify_order(ACCOUNT_ID, "1834921107", price=1.0795, take_profit=None)

Cancel a pending order

DELETE /v1/accounts/{id}/orders/{ticket} cancels a pending order. It has no body.

trade = client.cancel_order(ACCOUNT_ID, "1834921107")

Modify a position

PATCH /v1/accounts/{id}/positions/{ticket} changes an open position's stopLoss and takeProfit. A field you leave out keeps its value, null removes it, and at least one of the two must be sent.

# The take profit is left at KEEP, so only the stop loss changes.
trade = client.modify_position(ACCOUNT_ID, "1834920571", stop_loss=1.0815)

Close a position

POST /v1/accounts/{id}/positions/{ticket}/close closes an open position. The body is optional:

  • volume closes part of the position, in lots on the symbol's volumeStep. Leave it out to close the whole position. A volume above the position's volume is rejected with E_INVALID_CLOSE_VOLUME before anything is sent, so a close never opens a position the other way.
  • slippage in points, 0 to 10,000. Default 20.
trade = client.close_position(ACCOUNT_ID, "1834920571", volume=0.05)

Close all positions

POST /v1/accounts/{id}/positions/close closes every open position in one trade request. The body is optional: symbol closes only the positions on that symbol, and slippage works as above.

  • result.positions lists each position with its ticket, its status (done, rejected or unknown) and, when it was not closed, its brokerCode.
  • When every position closed, the request is done. With no open positions it is done with an empty list.
  • When any position was not closed, the request is rejected with 422 and code E_SOME_POSITIONS_NOT_CLOSED. Read the trade request (metadata.tradeRequestId) for result.positions.
  • When the outcome of any position is not known, the request is unknown, also when other positions were not closed. A close sent while the account lost its connection to the broker (brokerCode 10031 on MT5 or 6 on MT4) counts as not known: its entry's status is unknown, as that position may be closed.
  • A position that closed by itself in the meantime (stop loss, take profit, by hand) is left out, and one the broker reports as already closed counts as done.
from fundedops import TradeRejectedError
 
try:
    trade = client.close_positions(ACCOUNT_ID, symbol="EURUSD")
except TradeRejectedError as err:
    trade = client.get_trade_request(ACCOUNT_ID, err.trade_request_id)
if trade.result:
    for position in trade.result.positions:
        print(position["ticket"], position["status"], position.get("brokerCode"))

Close by an opposite position

POST /v1/accounts/{id}/positions/{ticket}/close-by closes the position ticket against an opposite position on the same symbol. The body takes oppositeTicket (required) and expiresInSeconds.

  • Both positions must be open, on the same symbol and in opposite directions. Otherwise the call returns 400 with metadata.code E_INVALID_CLOSE_BY before anything is stored. When the API does not know a position yet, the account refuses instead and the trade request is rejected with the same code.
  • It works on MT4 and on MT5 hedging accounts. An MT5 netting account returns 403 with E_TRADING_NOT_SUPPORTED.
  • The volumes can differ. The smaller position closes and the larger one stays open with the rest. result.volume is the volume closed on each side, and result.remainingTicket is the ticket of the position left open, or null when both closed in full.
  • On MT4 the rest stays open under a new ticket, and remainingTicket is that ticket. When the new ticket cannot be identified, remainingTicket is left out and message says so: list the positions to find it.
  • It needs a Full Access key and an Idempotency-Key, and it waits for the broker like Place Order.
trade = client.close_position_by(ACCOUNT_ID, "1834920571", "1834920572")
if trade.result:
    print(trade.result.volume, trade.result.remaining_ticket)

Check an order before sending it

Three read-only calls ask the account's broker what a trade would cost, and nothing is placed. Any API key can call them, Read Only included, because they are GET requests. The numbers come from the account's broker, in the account currency, and each call waits up to about 10 seconds for the account.

Calculate margin

GET /v1/accounts/{id}/calculate-margin takes symbol, type and volume, and optionally price. Without price the current price is used, and the answer's price is the one the margin was worked out at. Any positive volume is calculated, on the lot step or not.

margin = client.accounts.calculate_margin(ACCOUNT_ID, "EURUSD", "buy", 0.1)
print(margin.margin, margin.currency)
{"symbol": "EURUSD", "type": "buy", "volume": 0.1, "price": 1.0842, "margin": 108.42, "currency": "USD"}

Calculate profit

GET /v1/accounts/{id}/calculate-profit takes symbol, type (buy or sell, the direction of the trade), volume, openPrice and closePrice. A loss is negative. Any positive volume is calculated.

profit = client.accounts.calculate_profit(ACCOUNT_ID, "EURUSD", "buy", 1.0, 1.08, 1.0855)
print(profit.profit, profit.currency)
{"symbol": "EURUSD", "type": "buy", "volume": 1.0, "openPrice": 1.08, "closePrice": 1.0855, "profit": 550.0, "currency": "USD"}

Check order

GET /v1/accounts/{id}/check-order takes Place Order's fields as query parameters: type, symbol, volume, and price, stopLimitPrice, stopLoss and takeProfit where the order type uses them. It validates them exactly like Place Order, so a malformed request is a 400 here too.

  • A valid order that the account would refuse is still a 200 with canPlace false. code and message hold what Place Order would answer, for example E_INVALID_VOLUME, E_TRADE_DISABLED, E_NO_MONEY, E_ACCOUNT_CANNOT_TRADE or E_TRADING_NOT_SUPPORTED. An investor-password account gets E_ACCOUNT_CANNOT_TRADE this way, not a 403.
  • When canPlace is true, code and message are null. margin is the margin the order adds to the account's margin in use. freeMargin, marginLevel, balance and equity describe the account after the order. All five are null when the order cannot be placed for a reason other than free margin.
  • volume must be on the symbol's lot step, as in Place Order. Calculate Margin and Calculate Profit do not check it.
  • An account that is not connected is a 503, as for every call that needs the account.
check = client.accounts.check_order(ACCOUNT_ID, "buy", "EURUSD", 0.1, stop_loss=1.079)
if check.can_place:
    print(check.margin, check.free_margin, check.margin_level)
else:
    print(check.code, check.message)

An order that can be placed:

{
  "canPlace": true,
  "code": null,
  "message": null,
  "margin": 108.42,
  "freeMargin": 9891.58,
  "marginLevel": 9223.39,
  "balance": 10000.0,
  "equity": 10000.0
}

An order the account would refuse:

{
  "canPlace": false,
  "code": "E_NO_MONEY",
  "message": "There is not enough free margin for this request.",
  "margin": 108420.0,
  "freeMargin": -98420.0,
  "marginLevel": 9.2,
  "balance": 10000.0,
  "equity": 10000.0
}

Read trade requests

List Trade Requests (GET /v1/accounts/{id}/trade-requests) returns the account's trade requests newest first, with offset and limit like the other lists (100 by default, up to 1,000). Get Trade Request (GET /v1/accounts/{id}/trade-requests/{tradeRequestId}) returns one. Any API key can read them, and they are kept for 30 days.

for trade in client.list_trade_requests(ACCOUNT_ID, limit=20):
    print(trade.created_at, trade.action, trade.status)

Results

Which keys a done trade request's result holds depends on the action. Tickets are strings.

ActionResult keys
Place Order, marketorderTicket, positionTicket, dealTicket (MT5), price (the fill), volume
Place Order, pendingorderTicket, price, volume
Modify OrderorderTicket, price
Cancel OrderorderTicket
Modify PositionpositionTicket
Close PositionpositionTicket, orderTicket, dealTicket (MT5), price (the close price), volume (the closed volume)
Close Position Byvolume (closed on each side), remainingTicket (the position left open, or null), orderTicket and dealTicket (MT5)
Close Positionspositions

brokerCode and message are added when the broker sent them. A rejected request has error (code, message, brokerCode, retryable) and can also have a result.

Platform differences

MT4

  • No stop-limit orders: buy_stop_limit, sell_stop_limit and stopLimitPrice return 400.
  • No fillingMode: sending it returns 400.
  • A pending order can expire only at a set time: on Place Order send expirationType specified with expirationTime, or leave both out. gtc and day return 400. Modify Order also takes gtc, which removes the expiration; day returns 400.
  • A set expiration can only be placed while the forex market is open. At other times, or when the broker does not allow expirations, the request is rejected with E_INVALID_EXPIRATION.
  • One ticket per order: a market order's orderTicket and positionTicket are the same, and there are no deal tickets.
  • A partial close leaves the rest of the position open under a new ticket. The result's positionTicket is that new ticket and orderTicket is the closed one. When the broker's records do not name the new ticket, positionTicket is left out and message says so: list the positions to find it.
  • Close Position By leaves the larger position's rest open under a new ticket, and remainingTicket is that ticket. When the new ticket cannot be identified, remainingTicket is left out and message says so.
  • Calculate Margin is MT4's margin per lot times the volume, at the current price. With a price, CFD and index symbols scale with that price, and forex and futures symbols do not. Calculate Profit uses the symbol's tick value at the current exchange rate.
  • MT4 has no order check function, so Check Order runs these checks in order and stops at the first that fails: trading allowed (account, symbol and AutoTrading), volume limits and step, stop distance, free margin. Free margin is checked for market orders only, because a pending order needs no margin until it triggers.

MT5

  • Calculate Margin, Calculate Profit and Check Order use the platform's own margin, profit and order check functions.

MT5 netting

  • An account holds one position per symbol. A buy on an open sell reduces, closes or reverses it, and a buy on an open buy adds to it.
  • Modify Position and Close Position take the position's ticket, as in List Positions.
  • The positionTicket in a result is the position's identifier, and it keeps working for that position.
  • Close Position By returns 403 with E_TRADING_NOT_SUPPORTED: it works on hedging accounts only.

Expiration times

expirationTime is UTC. The account converts it to the broker's server time with the server's current UTC offset, so an expiration that falls after a daylight saving change on the server can be one hour off.

Webhook

The trade_request.completed event is sent when a trade request finishes as done, rejected, expired or unknown. data.tradeRequest is the trade request as Get Trade Request returns it, and data.account is the account. When a late answer turns an unknown request into done, rejected or expired, a second event is sent for the same trade request with the real status. Choose the event for an endpoint on the Webhooks page; see the Webhooks guide for signatures and retries.

Positions and orders also change in reads, in the stream and in the position.opened, position.closed and deal.added events shortly after a trade.

Errors

Every trading error uses the standard error body. metadata.code is a stable code to branch on.

Refused before anything is stored

Nothing is stored or sent. Fix the cause, then send the request again: with the same key, except after E_IDEMPOTENCY_KEY_REUSED, which needs a new key.

StatusCodeMeaning
400E_IDEMPOTENCY_KEY_MISSINGThe Idempotency-Key header is missing or invalid.
400E_INVALID_VOLUMEThe volume is outside the symbol's range or off its lot step. metadata has volumeMin, volumeMax and volumeStep.
400E_TRADE_DISABLEDThe broker does not allow this trade on the symbol: trading is disabled, or only buys or only sells are allowed.
400E_CLOSE_ONLYThe symbol only allows closing positions.
400E_INVALID_CLOSE_BYClose Position By: the two tickets are the same, are on different symbols or are in the same direction. details names oppositeTicket.
400noneAny other invalid field. details names it.
403noneThe API key is Read Only.
403E_ACCOUNT_CANNOT_TRADEThe account is connected with its investor password, or the broker has disabled trading.
403E_TRADING_NOT_SUPPORTEDTrading is not available for the account's platform and margin mode.
404noneThe account or trade request does not exist, or the API key is limited to other accounts.
422E_IDEMPOTENCY_KEY_REUSEDIdempotencyKeyReusedError: the key was used for a different request. Use a new key.
429noneThe request rate limit. metadata and Retry-After are sent.
429E_QUEUE_FULL50 trade requests are already waiting for the account. No Retry-After: send it again once some have finished.
503E_ACCOUNT_NOT_CONNECTEDThe account is not deployed and connected, or its connection has not reported yet whether it can trade (tradeAllowed is null, or marginMode is null on MT5).

Outcomes of a trade request

422 TradeRejectedError and 503 with E_REQUEST_EXPIRED are outcomes of a stored trade request: its error.code holds the same code. retryable says whether the same trade can succeed when you send it again with a new key, after a short wait. When it is false, change the request first.

brokerCode is the broker's own code: an MT5 return code or an MT4 error number. Negative numbers are FundedOps codes for requests the account refused before they reached the broker.

CodeMeaningRetryable
E_REQUOTEThe price changed before the broker could fill the request.Yes
E_REJECTEDThe broker rejected the request.No
E_BROKER_TIMEOUTThe broker did not answer in time. Check the order state before retrying.Yes
E_INVALID_REQUESTThe broker did not accept the request parameters.No
E_INVALID_VOLUMEThe volume is not valid for this symbol.No
E_INVALID_PRICEThe price is not valid.No
E_INVALID_STOPSThe stop loss or take profit is too close to the market price, or invalid.No
E_INVALID_EXPIRATIONThe expiration could not be used.No
E_INVALID_FILLThe broker does not support this filling mode for the symbol.No
E_INVALID_CLOSE_VOLUMEThe close volume is larger than the position volume. Nothing was sent.No
E_INVALID_CLOSE_BYClose Position By: the two positions are not open on the same symbol in opposite directions.No
E_TRADE_DISABLEDTrading is disabled for this symbol or account, also when the broker's server disables automated trading.No
E_CLOSE_ONLYThe broker only allows closing positions for this symbol.No
E_MARKET_CLOSEDThe market is closed.No
E_NO_MONEYThere is not enough free margin for this request.No
E_NO_QUOTESThe broker has no prices for this symbol right now.Yes
E_ORDER_LOCKEDThe order or position is being processed.Yes
E_FROZENThe order or position is frozen because it is too close to the market price.Yes
E_TOO_MANY_REQUESTSToo many requests were sent to the broker.Yes
E_TOO_MANY_ORDERSThe account reached the broker's limit for orders or positions.No
E_AUTOTRADING_DISABLEDAutomated trading is disabled for this account.Yes
E_NO_CONNECTIONThe account has no connection to the broker. Returned for changes and cancels only: an open or a close ends unknown instead.Yes
E_BUSYThe trade context is busy.Yes
E_FIFOThe broker requires positions to be closed in FIFO order.No
E_POSITION_NOT_FOUNDThe position does not exist. It may already be closed.No
E_ORDER_NOT_FOUNDThe order does not exist. It may already be filled or cancelled.No
E_SOME_POSITIONS_NOT_CLOSEDClose Positions: some positions were not closed. result.positions has the details.No
E_NOT_SENTThe request was not sent and nothing changed on the account.Yes
E_REQUEST_EXPIREDThe request expired before it was sent to the broker. Nothing happened: send it again with a new key. Always a 503.Yes
E_ACCOUNT_CANNOT_TRADETrading is not allowed on this account.No
E_TRADING_NOT_SUPPORTEDThis connection does not support trading.No
E_BROKER_ERRORAny other broker code. brokerCode has it.No

Broker codes map to these codes by meaning. For example, MT4 errors 4051 and 4106 (unknown symbol) are E_INVALID_REQUEST, 4107 is E_INVALID_PRICE, and 4110 and 4111 (buys or sells not allowed) are E_TRADE_DISABLED. MT5 code 10026 and MT4 error 4112 (the broker's server disabled automated trading) are also E_TRADE_DISABLED and not retryable, while MT5 code 10027 is E_AUTOTRADING_DISABLED.

With the Python SDK a 422 raises TradeRejectedError (code, broker_code, retryable, trade_request_id), a 503 with E_REQUEST_EXPIRED raises TradeExpiredError, a reused key raises IdempotencyKeyReusedError, and a connection that fails before any answer raises TradeOutcomeUnknownError:

from fundedops import (
    IdempotencyKeyReusedError,
    TradeExpiredError,
    TradeOutcomeUnknownError,
    TradeRejectedError,
)
 
try:
    trade = client.place_order(ACCOUNT_ID, "buy", "EURUSD", 0.1)
except TradeRejectedError as err:
    print(err.code, err.broker_code, err.retryable, err.trade_request_id)
except TradeExpiredError as err:
    print("not sent, nothing happened:", err.trade_request_id)
except TradeOutcomeUnknownError as err:
    print("no answer, send it again with the same key:", err.idempotency_key)
except IdempotencyKeyReusedError as err:
    print("key already used for another request:", err.idempotency_key)

Limits

LimitValue
Wait for the broker's answerAbout 10 seconds, then 202
expiresInSeconds5 to 300, default 30
Trade requests waiting per account (queued or sent)50. More returns 429 with E_QUEUE_FULL.
Trade requests and idempotency keys kept30 days
Requests per second, per developer account25, with bursts up to 100, shared with every other endpoint