Order Side & Time in Force
Order side
The side field is a boolean.
false
Buy/Up
true
Sell/Down
Buy order:
await exchange.placeOrder({
assetId,
epoch,
side: false,
price: "99.9",
size: "10.25",
});Sell order:
await exchange.placeOrder({
assetId,
epoch,
side: true,
price: "99.9",
size: "10.25",
});Time in force
Time in force controls how an order behaves when it reaches the order book.
0
TimeInForce.GTC
Good until cancelled
Any unfilled quantity remains open
1
TimeInForce.FOK
Fill or kill
The entire order must fill immediately or be cancelled
2
TimeInForce.IOC
Immediate or cancel
Available quantity fills immediately; the remainder is cancelled
3
TimeInForce.ALO
Add liquidity only
The order may only add liquidity
Import the constants from the SDK:
Good until cancelled
GTC is the default.
Since GTC is the default, it can be omitted:
Fill or kill
A FOK order must fill completely. If the full requested size is unavailable, the order is cancelled.
Immediate or cancel
An IOC order fills as much as possible immediately and cancels any remaining quantity.
Add liquidity only
An ALO order may only add liquidity to the order book.
If the order would immediately match existing liquidity, it is rejected or cancelled with an ALO reason.
Cancel and replace
For a cancel-and-replace request:
The replacement order must use the same market as the cancelled order.
The replacement side must match the side of the cancelled order.
The order hash being cancelled cannot be the zero hash.
Cancel-all behavior is not supported by cancel-and-replace.
Last updated