Skip to main content

Position close transaction

The new POSITION_CLOSE transaction type closes a position on a given date without requiring the quantity sold, which avoids leftover residues when the transaction data lacks all the decimal places.

When creating a transaction with Create Transaction and type equal to POSITION_CLOSE, provide the date (transactDate), the broker (brokerId) and the security (security). Gorila calculates the custody on that date and generates a sale of the exact quantity, so that the position ends the day zeroed. If a transaction dated before the close is added later, the sale quantity is recalculated.

The type is available for funds and banking bonds (CDB, LCI, LCA, LF, etc.). The price field is optional: if it is not provided, the day's closing price is used. Fees can be provided in fees.

// REQUEST
// POST https://core.gorila.com.br/portfolios/{portfolioId}/transactions

{
"type": "POSITION_CLOSE",
"transactDate": "2023-06-30",
"brokerId": "18945670000146",
"security": {
"id": 2407939
}
}

Learn more in Transaction and in the Position Close example.