View as Markdown

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

Market data

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}/historical-market-data/symbols/{symbol}/ticks

Get historical ticks Auth: auth-token

Ticks at or after startTime, going forwards, after skipping offset. MT5 only. Without startTime you get the latest limit ticks. limit is 1 to 1000 (default 1000). On MT4 this is 400 not_supported_on_mt4. Each account runs at most 5 historical requests at once. The 6th is 429 TooManyRequestsError with Retry-After.

Parameters of GET /users/current/accounts/{account_id}/historical-market-data/symbols/{symbol}/ticks
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredpathstring
startTimequerystring | null
offsetquerystring | null
limitquerystring | null

Responses

  • 200 The ticks, oldest first. · Tick[]
  • 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/historical-market-data/symbols/EURUSD/ticks' \
  -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/historical-market-data/symbols/EURUSD/ticks",
    )
    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/historical-market-data/symbols/EURUSD/ticks");
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}/historical-market-data/symbols/{symbol}/timeframes/{timeframe}/candles

Get historical candles Auth: auth-token

Up to limit candles that open at or before startTime, oldest first. Without startTime you get the latest candles. limit is 1 to 1000 (default 1000). Timeframes: 1m 2m 3m 4m 5m 6m 10m 12m 15m 20m 30m 1h 2h 3h 4h 6h 8h 12h 1d 1w 1mn. MT4 has 1m 5m 15m 30m 1h 4h 1d 1w 1mn, and the others answer not_supported_on_mt4. Each account runs at most 5 historical requests at once. The 6th is 429 TooManyRequestsError with Retry-After.

Parameters of GET /users/current/accounts/{account_id}/historical-market-data/symbols/{symbol}/timeframes/{timeframe}/candles
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredpathstring
timeframe requiredpathstring
startTimequerystring | null
limitquerystring | null

Responses

  • 200 The candles, oldest first. · Candle[]
  • 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/historical-market-data/symbols/EURUSD/timeframes/1h/candles' \
  -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/historical-market-data/symbols/EURUSD/timeframes/1h/candles",
    )
    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/historical-market-data/symbols/EURUSD/timeframes/1h/candles");
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}/symbols

List symbols Auth: auth-token

Every symbol the terminal knows, as a list of names. Works on MT4 and MT5.

Parameters of GET /users/current/accounts/{account_id}/symbols
ParameterInTypeDescription
account_id requiredpathstring

Responses

  • 200 Every symbol name the terminal knows. · string[]
  • 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/symbols' \
  -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/symbols",
    )
    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/symbols");
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}/symbols/{symbol}/current-book

Get the market depth Auth: auth-token

The symbol's market depth (order book). MT5 only. On MT4 this is 400 not_supported_on_mt4. A symbol whose broker publishes no depth is 404 with tickwireError: depth_unavailable. keepSubscription is accepted. Every read is live from the terminal, so there is no subscription to keep.

Parameters of GET /users/current/accounts/{account_id}/symbols/{symbol}/current-book
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredpathstring
keepSubscriptionquerystring | null

Responses

  • 200 The order book. · Book
  • 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/symbols/EURUSD/current-book' \
  -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/symbols/EURUSD/current-book",
    )
    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/symbols/EURUSD/current-book");
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}/symbols/{symbol}/current-candles/{timeframe}

Get the current candle Auth: auth-token

The candle that is forming now. Timeframes: 1m 2m 3m 4m 5m 6m 10m 12m 15m 20m 30m 1h 2h 3h 4h 6h 8h 12h 1d 1w 1mn. MT4 has 1m 5m 15m 30m 1h 4h 1d 1w 1mn, and the others answer not_supported_on_mt4. keepSubscription is accepted. Every read is live from the terminal, so there is no subscription to keep.

Parameters of GET /users/current/accounts/{account_id}/symbols/{symbol}/current-candles/{timeframe}
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredpathstring
timeframe requiredpathstring
keepSubscriptionquerystring | null

Responses

  • 200 The forming candle. · Candle
  • 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/symbols/EURUSD/current-candles/1h' \
  -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/symbols/EURUSD/current-candles/1h",
    )
    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/symbols/EURUSD/current-candles/1h");
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}/symbols/{symbol}/current-price

Get the current price Auth: auth-token

The symbol's current bid and ask, with tick values and the quote time. Before the terminal has a quote this is 503 NotSynchronizedError with Retry-After. keepSubscription is accepted. Every read is live from the terminal, so there is no subscription to keep.

Parameters of GET /users/current/accounts/{account_id}/symbols/{symbol}/current-price
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredpathstring
keepSubscriptionquerystring | null

Responses

  • 200 The current bid and ask. · Price
  • 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/symbols/EURUSD/current-price' \
  -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/symbols/EURUSD/current-price",
    )
    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/symbols/EURUSD/current-price");
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}/symbols/{symbol}/current-tick

Get the current tick Auth: auth-token

The symbol's latest tick: bid, ask and, when the broker sends them, last and volume. keepSubscription is accepted. Every read is live from the terminal, so there is no subscription to keep.

Parameters of GET /users/current/accounts/{account_id}/symbols/{symbol}/current-tick
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredpathstring
keepSubscriptionquerystring | null

Responses

  • 200 The latest tick. · Tick
  • 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/symbols/EURUSD/current-tick' \
  -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/symbols/EURUSD/current-tick",
    )
    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/symbols/EURUSD/current-tick");
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}/symbols/{symbol}/specification

Get a symbol's specification Auth: auth-token

The symbol's trading rules: volumes, contract size, filling modes, margins, swaps, allowed order types, digits, point and stop levels. pipSize is only set for FX symbols. quoteSessions and tradeSessions are only present when the platform reports them. They are never guessed. An unknown symbol is 404.

Parameters of GET /users/current/accounts/{account_id}/symbols/{symbol}/specification
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredpathstring

Responses

  • 200 The symbol's trading rules. · SymbolSpecification
  • 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/symbols/EURUSD/specification' \
  -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/symbols/EURUSD/specification",
    )
    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/symbols/EURUSD/specification");
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.

POST /users/current/accounts/{account_id}/symbols/{symbol}/unsubscribe

Unsubscribe from a symbol Auth: auth-token

Release the terminal's market depth subscription for the symbol. Answers 204 with no body.

Parameters of POST /users/current/accounts/{account_id}/symbols/{symbol}/unsubscribe
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredpathstring

Responses

  • 204 Released. There is no body.
  • 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 POST 'https://api.tickwire.io/users/current/accounts/YOUR_ACCOUNT_ID/symbols/EURUSD/unsubscribe' \
  -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(
        "POST",
        "/users/current/accounts/YOUR_ACCOUNT_ID/symbols/EURUSD/unsubscribe",
        idempotency_key="my-request-1",
        reason="why you are doing this",
    )
    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("POST", "/users/current/accounts/YOUR_ACCOUNT_ID/symbols/EURUSD/unsubscribe", {
  idempotencyKey: "my-request-1",
  reason: "why you are doing this",
});
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.