Repository navigation
Tools Reference
⚠️ Generated page — do not edit by hand. Runmake wikito regenerate.
The server exposes these MCP tools. Mutating tools require confirm=true; trades are two-phase (preview → confirm → execute).
Top up demo account · Changes state
Add virtual funds to the active demo account's balance. Works only when the server runs against the demo environment (CAP_ENV=demo) and is refused on live. Needs confirm=true; it does not need trading to be enabled. Check the new balance with cap_account_list.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
amount |
number | yes | — | Amount of virtual money to add, in the demo account's currency. |
confirm |
boolean | no | False |
Must be true to perform the action; false (default) refuses with CONFIRM_REQUIRED. |
Get account activity history · Read-only
Get the account's activity log: positions opened and closed, orders placed, amended or cancelled. Covers the last 600 seconds by default; use last_period or from_date/to_date for other periods: up to 31 days per call, fetched a day at a time, newest first (no to_date = now, no from_date = one day before to_date). detailed=true gives full details, deal_id one deal. For money movements (deposits, withdrawals, P&L, fees) use cap_account_history_transactions. Read-only.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
from_date |
string | no | None |
Start of the period, ISO 8601 date-time read as UTC (a bare date is midnight), e.g. 2026-11-01T00:00:00. |
to_date |
string | no | None |
End of the period, ISO 8601 date-time read as UTC (a bare date is midnight), e.g. 2026-11-01T00:00:00. |
last_period |
integer | no | 600 |
Look-back window in seconds ending now (default 600, at most 86400); ignored when from_date or to_date is given. Use from_date/to_date for older periods. |
detailed |
boolean | no | False |
true asks the broker for the full details of each activity. |
deal_id |
string | no | None |
Only return activity for this deal id. |
Get transaction history · Read-only
Get the account's money movements: deposits, withdrawals, realised trade P&L, overnight fees and other cash transactions. Covers the last 600 seconds by default; widen it with last_period or from_date/to_date and filter with type. The broker returns at most 100 rows, newest first: narrow the dates to see older ones. For a log of positions and orders use cap_account_history_activity. Read-only.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
from_date |
string | no | None |
Start of the period, ISO 8601 date-time read as UTC (a bare date is midnight), e.g. 2026-11-01T00:00:00. |
to_date |
string | no | None |
End of the period, ISO 8601 date-time read as UTC (a bare date is midnight), e.g. 2026-11-01T00:00:00. |
last_period |
integer | no | 600 |
Look-back window in seconds ending now (default 600, at most 86400); ignored when from_date or to_date is given. Use from_date/to_date for older periods. |
type |
string | no | None |
Transaction type to filter by, passed to the broker as given (e.g. DEPOSIT, WITHDRAWAL, TRADE, SWAP); omit for all types. |
List accounts · Read-only
List every account on this login with its balance figures, currency and type, plus active_account_id. Use it to check funds before a trade or to find an id for cap_session_switch_account. Read-only.
No parameters.
Get account preferences · Read-only
Show the active account's trading preferences: whether hedging mode is on and the leverage set for each asset class. Read them before changing anything with cap_account_preferences_set. Read-only.
No parameters.
Update account preferences · Changes state (destructive)
Change the active account's preferences: hedging mode and/or leverage per asset class. This changes the real account's settings and affects margin on later trades. Needs confirm=true; it does not need trading to be enabled, but dry-run mode blocks it. Pass only what you want to change, and read the current values first with cap_account_preferences_get. With nothing to change it is refused with INVALID_REQUEST.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
hedging_mode |
boolean | no | None |
true turns hedging mode on, false turns it off; omit to leave it unchanged. |
leverages |
object | no | None |
Leverage per asset class, e.g. {"SHARES": 5}; classes: SHARES, CURRENCIES, INDICES, CRYPTOCURRENCIES, COMMODITIES. Omit to leave leverage unchanged. |
confirm |
boolean | no | False |
Must be true to perform the action; false (default) refuses with CONFIRM_REQUIRED. |
Fetch market (ChatGPT) · Read-only
Get one market's details by EPIC as {id, title, text, url, metadata}, where text is the full cap_market_get response serialised as JSON. It exists for clients (such as ChatGPT deep research) that require a tool named fetch with this result shape; other clients should call cap_market_get directly. Read-only.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id |
string | yes | — | EPIC to fetch, as returned in a search or cap_market_search result. |
Search markets (ChatGPT) · Read-only
Search markets by name and return up to 20 results as {id, title, url}, where id is the EPIC and title the instrument name. It exists for clients (such as ChatGPT deep research) that require a tool named search with this result shape, and runs the same broker lookup as cap_market_search, which returns the full market records and takes more options. Read-only.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | yes | — | Market name or keyword to search for, e.g. gold or Tesla. |
Get market details · Read-only
Get the full details of one market by EPIC: instrument data, dealing rules (min/max deal size, size increment, stop distances) and a snapshot with the current bid/offer and market status. Use it before a preview to pick a valid size and stops; use cap_market_search when you only know the name and cap_market_prices for history. The fetch tool returns the same market details wrapped in the document shape that client expects. Read-only.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
epic |
string | yes | — | Instrument identifier (EPIC) from cap_market_search, e.g. GOLD. |
Browse market category · Read-only
List what sits under one market category: its sub-categories (with node ids) and/or the markets in it (with EPICs). Take node_id from cap_market_navigation_root or from an earlier call to this tool, and repeat to walk down the tree. Read-only.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
node_id |
string | yes | — | Category node id from cap_market_navigation_root or from a previous cap_market_navigation_node result. |
Browse market categories · Read-only
List the top-level market categories (such as commodities, indices or shares) with their node ids. Use it to browse when you do not know a market's name, then open a category with cap_market_navigation_node. To find a market by name, cap_market_search is quicker. Read-only.
No parameters.
Get historical prices · Read-only
Get historical OHLC candles for one EPIC: at most 1000 per call. By default returns the latest 50 MINUTE_15 candles in a compact columnar form (time and mid-price open, high, low, close, volume); format="full" returns the broker's bid/ask candles. Resolutions: MINUTE, MINUTE_5, MINUTE_15, MINUTE_30, HOUR, HOUR_4, DAY, WEEK. Use from_date/to_date (UTC, YYYY-MM-DDTHH:MM:SS) for a fixed window, cap_stream_candles for live bars and cap_market_get for the current price. Read-only.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
epic |
string | yes | — | Instrument identifier (EPIC) from cap_market_search, e.g. GOLD. |
resolution |
string | no | 'MINUTE_15' |
Candle size: MINUTE, MINUTE_5, MINUTE_15, MINUTE_30, HOUR, HOUR_4, DAY or WEEK (default MINUTE_15). |
max |
integer | no | 50 |
Maximum number of candles: 1 to 1000 (default 50). |
from_date |
string | no | None |
Start of the period, UTC, YYYY-MM-DDTHH:MM:SS, e.g. 2026-11-01T00:00:00 (a trailing Z and fractional seconds are dropped; a bare date is refused). |
to_date |
string | no | None |
End of the period, UTC, YYYY-MM-DDTHH:MM:SS, e.g. 2026-11-01T00:00:00 (a trailing Z and fractional seconds are dropped; a bare date is refused). |
format |
string | no | 'compact' |
compact (default): mid-price columns t,o,h,l,c,v; full: the broker's complete bid/ask candles. |
Search markets · Read-only
Find markets by name or keyword (e.g. "gold", "Apple"), or look up exact EPICs, and get the broker's market records, each with its EPIC and instrument name. Start here to get the EPIC that the other market and trading tools need, then use cap_market_get for dealing rules. Give search_term or epics; with neither it is refused with INVALID_REQUEST. The search tool runs the same lookup for clients that require that name. Read-only.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
search_term |
string | no | None |
Free-text name or keyword, e.g. gold or Tesla. Omit when using epics. |
epics |
array | no | None |
Exact EPICs to look up, e.g. ["GOLD", "SILVER"]. |
limit |
integer | no | 50 |
Maximum number of markets to return (default 50), applied after the broker responds. |
Get client sentiment · Read-only
Get client sentiment for one market: the percentage of Capital.com clients holding long versus short positions in it. Use it as a positioning gauge next to cap_market_prices. Read-only.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
market_id |
string | yes | — | Market id to look up; on Capital.com this is normally the EPIC (e.g. GOLD) from cap_market_search. |
Log in · Changes state
Log in to Capital.com with the credentials configured on the server, or confirm that the current session is still valid. Rarely needed: the other tools log in on demand. With account_id the session ends on that account, whether it is a new login or a reused session (cap_session_switch_account does the same switch alone); this lasts until the session is re-created, then the broker's default account returns unless CAP_DEFAULT_ACCOUNT_ID is set. Refused when the server is pinned to a different account by CAP_DEFAULT_ACCOUNT_ID. Returns the broker's login response plus active_account_id.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
force |
boolean | no | False |
Log in again even if the current session is still valid (default false). |
account_id |
string | no | None |
Account to make active after login (ids from cap_account_list); applied to a reused session too. |
Log out · Changes state
End the broker session and clear the stored session tokens; does nothing when not logged in. Any later tool call logs in again with the configured credentials, so this does not lock the server.
No parameters.
Ping session · Read-only
Ping the broker to keep the current session alive and extend its timeout; logs in first if there is no session. Use it during long pauses between calls. cap_session_status shows the local session state without calling the broker.
No parameters.
Get session status · Read-only
Show the local session state: environment (demo/live), whether logged in, the active account id and an estimate of the seconds until the session token expires. Local only: it makes no broker call and never logs in. Use cap_session_login to start a session; the other tools log in on their own when needed.
No parameters.
Switch account · Changes state
Make another account on the same login the active one (balances, positions and trades then refer to it). It lasts until the session is re-created (a new login after about 10 minutes idle or on expiry), which falls back to the broker's default account; set CAP_DEFAULT_ACCOUNT_ID to keep one account for good. Trade results carry an account marker to check. Find ids with cap_account_list; cap_session_login with account_id does the same. Refused when the server is pinned to a different account by CAP_DEFAULT_ACCOUNT_ID. Returns the broker response plus active_account_id.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
account_id |
string | yes | — | Target account id, as listed by cap_account_list. |
Stream price alerts · Read-only
Watch up to 40 EPICs over a WebSocket and report ticks whose mid price ((bid+offer)/2) is at or above (ABOVE) or at or below (BELOW) each alert's level; a level already passed hits on the first tick. Waits up to duration_s seconds (default 30, max 600); auto_close=true returns once every alert has triggered. Returns at most 100 triggered_alerts (truncated=true when more fired; alerts_triggered counts all). Monitoring only: it never trades. Needs CAP_WS_ENABLED=true (in the Claude Desktop extension: Live streaming); your client's tool timeout must exceed duration_s. Errors are returned as data.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
alerts |
object | yes | — | Up to 40 entries mapping an EPIC (from cap_market_search) to {"level": price, "direction": "ABOVE" or "BELOW"}, e.g. {"GOLD": {"level": 2400, "direction": "ABOVE"}}. |
duration_s |
number | no | 30.0 |
How long to stream, in seconds: 1 to 600 (default 30). |
auto_close |
boolean | no | False |
true records the first hit per EPIC and stops once every alert has hit; false records every qualifying tick. It never closes a position. |
Stream live candles · Read-only
Stream live OHLC bars for up to 40 EPICs at one or more resolutions over a WebSocket and return them when the stream ends. Holds the call open for duration_s seconds (default 30, max 600; make several calls for longer), keeps at most one bar per EPIC and resolution per update_interval_s and returns the last 100. Needs CAP_WS_ENABLED=true (in the Claude Desktop extension: Live streaming); your client's tool timeout must exceed duration_s. For historical candles use cap_market_prices. Read-only; errors come back in the result.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
epics |
array | yes | — | 1 to 40 instrument identifiers (EPICs) from cap_market_search, e.g. ["GOLD"]. |
resolutions |
array | yes | — | Bar sizes to subscribe to, e.g. ["MINUTE", "MINUTE_5", "HOUR"]; at least one. |
bar_type |
string | no | 'classic' |
classic (default) or heikin-ashi. |
duration_s |
number | no | 30.0 |
How long to stream, in seconds: 1 to 600 (default 30). |
update_interval_s |
number | no | 1.0 |
Minimum seconds between kept bars of the same EPIC and resolution (default 1); bars arriving sooner are dropped. |
Stream portfolio updates · Read-only
Watch all open positions over a WebSocket for duration_s seconds (default 30, max 600) and return timestamped snapshots: the first at once, then at most one per update_interval_s as prices move (the last 20). Each has total_pnl and, per position, deal_id, epic, direction, size, open_level, current_price (closing side), pnl (the broker's) and currency; positions_monitored counts those open at the start; status no_positions when nothing is open. Needs CAP_WS_ENABLED=true (in the Claude Desktop extension: Live streaming); the tool timeout must exceed duration_s. Errors are returned as data.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
duration_s |
number | no | 30.0 |
How long to stream, in seconds: 1 to 600 (default 30). |
update_interval_s |
number | no | 5.0 |
Minimum seconds between snapshots (default 5); values below 1 are treated as 1. Each snapshot re-reads the open positions from the broker. |
Stream live prices · Read-only
Stream live bid/offer ticks for up to 40 EPICs over a WebSocket and return them when the stream ends. Holds the call open for duration_s seconds (default 30, max 600; make several calls for longer), keeps at most one tick per EPIC per update_interval_s and returns the last 100. Needs CAP_WS_ENABLED=true (in the Claude Desktop extension: Live streaming); your client's tool timeout must exceed duration_s. For one current price use cap_market_get. Read-only; errors are returned as data.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
epics |
array | yes | — | 1 to 40 instrument identifiers (EPICs) from cap_market_search, e.g. ["GOLD"]. |
duration_s |
number | no | 30.0 |
How long to stream, in seconds: 1 to 600 (default 30). |
update_interval_s |
number | no | 1.0 |
Minimum seconds between kept ticks of the same EPIC (default 1); ticks arriving sooner are dropped. |
Get deal confirmation · Read-only
Read the broker's deal confirmation for a deal reference once and return it as the broker sent it: dealStatus (ACCEPTED or REJECTED) and the resulting dealId. Use it to check a deal sent with wait_for_confirm=false or one that came back TIMEOUT; to keep polling until the broker decides, use cap_trade_confirm_wait. Read-only.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
deal_reference |
string | yes | — | dealReference returned by an execute, close, cancel or amend call (e.g. o_...). |
Wait for deal confirmation · Read-only
Poll the broker's deal confirmation for a deal reference until it is ACCEPTED or REJECTED or timeout_s passes. Returns the confirmation with status set to its dealStatus, or {"status": "TIMEOUT"}. TIMEOUT is ambiguous: the deal may still have gone through, so check cap_trade_positions_list or cap_trade_orders_list before retrying anything. For one read use cap_trade_confirm_get. Read-only.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
deal_reference |
string | yes | — | dealReference returned by an execute, close, cancel or amend call (e.g. o_...). |
timeout_s |
number | no | 15.0 |
Seconds to keep polling before returning TIMEOUT (default 15). |
poll_interval_ms |
integer | no | 500 |
Milliseconds between polls (default 500). |
Execute previewed position · Changes state (destructive)
Place a real market order on the configured account from an unexpired, passing cap_trade_preview_position preview. Needs confirm=true, trading on and room under the open-position limit; dry-run blocks it. Allowlist, daily and size limits are checked again with the current settings (EPIC_NOT_ALLOWED / RISK_LIMIT). A preview executes once by default. PREVIEW_CHECKS_FAILED: failed checks; PREVIEW_ACCOUNT_MISMATCH: another account. TIMEOUT is ambiguous: check cap_trade_positions_list before retrying. Returns dealReference, the confirmation, the account and position_deal_id when a position opened.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
preview_id |
string | yes | — | preview_id of a passing cap_trade_preview_position result. |
confirm |
boolean | no | False |
Must be true to perform the action; false (default) refuses with CONFIRM_REQUIRED. |
wait_for_confirm |
boolean | no | True |
Wait for the broker's deal confirmation before returning (default true); the result's confirmation.status is then ACCEPTED, REJECTED or TIMEOUT. |
timeout_s |
number | no | 15.0 |
Seconds to wait for the confirmation (default 15). TIMEOUT does not mean the request failed; reconcile before retrying. |
Execute previewed working order · Changes state (destructive)
Place a real working order (pending LIMIT/STOP) on the configured account (demo or live) from an unexpired, passing cap_trade_preview_working_order preview. Needs confirm=true and trading on; dry-run blocks it. Allowlist, daily and working-order size limits are checked again with the current settings (EPIC_NOT_ALLOWED / RISK_LIMIT). By default a preview executes once. PREVIEW_CHECKS_FAILED: failed checks; PREVIEW_ACCOUNT_MISMATCH: another account. TIMEOUT is ambiguous: check cap_trade_orders_list before retrying. Returns dealReference, the confirmation and the account marker.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
preview_id |
string | yes | — | preview_id of a passing cap_trade_preview_working_order result. |
confirm |
boolean | no | False |
Must be true to perform the action; false (default) refuses with CONFIRM_REQUIRED. |
wait_for_confirm |
boolean | no | True |
Wait for the broker's deal confirmation before returning (default true); the result's confirmation.status is then ACCEPTED, REJECTED or TIMEOUT. |
timeout_s |
number | no | 15.0 |
Seconds to wait for the confirmation (default 15). TIMEOUT does not mean the request failed; reconcile before retrying. |
Amend working order · Changes state (destructive)
Change a real working order that has not triggered yet: trigger level, expiry, stop-loss or take-profit. Give at least one field. Fields you do not mention are kept (a trailing stop becomes fixed); remove_stop / remove_profit remove a side. A side held as a distance must be restated (stop_distance / profit_distance) or removed, else INVALID_REQUEST and nothing is sent. No preview, allowlist or size check; needs confirm=true and trading on (dry-run blocks it). For an open position use cap_trade_positions_amend; check with cap_trade_orders_list. amend_request is what was sent.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
deal_id |
string | yes | — | Deal id of a working order, from cap_trade_orders_list. |
level |
number | no | None |
New trigger price level. |
stop_level |
number | no | None |
New stop-loss price level. Alternative to stop_distance. |
stop_distance |
number | no | None |
New stop-loss distance, in price units. Alternative to stop_level. |
profit_level |
number | no | None |
New take-profit price level. Alternative to profit_distance. |
profit_distance |
number | no | None |
New take-profit distance, in price units. Alternative to profit_level. |
good_till_date |
string | no | None |
New expiry date-time in UTC, ISO 8601, e.g. 2026-12-31T23:59:00. |
remove_stop |
boolean | no | False |
true removes the stop-loss; cannot be combined with a new stop_level or stop_distance. |
remove_profit |
boolean | no | False |
true removes the take-profit; cannot be combined with a new profit_level or profit_distance. |
confirm |
boolean | no | False |
Must be true to perform the action; false (default) refuses with CONFIRM_REQUIRED. |
wait_for_confirm |
boolean | no | True |
Wait for the broker's deal confirmation before returning (default true); the result's confirmation.status is then ACCEPTED, REJECTED or TIMEOUT. |
timeout_s |
number | no | 15.0 |
Seconds to wait for the confirmation (default 15). TIMEOUT does not mean the request failed; reconcile before retrying. |
Cancel working order · Changes state (destructive)
Cancel a real working order that has not triggered yet, on the configured account. Needs confirm=true and trading enabled (dry-run mode blocks it); the EPIC allowlist is not applied. To exit an open position, use cap_trade_positions_close instead. A TIMEOUT confirmation is ambiguous: check cap_trade_orders_list before retrying. The result names the account (demo/live).
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
deal_id |
string | yes | — | Deal id of a working order, from cap_trade_orders_list. |
confirm |
boolean | no | False |
Must be true to perform the action; false (default) refuses with CONFIRM_REQUIRED. |
wait_for_confirm |
boolean | no | True |
Wait for the broker's deal confirmation before returning (default true); the result's confirmation.status is then ACCEPTED, REJECTED or TIMEOUT. |
timeout_s |
number | no | 15.0 |
Seconds to wait for the confirmation (default 15). TIMEOUT does not mean the request failed; reconcile before retrying. |
List working orders · Read-only
List the active account's working orders (pending LIMIT/STOP orders that have not triggered yet), each with its deal id, market, direction, size and level. Use it to find the deal_id for cap_trade_orders_amend and cap_trade_orders_cancel, and to reconcile after a TIMEOUT. Open positions are listed by cap_trade_positions_list. Read-only.
No parameters.
Amend position · Changes state (destructive)
Change the stop-loss and/or take-profit of a real open position. Pass at least one field to change (none is refused with INVALID_REQUEST). The stop and take-profit you do not mention are kept; remove_stop / remove_profit remove them. A trailing stop is kept on a best effort basis (re-sent at the current distance). No preview, allowlist or size check; confirm=true and enabled trading are required (dry-run mode blocks it). For a pending order use cap_trade_orders_amend; check with cap_trade_positions_get. amend_request is what was sent; the result names the account.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
deal_id |
string | yes | — | Deal id of an open position, from cap_trade_positions_list. |
stop_level |
number | no | None |
New stop-loss price level. Alternative to stop_distance. |
stop_distance |
number | no | None |
New stop-loss distance in price units, measured from the reference price the broker uses for the position (its opening level in our checks). Alternative to stop_level. |
profit_level |
number | no | None |
New take-profit price level. Alternative to profit_distance. |
profit_distance |
number | no | None |
New take-profit distance in price units, measured from the reference price the broker uses for the position (its opening level in our checks). Alternative to profit_level. |
guaranteed_stop |
boolean | no | None |
true switches to a guaranteed stop, false to a normal one; omit to leave unchanged. |
trailing_stop |
boolean | no | None |
true makes the stop trailing (give stop_distance), false turns trailing off; omit to leave unchanged. |
remove_stop |
boolean | no | False |
true removes the stop-loss; cannot be combined with a new stop_level or stop_distance, nor with guaranteed_stop or trailing_stop. |
remove_profit |
boolean | no | False |
true removes the take-profit; cannot be combined with a new profit_level or profit_distance. |
confirm |
boolean | no | False |
Must be true to perform the action; false (default) refuses with CONFIRM_REQUIRED. |
wait_for_confirm |
boolean | no | True |
Wait for the broker's deal confirmation before returning (default true); the result's confirmation.status is then ACCEPTED, REJECTED or TIMEOUT. |
timeout_s |
number | no | 15.0 |
Seconds to wait for the confirmation (default 15). TIMEOUT does not mean the request failed; reconcile before retrying. |
Close position · Changes state (destructive)
Close a whole open position at market on the configured account: a real trade. Needs confirm=true and trading enabled (dry-run mode blocks it); the EPIC allowlist is not applied, so any open position can be closed. To remove a pending order that has not triggered, use cap_trade_orders_cancel. A TIMEOUT confirmation is ambiguous: check cap_trade_positions_list before retrying. The result names the account (demo/live).
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
deal_id |
string | yes | — | Deal id of an open position, from cap_trade_positions_list. |
confirm |
boolean | no | False |
Must be true to perform the action; false (default) refuses with CONFIRM_REQUIRED. |
wait_for_confirm |
boolean | no | True |
Wait for the broker's deal confirmation before returning (default true); the result's confirmation.status is then ACCEPTED, REJECTED or TIMEOUT. |
timeout_s |
number | no | 15.0 |
Seconds to wait for the confirmation (default 15). TIMEOUT does not mean the request failed; reconcile before retrying. |
Get position · Read-only
Get one open position by deal id, with its direction, size, open level, stop and limit and the market's current prices. Use it to check a position after executing or amending it; cap_trade_positions_list shows all of them at once. Read-only.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
deal_id |
string | yes | — | The position id: from cap_trade_positions_list or the position_deal_id of an execute result; not the confirmation's dealId (that is the order id). |
List open positions · Read-only
List all open positions on the active account, each with its deal id, market, direction, size, open level, unrealised P&L and any stop or limit. Use it to check exposure, to find the deal_id for cap_trade_positions_get, cap_trade_positions_amend and cap_trade_positions_close, and to reconcile after a TIMEOUT. Pending orders are listed by cap_trade_orders_list. Read-only.
No parameters.
Preview position · Read-only
Check a market order (buy or sell now) without sending it: trading enabled, EPIC allowed, daily order limit, market open (fails when the market is closed), size against the broker's rules and the size limit. A stop or take-profit level cannot be combined with a distance or amount for the same side. If all_checks_passed is true, pass preview_id to cap_trade_execute_position; by default a preview executes once, expires after about 2 minutes and is tied to the account it was made on. For a pending order use cap_trade_preview_working_order. The result names the account.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
epic |
string | yes | — | Instrument identifier (EPIC) from cap_market_search, e.g. GOLD. |
direction |
string | yes | — | BUY or SELL (lower case is accepted). |
size |
number | yes | — | Deal size in the instrument's units; must be within the market's min/max deal size and a multiple of its size increment (see cap_market_get). |
guaranteed_stop |
boolean | no | False |
true asks the broker for a guaranteed stop (set a stop with it). |
trailing_stop |
boolean | no | False |
true makes the stop a trailing stop; give the stop as stop_distance. |
stop_level |
number | no | None |
Stop-loss price level. Alternative to stop_distance and stop_amount. |
stop_distance |
number | no | None |
Stop-loss distance from the current price, in price units. Alternative to stop_level and stop_amount. |
stop_amount |
number | no | None |
Stop-loss given as the loss amount in the account currency. Alternative to stop_level and stop_distance. |
profit_level |
number | no | None |
Take-profit price level. Alternative to profit_distance and profit_amount. |
profit_distance |
number | no | None |
Take-profit distance from the current price, in price units. Alternative to profit_level and profit_amount. |
profit_amount |
number | no | None |
Take-profit given as the profit amount in the account currency. Alternative to profit_level and profit_distance. |
Preview working order · Read-only
Check a working order (a pending LIMIT or STOP order that triggers at level) without sending it. Same checks as cap_trade_preview_position with the working-order size limit, but a closed market does not fail it. A stop or take-profit level cannot be combined with a distance or amount for the same side. Nothing is sent to the broker. If all_checks_passed is true, pass preview_id to cap_trade_execute_working_order; by default a preview executes once, expires after about 2 minutes and is tied to the account it was made on. The result names the account (demo/live).
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
epic |
string | yes | — | Instrument identifier (EPIC) from cap_market_search, e.g. GOLD. |
direction |
string | yes | — | BUY or SELL (lower case is accepted). |
type |
string | yes | — | LIMIT or STOP (lower case is accepted). |
level |
number | yes | — | Price level at which the order triggers. |
size |
number | yes | — | Deal size in the instrument's units; must be within the market's min/max deal size and a multiple of its size increment (see cap_market_get). |
guaranteed_stop |
boolean | no | False |
true asks the broker for a guaranteed stop (set a stop with it). |
trailing_stop |
boolean | no | False |
true makes the stop a trailing stop; give the stop as stop_distance. |
stop_level |
number | no | None |
Stop-loss price level. Alternative to stop_distance and stop_amount. |
stop_distance |
number | no | None |
Stop-loss distance from the current price, in price units. Alternative to stop_level and stop_amount. |
stop_amount |
number | no | None |
Stop-loss given as the loss amount in the account currency. Alternative to stop_level and stop_distance. |
profit_level |
number | no | None |
Take-profit price level. Alternative to profit_distance and profit_amount. |
profit_distance |
number | no | None |
Take-profit distance from the current price, in price units. Alternative to profit_level and profit_amount. |
profit_amount |
number | no | None |
Take-profit given as the profit amount in the account currency. Alternative to profit_level and profit_distance. |
good_till_date |
string | no | None |
Optional expiry date-time in UTC, ISO 8601, e.g. 2026-12-31T23:59:00. |
Add market to watchlist · Changes state
Add one market (EPIC) to an existing watchlist. Needs confirm=true; it does not need trading to be enabled, but dry-run mode blocks it. Undo with cap_watchlists_remove_market.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
watchlist_id |
string | yes | — | Watchlist id from cap_watchlists_list. |
epic |
string | yes | — | Instrument identifier (EPIC) from cap_market_search, e.g. GOLD. |
confirm |
boolean | no | False |
Must be true to perform the action; false (default) refuses with CONFIRM_REQUIRED. |
Create watchlist · Changes state
Create a new, empty watchlist on the account. Needs confirm=true; it does not need trading to be enabled, but dry-run mode blocks it. Add markets afterwards with cap_watchlists_add_market (the new id is in the response or in cap_watchlists_list).
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string | yes | — | Name of the new watchlist. |
confirm |
boolean | no | False |
Must be true to perform the action; false (default) refuses with CONFIRM_REQUIRED. |
Delete watchlist · Changes state (destructive)
Delete a whole watchlist from the account; positions and orders are not affected. Needs confirm=true; it does not need trading to be enabled, but dry-run mode blocks it. To remove a single market use cap_watchlists_remove_market.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
watchlist_id |
string | yes | — | Watchlist id from cap_watchlists_list. |
confirm |
boolean | no | False |
Must be true to perform the action; false (default) refuses with CONFIRM_REQUIRED. |
Get watchlist · Read-only
Get one watchlist with the markets it contains (with their EPICs). Take watchlist_id from cap_watchlists_list. Read-only.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
watchlist_id |
string | yes | — | Watchlist id from cap_watchlists_list. |
List watchlists · Read-only
List the watchlists saved on the account, with their ids and names. Use cap_watchlists_get to see the markets in one of them. Read-only.
No parameters.
Remove market from watchlist · Changes state (destructive)
Remove one market (EPIC) from a watchlist; the watchlist itself stays. Needs confirm=true; it does not need trading to be enabled, but dry-run mode blocks it. To delete the whole watchlist use cap_watchlists_delete.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
watchlist_id |
string | yes | — | Watchlist id from cap_watchlists_list. |
epic |
string | yes | — | Instrument identifier (EPIC) from cap_market_search, e.g. GOLD. |
confirm |
boolean | no | False |
Must be true to perform the action; false (default) refuses with CONFIRM_REQUIRED. |
Unofficial · not affiliated with Capital.com · not financial advice · demo-first. See Safety Model.
Getting Started
Reference
- Tools Reference
- Resources Reference
- Prompts Reference
- Configuration Reference
- Error Reference
- API Stability
Guides
Contributing