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. Omit it to use your default provider.

account
string

The account number at that provider. It must be one of your own accounts.

Body

application/json

The position to close.

instrument
string
required

The instrument.

Response

The position is flattened, or, where the paper book closed it as several market orders and refused one after the first, closed as far as stopped says.

The confirmation a flatten returns, and each position it stopped short of.

ok
boolean
required

True when the flatten ran.

stopped
object[]

Each position the paper book closed as several market orders, because it was larger than the largest market order the instrument takes, and stopped after one of them was refused. Every other position was closed in full. Absent when there is none.