The WebAPI server enforces self-protecting rate limits. All client actions are subject to these restrictions.
Note: Limit values may be adjusted (increased or decreased) without prior notice.
•Send an ApiLimitRequest to retrieve current values
•Available limits are defined in the ApiLimit enum
1. Rate Limits Maximum allowed actions per time period
Example: API_LIMIT_CONNECTION_RATE
2. Requests in Processing Concurrent request capacity
Example: API_LIMIT_SESSION_INFORMATION_REQUESTS_IN_PROCESSING
3. Subscription Limits Simultaneous subscription allowances
Example: API_LIMIT_SESSION_INFORMATION_SUBSCRIPTIONS
4. Other Operational Limits Miscellaneous restrictions
Example: API_LIMIT_HISTORICAL_ORDERS_DAYS
•Limit violations result in action rejection.
•Some limitations apply to returned data. For example, API_LIMIT_HISTORICAL_ORDERS_DAYS restricts historical data requests, resulting in truncated responses.
•Some violations (limits with _TO_CLOSE_CONNECTION suffix) force disconnection.
Example: API_LIMIT_SOCKET_UNREADY_PERIOD_TO_CLOSE_CONNECTION
Client Message:
Request API_LIMIT_CONNECTION_RATE (1), API_LIMIT_CONNECTIONS_PER_IP (3), API_LIMIT_API_LIMITS_SUBSCRIPTIONS_AND_REQUESTS_IN_PROCESSING (390).
{
"information_requests": [
{
"id": 1,
"api_limit_request": {
"limits": [
1,
3,
390
]
}
}
]
}
Server Response:
{
"information_reports": [
{
"id": 1,
"status_code": 0,
"api_limit_report": {
"limit_entries": [
{
"limit": 1,
"status_code": 1,
"value": 1000,
"period_sec": 100
},
{
"limit": 3,
"status_code": 1,
"value": 1000
},
{
"limit": 390,
"status_code": 1,
"value": 1
}
]
}
}
]
}
Some messages contain additional text details about the data. If a text field has the Text type, it can be localized. A full list of available messages is described in webapi_2_text.md, which is also provided along with the protocol.
Each row in webapi_2_text.md corresponds to a localized message and contains the following columns:
•Key → Text.key – Identifier of the message type. The key is guaranteed to remain unchanged. If a format update is needed, a new key will be created instead.
•Format – Format string associated with the key.
A Text object consists of the following fields:
•Text.key – Identifier of the message type. The key is guaranteed to remain unchanged. If a format update is needed, a new key will be created instead. Matches the Key column in webapi_2_text.md.
•Text.param – Collection of non-localizable values that should be applied to the format.
•Text.text – The already formatted English string, ready to be displayed.
Handling Changes in New Releases
In general, new releases may add or remove rows from the message list. You should be able to handle unknown messages gracefully. If you do not have a localized format for a key, Text.text can be used as a fallback.
UserMessage is a mechanism to deliver text messages from the server to the client. Typically used to inform about internal or account issues, and may suggest actions to perform (e.g., re-login or contact support).
Key characteristics: - User messages are not standardized (except for UserMessage.message_type) - They shouldn’t be parsed by clients - Designed to be shown to end-users - Exception: Messages with UserMessage.message_type = MESSAGE_TYPE_LOG should not be displayed
Informative message after logoff/disconnect:
{
"user_messages": [
{
"message_type": 4,
"source": "Web API
Server",
"text": "Message cannot be processed
within this user session after logoff or disconnect."
}
]
}
Client application not responding to server Ping:
{
"user_messages": [
{
"message_type": 4,
"source": "Web API Server",
"text": "No response to server ping request sent 30 seconds
ago."
}
]
}
Client approaching account limit:
{
"user_messages": [
{
"message_type": 2,
"source": "Web API Server",
"text": "Your current number of accounts is 4950. If your number
of accounts exceeds 5000, you will not be able to log in. Please remove inactive
accounts or contact customer support to increase the
limit."
}
]
}
The WebAPI server supports multiple account types, which determine how you interact with an account and the data available for it.
•Regular account
•Group account – Account.is_group_member=true
•Omnibus account – Account.is_omnibus=true
•Not cleared by statement accounts – Account.cleared_by_statements=false
A group account can be either a master account or a sub-account that shares resources with other accounts in the group.
•The purchasing power limit may be empty for group
accounts.
•Purchasing power is a real-time snapshot calculated by the server using data from all accounts in the group.
o As a result, it may not be synchronized with values reported for an individual account.
Not Cleared by Statement Accounts
For accounts that are not cleared by statements, certain subscription scopes and requests are not supported:
•SUBSCRIPTION_SCOPE_POSITIONS and SUBSCRIPTION_SCOPE_ACCOUNT_SUMMARY
in
TradeSubscription
Requests for such accounts do not fail, but no data is returned.
E.g., crypto exchange accounts, where there is no need for clearing since trade results are directly applied to the account balance.
See also Account.supports_exchange_balances_subscription and Account.supports_exchange_positions_subscription.