Forex | Account Queries

These endpoints read account state and order history. They require an active session (see Connect REST API).

Endpoints

Method Parameters Description
GetClientAndTradingAccount Returns the client account and the list of trading accounts linked to the authenticated user.
ListOpenPositions TradingAccountId Returns all currently open positions on a trading account.
ListActiveStopLimitOrders TradingAccountId Returns all pending stop and limit orders.
GetOrder OrderId Returns a single order by id, including fill history and attached IfDone orders.
ListTradeHistory TradingAccountId, MaxResults Returns the trade-order history for the account, most recent first.
ListStopLimitOrderHistory TradingAccountId, MaxResults Returns the stop-limit order history for the account, most recent first.
SimulateTrade JSON / scalar / order-object Runs a trade order through the server validator without submitting it. Useful for pre-flight margin and price-tolerance checks. Accepts the same three overload tiers as NewTradeOrder.

Retired Endpoints

The official Forex.com / StoneX / CityIndex reference still documents a handful of endpoints that the live server no longer serves. These are intentionally not exposed by the component:

Sample

List open positions and the last 50 trades


oForex := TsgcWSAPI_Forex.Create(nil);
oForex.Credentials.UserName := '<username>';
oForex.Credentials.Password := '<password>';
oForex.Credentials.AppKey  := '<appkey>';
oForex.Connect;

ShowMessage(oForex.REST_API.ListOpenPositions(oForex.TradingAccountId));
ShowMessage(oForex.REST_API.ListTradeHistory(oForex.TradingAccountId, 50));