Instructions
Documentation for instructions for interacting with the Phoenix program.
Instructions to interact with the Phoenix program are available in the phoenix-v1 crate. The Phoenix IDL is available on GitHub.
Swap
The Swap
instruction is used for crossing the book. Aggregators and other programs wishing to access Phoenix liquidity will primarily use this instruction. A Swap
instruction can be created using phoenix-types::instructions::create_new_order_instruction
, passing in an OrderPacket::ImmediateOrCancel
order specification.
SwapWithFreeFunds
The SwapWithFreeFunds
is the same as the Swap
instruction except that it requires the caller to have an Approved seat on the market. It will attempt to cross the book only using funds that the trader has deposited into the market vaults. If insufficient funds are deposited, this instruction will fail. This instruction requires fewer account inputs and consumes less compute than `Swap`, which potentially makes it easier to compose with.
RequestSeat
The RequestSeat
instruction is used to request a Seat on a given Phoenix Market. A Seat is required to place limit orders.
PlaceLimitOrder
The PlaceLimitOrder
instruction is used for placing liquidity on the book. Only traders with a Seat may call this instruction. A PlaceLimitOrder
instruction can be created using phoenix-types::instructions::create_new_order_instruction
, passing in an OrderPacket::Limit
(standard limit order) or an OrderPacket::PostOnly
(post-only order) order specification.
PlaceLimitOrderWithFreeFunds
The PlaceLimitOrderWithFreeFunds
is the same as the PlaceLimitOrder
instruction except that it will attempt to place an order only using funds that the trader has deposited into the market vaults. If insufficient funds are deposited, this instruction will fail. This instruction requires fewer account inputs and consumes less compute than PlaceLimitOrder
, which potentially makes it easier to compose with.
ReduceOrder
The ReduceOrder
instruction is used to reduce the size of an order resting on the book, while maintaining queue position.
ReduceWithFreeFunds
The ReduceOrderWithFreeFunds
is the same as the ReduceOrder
instruction except that it will not withdraw the freed funds. This instruction requires fewer account inputs and consumes less compute than ReduceOrder
, which potentially makes it easier to compose with.
CancelAllOrders
The CancelAllOrders
instruction can be called by a market maker to cancel all of their resting orders on a particular market.
CancelAllOrdersWithFreeFunds
The CancelAllOrdersWithFreeFunds
is the same as the CancelAllOrders
instruction except that it will not withdraw the freed funds. This instruction requires fewer account inputs and consumes less compute than CancelAllOrders
, which potentially makes it easier to compose with.
CancelMultipleOrdersById
The CancelMultipleOrdersById
instruction can be called by a market maker to cancel specific orders on a particular market, selected by order ID.
CancelMultipleOrdersByIdWithFreeFunds
The CancelMultipleOrdersByIdWithFreeFunds
is the same as the CancelMultipleOrdersById
instruction except that it will not withdraw the freed funds. This instruction requires fewer account inputs and consumes less compute than CancelMultipleOrdersById
, which potentially makes it easier to compose with.
CancelUpTo
The CancelUpTo
instruction can be called by a market maker to cancel all orders on one side of the book that are more aggressive than the specified price.
CancelUpToWithFreeFunds
The CancelUpToWithFreeFunds
is the same as the CancelUpTo
instruction except that it will not withdraw the freed funds. This instruction requires fewer account inputs and consumes less compute than CancelUpTo
, which potentially makes it easier to compose with.
WithdrawFunds
The WithdrawFunds
instruction can be called by a market maker to withdraw a specified number of quote lots and base lots from a market.
DepositFunds
The DepositFunds
instruction can be called by a market maker to deposit a specified number of quote lots and base lots to a market. This can be used in conjunction with market actions utilizing free funds (e.g. PlaceLimitOrderWithFreeFunds
) so that token transfers are not required for every market action, reducing the compute required for those market actions.
Last updated