GetTradingReadiness¶
Read-only TCP command for checking the license gates used when opening trades. No HTTP route is registered. Access: SESSION_ADMIN, SESSION_DEALER, SESSION_SYSTEM, SESSION_MANAGER; no additional command-specific permission is required.
Request¶
No command-specific fields are required in data.
| Envelope field | Type | Description |
|---|---|---|
| command | string | GetTradingReadiness. |
| extID | string | Caller-supplied correlation ID, echoed in the response. |
| __token | string | Authentication token from the session authentication command. |
| data | object | Empty object. |
{
"command": "GetTradingReadiness",
"extID": "readiness-1",
"__token": "<session-token>",
"data": {}
}
Response¶
The envelope contains extID (string), status (integer HTTP-style status), and data (object). A successful read returns status 200 even when trading_ready is false. Current engines also return a nested license health snapshot; older engines omit that field. Clients should ignore the missing optional field when connected to an older engine.
| Data field | Type | Description |
|---|---|---|
| server_ready | integer | Common-config runtime initialization flag. 1 means the license state has been applied; initial value is 0. Not a general server-health indicator. |
| license_status | integer | License status from the common configuration snapshot. |
| runtime_license_status | integer | License status used by the runtime config license check. |
| license_expire | integer | Common-config license expiration as Unix seconds in UTC; 0 when unset. |
| trading_ready | boolean | True only when server_ready == 1, both license statuses are trial (0), active (1), or development (2), and any required v2 license lease is active. Legacy v1 runtimes do not require a v2 lease. |
| license | object | Current license lease health snapshot, described below. This field is absent from older engine responses. |
License status values: blocked/uninitialized -1, trial 0, active 1, development 2, expired 3.
Complete ready response:
{
"extID": "readiness-1",
"status": 200,
"data": {
"server_ready": 1,
"license_status": 1,
"runtime_license_status": 1,
"license_expire": 1791000000,
"trading_ready": true,
"license": {
"state": "online",
"lease_remaining_seconds": 3520,
"last_confirmed_at": 1793262000,
"consecutive_failures": 0,
"last_error": ""
}
}
}
Complete initialization-in-progress response:
{
"extID": "readiness-1",
"status": 200,
"data": {
"server_ready": 0,
"license_status": -1,
"runtime_license_status": -1,
"license_expire": 0,
"trading_ready": false,
"license": {
"state": "pending",
"lease_remaining_seconds": 0,
"last_confirmed_at": 0,
"consecutive_failures": 0,
"last_error": ""
}
}
}
If the common configuration cannot be obtained, status is 500 and data contains only error (string code CANT_GET_CONFIG):
{
"extID": "readiness-1",
"status": 500,
"data": { "error": "CANT_GET_CONFIG" }
}
The nested license object has these fields:
| Field | Type | Description |
|---|---|---|
state |
string | not_required, pending, online, degraded, expired, or denied. See the state meanings below. |
lease_remaining_seconds |
integer | Remaining authenticated lease time in whole seconds, 0..3600; 0 when no active lease is held. |
last_confirmed_at |
integer | Unix seconds when this process last received and applied an authenticated lease; 0 before the first grant. |
consecutive_failures |
integer | Consecutive license exchange failures since the last successful grant; reset to 0 on grant. |
last_error |
string | Empty when there is no reported error. Otherwise a fixed safe diagnostic code; unknown upstream text is not exposed. Possible codes: EXCHANGE_FAILED, NATS_PUBLISH_FAILED, NATS_TIMEOUT, NATS_SLOW_CONSUMER, NATS_CONNECTION_CLOSED, NATS_RECEIVE_FAILED, RESPONSE_UNVERIFIED, RESPONSE_UNRELATED, RESPONSE_INVALID, V2_STORAGE_FAILED, V2_GRANT_FAILED, V2_RESPONSE_TOO_LARGE, V2_METADATA_UNAVAILABLE, AUTHORITY_TEMPORARY, PROTOCOL_RECOVERY, METADATA_UNAVAILABLE, LICENSE_NOT_ACTIVE, LICENSE_IDENTITY_CHANGED, INSTANCE_NOT_BOUND, BINDING_REQUIRED, LICENSE_IN_USE, SESSION_NOT_OWNER, V2_LICENSE_REQUIRED, V2_UPGRADE_REQUIRED, LEASE_EXPIRED, INVALID_SEQUENCE, REQUEST_ID_REUSED, CHALLENGE_EXPIRED, CHALLENGE_USED, or AUTHORITY_DENIED. Unrecognized internal codes are reduced to EXCHANGE_FAILED. |
State meanings:
not_required: this process does not require a v2 runtime lease.pending: a v2 lease is required, but this process has not yet applied its first authenticated grant.online: the lease is active and recent renewal exchanges have succeeded.degraded: the last lease is still active, but at least three exchanges have failed or no successful renewal has arrived for 90 seconds.expired: the last authenticated lease has reached its local deadline. A fresh process cannot reuse a lease from disk.denied: the authority returned a verified license, binding, or ownership denial that invalidates the grant immediately.
Transport and temporary exchange failures preserve only the original monotonic lease deadline; they never extend it. A grant lasts at most one hour and is capped by license expiry. Restarting the process requires a fresh online grant. Machine ownership remains serialized by the license authority; a different machine can remain blocked until the existing lease expires or an administrator approves a transfer.
Standard transport authentication/access errors may occur before this handler runs.
Integration notes¶
The command reads in-memory configuration, does not expose license keys or authentication credentials, and does not modify license policy. Common and runtime values are separate reads, not a transactional snapshot. The result can change immediately after the response.
This is license admission readiness only: for v2 it includes the active runtime lease, in addition to initialization and status. It does not guarantee quote freshness, account or symbol access, execution routing, absence of a restore barrier, or successful trade execution. The expiration timestamp is diagnostic; trading_ready follows the status-based license gates and the runtime lease state. The HTTP GET /health and GET /ping endpoints expose the same nested license snapshot while retaining their HTTP 200 liveness response; see Installation: health and license monitoring.
The test stand waits before fixture provisioning and after scenario restarts, polling once per second with a separate server.startTimeoutMs deadline. Timeout or an invalid response fails preflight with scoped evidence. Trading commands rejected by licensing are not automatically retried.