Skip to main content
POST
Create an arbitrage auto-close order

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
conditions
(ArbitrageAutoCloseTimeCondition · object | ArbitrageAutoClosePriceSpreadCondition · object | ArbitrageAutoCloseFundingSpreadCondition · object | ArbitrageAutoCloseFundingFlipCondition · object)[]
required

Conditions that close the position, any one of which is enough; the first one met closes both legs and the rest stop counting.

Minimum array length: 1

A condition that closes the position when it is met: time (at a fixed time), priceSpread (price spread against a threshold), fundingSpread (hourly funding spread against a threshold) or fundingFlip (funding spread turns negative).

long
CreateArbitrageAutoCloseOrderLeg · object
required

The market where you hold the long position, or where an arbitrage order you have already placed will open it. Every order resting on it is canceled before the position closes.

short
CreateArbitrageAutoCloseOrderLeg · object
required

The market where you hold the short position, or where an arbitrage order you have already placed will open it. Every order resting on it is canceled before the position closes.

Response

conditions
(ArbitrageAutoCloseTimeConditionResponse · object | ArbitrageAutoClosePriceSpreadConditionResponse · object | ArbitrageAutoCloseFundingSpreadConditionResponse · object | ArbitrageAutoCloseFundingFlipConditionResponse · object)[]
required

Conditions being watched, any one of which closes the position; the first one met closes both legs.

A condition that closes the position when it is met, with its current progress.

createdAt
string<date-time>
required

When the auto-close order was accepted.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
error
string | null
required

Why the order failed, null otherwise.

executionStartedAt
string<date-time> | null
required

When closing started, null while the order is still waiting.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
firedConditionType
enum<string> | null
required

Type of the condition that closed the position: time, priceSpread, fundingSpread or fundingFlip; null until one is met.

Available options:
fundingFlip,
fundingSpread,
priceSpread,
time
id
string<uuid>
required

Arbitrage auto-close order identifier.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Example:

"019d5cbe-6980-7193-a80e-38a45eda36d8"

legs
ArbitrageAutoCloseOrderLegs · object
required
status
enum<string>
required

created — watching the conditions, none has been met yet. executionStarted — a condition was met and both legs are being closed. executed — both markets were cleared, closing whatever position was open on each. canceled — canceled before any condition was met. failed — closing a leg was rejected, the worker was interrupted mid-close, or the close time passed while the service was down; the position may still be open.

Available options:
canceled,
created,
executed,
executionStarted,
failed
Example:

"created"

unifiedSymbol
string
required

Cross-exchange asset key — an alias (alias:1000bonk) when defined, otherwise the base symbol.

Example:

"ETH"

updatedAt
string<date-time>
required

When the order last changed.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$