Data Item:Get Open Position
Last updated February 10, 2024
Get an open position on an account by its reference.
This data item returns a structured JSON response, which you can refer to in other Story Items and Data Items that can accept this type of data (For example, Set Context Story Item).
{
"id": "string",
"direction": "string enum | buy,sell",
"symbol": "string",
"contract_id": "string | null",
"volume": number,
"entry_price": number,
"stop_loss": number,
"take_profit": number,
"profit": number,
"unrealized_profit": number,
"realized_profit": number,
"commission": number,
"created_at": "string | DateTime"
}
Example: Your story may wish to get the details of an open position, save it to a variable or context variable, which can then be accessed by other items that allow dot-notation data access. The following example gets a position data, saves it to context, so that we can log out the profit for the open position.
Was this article helpful?
📊