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,
"server": "XBTFX-Live",
"permissions": ["read", "trade"]
}

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

Response Fields:

FieldTypeDescription
loginnumberMT5 account login
serverstringMT5 server name
currencystringAccount currency (e.g., USD)
balancenumberAccount balance
equitynumberAccount equity (balance + floating P/L)
marginnumberUsed margin
free_marginnumberAvailable margin
margin_levelnumberMargin level as a percentage
leveragenumberAccount leverage (e.g., 500)
margin_modestringhedging or netting

Example Response:

{
"login": 12345678,
"server": "XBTFX-Live",
"currency": "USD",
"balance": 10000.00,
"equity": 10250.50,
"margin": 200.00,
"free_margin": 10050.50,
"margin_level": 5125.25,
"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
open_pricenumberEntry price
current_pricenumberCurrent market price
slnumberStop-loss price (0 if not set)
tpnumberTake-profit price (0 if not set)
profitnumberFloating profit/loss
swapnumberAccumulated swap
open_timestringPosition open timestamp
commentstringTrade comment

Example:

Terminal window
GET /v1/positions?symbol=BTCUSD
{
"positions": [
{
"ticket": 12345678,
"symbol": "BTCUSD",
"side": "buy",
"volume": 0.01,
"open_price": 65000.00,
"current_price": 65500.00,
"sl": 60000.00,
"tp": 70000.00,
"profit": 5.00,
"swap": -0.12,
"open_time": "2025-01-15T10:30:00Z",
"comment": ""
}
]
}

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
open_timestringOrder placement timestamp
commentstringOrder comment

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 (ISO 8601)
tostringNoEnd date (ISO 8601)

Period Enum:

ValueDescription
todayCurrent trading day
yesterdayPrevious trading day
weekCurrent week
monthCurrent month
customUse from and to parameters

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=week

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 with the account currency. Use the currency field from /v1/account when displaying balances and profit/loss.
  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.