Price Conversion
The Price Conversion endpoint receives the known information about a trade of a security (such as the date and the financial amount) and returns the corresponding price and quantity on that date. After the conversion, the returned information can be used to build the request to create a transaction.
This is useful because the information available about a trade is not always in the format required by the API. For funds and banking bonds, for example, it is common to know only the amount invested, and not the price of the fund share or of the bond.
How to convert
The request identifies the security (security, by id, isin or cnpj) and the trade date (date), in addition to one of the following pieces of information:
- Financial amount (
notional): for funds and banking bonds (CDB, LC, LCA, LCI, LIG, among others), just provide the total amount traded. - Security rate (
multiplierorspread): for private credit securities (CRI, CRA and Debentures), provide the trade's rate. Usemultiplierfor securities that yield a percentage of the index (e.g., 110% of CDI →1.1) andspreadfor securities that yield index + rate (e.g., IPCA + 5% →0.05).
The request also accepts the traded quantity (quantity), when it is known. In all cases, the goal is the same: finding the price and quantity from other known trade data.
Example
To convert BRL 10,000.00 invested in a fund into price and quantity:
//REQUEST
//POST https://core.gorila.com.br/securities/price-conversions
{
"security": {
"cnpj": "26673556000132"
},
"date": "2023-06-23",
"notional": 10000
}
The response returns the price and quantity, ready to be used in the create transaction endpoint:
//RESPONSE
{
"security": {
"id": 2363053,
"cnpj": "26673556000132",
"name": "ALASKA INSTITUCIONAL FIA",
"type": "FUNDQUOTE",
"assetClass": "STOCKS"
},
"date": "2023-06-23",
"price": 3.2519722,
"quantity": 3075.0570377
}
Where to access
To convert a trade's data into price and quantity, see the Price Conversion endpoint.