Skip to content

Account Skill

The xbtfx-account skill provides AI agents with read-only access to account information, open positions, pending orders, and trade history.

  • Skill name: xbtfx-account
  • Type: Read-only
  • Required env var: XBTFX_API_KEY
  • Base URL: https://interface.xbtfx.com
  • Check account balance, equity, free margin, or margin level
  • Query current leverage settings
  • List open positions (all or filtered by symbol)
  • List pending orders
  • Retrieve trade history for a date range
  • Executing trades, closing positions, or modifying SL/TP — use the Trading Skill
  • Looking up symbol specifications or contract sizes — use the Market Data Skill
  • Streaming real-time quotes or events — use the WebSocket Skill
EndpointMethodWeightDescription
/v1/auth/statusGET1Check API key status and permissions
/v1/accountGET1Account balance, equity, and margin
/v1/positionsGET1List open positions
/v1/ordersGET1List pending orders
/v1/historyGET2Retrieve trade history

Check the status and permissions of the current API key.

Response:

{
"status": "active",
"login": 12345678,
"permissions": ["read", "trade"],
"margin_mode": "hedging",
"tier": "standard"
}

Retrieve account balance, equity, margin, and related fields.

Response Fields:

FieldTypeDescription
loginnumberMT5 account login
balancenumberAccount balance
equitynumberAccount equity (balance + floating P/L)
marginnumberUsed margin
margin_freenumberAvailable margin
profitnumberCurrent floating profit/loss
leveragenumberAccount leverage (e.g., 500)
margin_modestringhedging or netting

Example Response:

{
"login": 12345678,
"balance": 10000.00,
"equity": 10250.50,
"margin": 200.00,
"margin_free": 10050.50,
"profit": 250.50,
"leverage": 500,
"margin_mode": "hedging"
}

List all open positions, optionally filtered by symbol.

Query Parameters:

ParameterTypeRequiredDescription
symbolstringNoFilter positions by symbol

Response Fields:

FieldTypeDescription
ticketnumberPosition ticket number
symbolstringTrading symbol
sidestringbuy or sell
volumenumberPosition volume in lots
price_opennumberEntry price
price_currentnumberCurrent market price
slnumberStop-loss price (0 if not set)
tpnumberTake-profit price (0 if not set)
profitnumberFloating profit/loss
swapnumberAccumulated swap

The response includes a count field with the total number of positions.

Example:

Terminal window
GET /v1/positions?symbol=BTCUSD
{
"positions": [
{
"ticket": 12345678,
"symbol": "BTCUSD",
"side": "buy",
"volume": 0.01,
"price_open": 65000.00,
"price_current": 65500.00,
"sl": 60000.00,
"tp": 70000.00,
"profit": 5.00,
"swap": -0.12
}
],
"count": 1
}

List all pending orders.

Response Fields:

FieldTypeDescription
ticketnumberOrder ticket number
symbolstringTrading symbol
typestringOrder type
volumenumberOrder volume in lots
pricenumberOrder trigger price
slnumberStop-loss price
tpnumberTake-profit price

The response includes a count field with the total number of orders.

Order Types:

TypeDescription
buy_limitBuy at or below a specified price
sell_limitSell at or above a specified price
buy_stopBuy when price rises to a specified level
sell_stopSell when price falls to a specified level
buy_stop_limitBuy stop that places a limit order when triggered
sell_stop_limitSell stop that places a limit order when triggered

Retrieve trade history for a specified period.

Query Parameters:

ParameterTypeRequiredDescription
periodstringNoPredefined period (default: today)
fromstringNoStart date (YYYY-MM-DD), alternative to period
tostringNoEnd date (YYYY-MM-DD), alternative to period

Use either period for a predefined range, or from/to for a custom date range.

Period Enum:

ValueDescription
todayCurrent trading day
last_3_daysLast 3 days
last_weekLast 7 days
last_monthLast 30 days
last_3_monthsLast 90 days
last_6_monthsLast 180 days
allAll available history

Entry Types:

ValueDescription
inPosition opened
outPosition closed
in_outPosition opened and closed (same deal)
out_byClosed by opposite position

Example:

Terminal window
GET /v1/history?period=last_week

Response:

{
"deals": [
{
"ticket": 99001122,
"symbol": "EURUSD",
"side": "buy",
"entry": "in",
"volume": 0.10,
"price": 1.08550,
"profit": 0.00,
"time": "2025-01-15T10:30:00Z",
"order": 88001122,
"position": 12345678
}
],
"count": 1
}

Agents using this skill must follow these behavioral rules:

  1. This is a read-only skill. Never attempt to modify account state using these endpoints.
  2. Check auth status first. Call /v1/auth/status to verify the API key is active before making other requests.
  3. Always mask API keys in output. Never display the full API key to the user.
  4. Present monetary values clearly. Display balances and profit/loss with appropriate formatting.
  5. Respect rate limits. Monitor weight consumption to avoid 429 responses.
  6. Use symbol filters when possible. Filter positions by symbol to reduce response size when the user asks about specific instruments.
  7. Clarify margin mode to the user. The margin_mode field (hedging or netting) affects how positions and close-by operations work. Surface this information when relevant.