Skip to main content
POST
TypeScript

Authorizations

Authorization
string
header
required

The Trading API key (trdrs_sk_…), for market data, orders and account state on the accounts its owner holds. Use it server-to-server, and keep it on your server. Its scope is named trading in the API.

Query Parameters

provider
string

The provider the account is at, such as rithmic or paper. Omit it to use your default provider. An unknown value is refused with 400, never replaced with another provider.

account
string

The account number at that provider. It must be one of your own accounts, or the call is refused with 400.

Body

application/json

A bracket to put on an open position, or on a resting entry: its take profits and stop losses.

instrument
string
required

The instrument.

clientOrderId
string
required

Your own id for this protection, and its idempotency key. On the paper book a resting entry rests under this id once the bracket is on it.

exits
object
required

The take profits and stop losses. Distances are measured from the position's average entry, or from a resting entry's own price.

Example:
qty
number

How much of the position to protect. Omit it to protect all of it that no other bracket protects. A resting entry is protected whole, so a protection that names one carries no qty.

positionId
string

The one position to protect, by the id the account snapshot gives it: a ticket on an account that holds separate tickets, or the net position. Only where the account names its positions; anywhere else the request is refused, rather than applied to the instrument.

entryOrderId
string

A resting entry to protect before it fills, by its providerOrderId, in place of a position: a working order of yours on the instrument that can open a position and has filled nothing. The bracket covers all of the entry and waits on it, and each pair rests once the fill that opens its part of the position arrives. Send it without positionId and qty.

Example:

"234992311"

Response

The bracket rests, or on a resting entry waits on it (pending_entry), with entryOrderId naming the order the entry rests as. refused is the provider's reason where it refused a pair, whose part of the position the bracket then shows as unprotected.

A bracket after a protection, a change or a withdrawal.

bracket
object
required

The bracket.

Example:
refused
string | null
required

The provider's reason where it refused a pair, or null. A change of a bracket the provider refuses leaves the bracket as it was. On a protection, the refused pair's part of the position shows as unprotected and the other pairs rest.

stuck
integer
required

How many orders the change meant to cancel that would not cancel and still rest. The bracket keeps them, so the account stream shows them.

entryOrderId
string

On a protection of a resting entry, and on a change or a withdrawal of a bracket waiting on one: the order the entry rests as afterwards. The paper book replaces the entry with itself to change the pairs it carries, so there the entry rests under a new id. Every other provider keeps the entry's id. Absent on every other answer.

Example:

"protect-entry-esu6-1787581560"