PositionRequest account is a struct which represents a set of parameters and states associated to a request to open or close a position, the PositionRequest account consists of mostly similar properties as Position account.
PositionRequest ACCOUNT DERIVATIONIt is a Program-Derived Address (PDA) derived from the underlying Position account’s address, several constant seeds, and a random integer seed which makes each PositionRequest account unique.The is an example PositionRequest account.PositionRequestATA ACCOUNTA PositionRequestATA account is created for each PositionRequest account.The PositionRequestATA account is an associated token account derived from the PositionRequest that contains the tokens from the trader’s deposits or withdrawals from withdrawing collateral or closing positions.The tokens are then transferred to the position token’s custody token account or returned to the trader’s wallet when the PositionRequestATA account is closed.TAKE PROFIT / STOP LOSS REQUESTS
PositionRequest accounts for non TP / SL requests are closed as soon as the request is executed or rejected.TP / SL requests are also stored onchain via PositionRequest accounts. However, they will only be closed when the TP / SL request is triggered and executed.Active TP / SL requests can be fetched onchain (through blockchain explorers like Solscan or SolanaFM) by searching for the PositionRequest address or public key associated with the TP / SL request.Account Details
EachPositionRequest account contains the following data:
