View as Markdown

API reference / Account REST API (/users/current)

History

Account REST API (/users/current). Generated from the OpenAPI document the services export (/openapi.json).

Samples use the placeholders YOUR_API_KEY and YOUR_ACCOUNT_ID. Paste a sandbox key (twsk_…) to fill them in and to use Try it. It stays in this browser tab and is only sent to the sandbox, never to the live API.

Try it is off in this build: No sandbox URL is configured for this build of the docs.

GET /users/current/accounts/{account_id}/history-deals/position/{position_id}

Get deals by position Auth: auth-token

Every deal of one position: entries in and out, reversals and close-by. Works on MT4 and MT5.

Parameters of GET /users/current/accounts/{account_id}/history-deals/position/{position_id}
ParameterInTypeDescription
account_id requiredpathstring
position_id requiredpathstring

Responses

  • 200 The deals, sorted by time then id. An empty list when none match. · Deal[]
  • 400 Bad request. On the account API paths a body or query validation failure is a 400 ValidationError with details: [{parameter, message}]. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/users/current/accounts/YOUR_ACCOUNT_ID/history-deals/position/POSITION_ID' \
  -H 'auth-token: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/users/current/accounts/YOUR_ACCOUNT_ID/history-deals/position/POSITION_ID",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/users/current/accounts/YOUR_ACCOUNT_ID/history-deals/position/POSITION_ID");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /users/current/accounts/{account_id}/history-deals/ticket/{ticket}

Get deals by ticket Auth: auth-token

Deals by ticket, as a list. On MT5 this is the deal with this deal ticket. On MT4 it is the deals of this order ticket.

Parameters of GET /users/current/accounts/{account_id}/history-deals/ticket/{ticket}
ParameterInTypeDescription
account_id requiredpathstring
ticket requiredpathstring

Responses

  • 200 The deals, sorted by time then id. An empty list when none match. · Deal[]
  • 400 Bad request. On the account API paths a body or query validation failure is a 400 ValidationError with details: [{parameter, message}]. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/users/current/accounts/YOUR_ACCOUNT_ID/history-deals/ticket/TICKET' \
  -H 'auth-token: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/users/current/accounts/YOUR_ACCOUNT_ID/history-deals/ticket/TICKET",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/users/current/accounts/YOUR_ACCOUNT_ID/history-deals/ticket/TICKET");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /users/current/accounts/{account_id}/history-deals/time/{start_time}/{end_time}

Get deals by time Auth: auth-token

Deals whose time is in the window. Balance, credit, commission and other non-trade deals are included (DEAL_TYPE_BALANCE and so on). Risk tools need them for daily loss baselines. startTime and endTime are ISO-8601 UTC. The start is included and the end is not. offset is 0 or more and limit is 1 to 1000 (default 1000). Until the broker's UTC offset is known this answers 503 NotSynchronizedError with tickwireError: broker_time_unknown. It never guesses.

Parameters of GET /users/current/accounts/{account_id}/history-deals/time/{start_time}/{end_time}
ParameterInTypeDescription
account_id requiredpathstring
start_time requiredpathstring
end_time requiredpathstring
offsetquerystring | null
limitquerystring | null

Responses

  • 200 The deals, sorted by time then id. An empty list when none match. · Deal[]
  • 400 Bad request. On the account API paths a body or query validation failure is a 400 ValidationError with details: [{parameter, message}]. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/users/current/accounts/YOUR_ACCOUNT_ID/history-deals/time/2026-09-01T00%3A00%3A00.000/2026-09-02T00%3A00%3A00.000' \
  -H 'auth-token: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/users/current/accounts/YOUR_ACCOUNT_ID/history-deals/time/2026-09-01T00%3A00%3A00.000/2026-09-02T00%3A00%3A00.000",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/users/current/accounts/YOUR_ACCOUNT_ID/history-deals/time/2026-09-01T00%3A00%3A00.000/2026-09-02T00%3A00%3A00.000");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /users/current/accounts/{account_id}/history-orders/position/{position_id}

Get history orders by position Auth: auth-token

Every history order of one position. Works on MT4 and MT5.

Parameters of GET /users/current/accounts/{account_id}/history-orders/position/{position_id}
ParameterInTypeDescription
account_id requiredpathstring
position_id requiredpathstring

Responses

  • 200 The history orders, sorted by time then id. An empty list when none match. · Order[]
  • 400 Bad request. On the account API paths a body or query validation failure is a 400 ValidationError with details: [{parameter, message}]. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/users/current/accounts/YOUR_ACCOUNT_ID/history-orders/position/POSITION_ID' \
  -H 'auth-token: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/users/current/accounts/YOUR_ACCOUNT_ID/history-orders/position/POSITION_ID",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/users/current/accounts/YOUR_ACCOUNT_ID/history-orders/position/POSITION_ID");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /users/current/accounts/{account_id}/history-orders/ticket/{ticket}

Get history orders by ticket Auth: auth-token

The history orders with this order ticket, as a list. Each has its final state, doneTime, positionId and fillingMode. Works on MT4 and MT5.

Parameters of GET /users/current/accounts/{account_id}/history-orders/ticket/{ticket}
ParameterInTypeDescription
account_id requiredpathstring
ticket requiredpathstring

Responses

  • 200 The history orders, sorted by time then id. An empty list when none match. · Order[]
  • 400 Bad request. On the account API paths a body or query validation failure is a 400 ValidationError with details: [{parameter, message}]. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/users/current/accounts/YOUR_ACCOUNT_ID/history-orders/ticket/TICKET' \
  -H 'auth-token: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/users/current/accounts/YOUR_ACCOUNT_ID/history-orders/ticket/TICKET",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/users/current/accounts/YOUR_ACCOUNT_ID/history-orders/ticket/TICKET");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /users/current/accounts/{account_id}/history-orders/time/{start_time}/{end_time}

Get history orders by time Auth: auth-token

History orders whose done time is in the window. An order that was never done counts by its setup time. startTime and endTime are ISO-8601 UTC. The start is included and the end is not. offset is 0 or more and limit is 1 to 1000 (default 1000). Until the broker's UTC offset is known this answers 503 NotSynchronizedError with tickwireError: broker_time_unknown. It never guesses.

Parameters of GET /users/current/accounts/{account_id}/history-orders/time/{start_time}/{end_time}
ParameterInTypeDescription
account_id requiredpathstring
start_time requiredpathstring
end_time requiredpathstring
offsetquerystring | null
limitquerystring | null

Responses

  • 200 The history orders, sorted by time then id. An empty list when none match. · Order[]
  • 400 Bad request. On the account API paths a body or query validation failure is a 400 ValidationError with details: [{parameter, message}]. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/users/current/accounts/YOUR_ACCOUNT_ID/history-orders/time/2026-09-01T00%3A00%3A00.000/2026-09-02T00%3A00%3A00.000' \
  -H 'auth-token: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/users/current/accounts/YOUR_ACCOUNT_ID/history-orders/time/2026-09-01T00%3A00%3A00.000/2026-09-02T00%3A00%3A00.000",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/users/current/accounts/YOUR_ACCOUNT_ID/history-orders/time/2026-09-01T00%3A00%3A00.000/2026-09-02T00%3A00%3A00.000");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.