Volatility and Sharpe Ratio
Volatility and the Sharpe Ratio are risk metrics that complement the return analysis of a portfolio or of a security. Two portfolios or securities can have similar returns and very different risk levels. These metrics show not only how much a portfolio or security yielded, but also how efficient it was at generating that return.
Volatility
Volatility measures the dispersion of a portfolio's or security's returns over time. The higher the volatility, the greater the variability of returns and, therefore, the uncertainty associated with the investment.
Sharpe Ratio
The Sharpe ratio evaluates the return obtained relative to the risk taken. It compares the portfolio's or security's excess return over the risk-free rate with its volatility. At Gorila, the CDI is used as the risk-free rate, as it is the most widely adopted benchmark in the Brazilian market.
How GorilaCORE calculates them
Both indicators start from the daily returns of the portfolio or security, measured by the return, or Time-Weighted Return (TWR), and follow the same conventions:
- Annualized basis: all values are returned annualized, regardless of the chosen window or frequency. This allows a direct comparison across different windows, frequencies and portfolios.
- Brazilian calendar: the count considers 252 business days per year, with national and banking holidays.
- Minimum history: a value is only calculated when the portfolio or security has enough history to fill the requested window. For example, with a 12-month window and a portfolio started on 2020-01-06, the first available point is 2021-01-06.
Calculation window and frequency
The calculateWindow parameter defines the calculation window — the period of returns considered at each point. The options are 3M, 6M, 12M (default), 24M and PER_FREQUENCY. With fixed windows, each point uses the last N months of returns, in a moving window (rolling window). With PER_FREQUENCY, each point uses only the returns of its own period.
The frequency parameter defines the granularity of the points: DAILY, MONTHLY, YEARLY or INTERVAL. Some useful combinations:
calculateWindow=12M+frequency=DAILY: daily series of the 12-month rolling volatility, to track the evolution of risk day by day.calculateWindow=PER_FREQUENCY+frequency=YEARLY: one point per year, calculated only with that year's returns, to compare years with each other.frequency=INTERVAL: a single value. With a fixed window, it covers the N months prior toendDate(startDateis ignored in this case). WithPER_FREQUENCY, it covers exactly the interval betweenstartDateandendDate.
For the volatility and the Sharpe ratio to describe the same period as a TWR query, use frequency=INTERVAL, calculateWindow=PER_FREQUENCY and the same dates as the TWR query.
Where to access
In GorilaCORE, you can query the volatility and the Sharpe ratio of a specific portfolio. You can also calculate the same indicators for an economic group, consolidating its portfolios, through the Read Economic Group Volatility and Read Economic Group Sharpe Ratio endpoints. The portfolio and economic group endpoints allow filtering by broker, security, asset class, security type and classification.
To query the indicators of a security outside the context of a portfolio, use the endpoints below (see also Security Metrics):
- Security volatility: Read Security Volatility
- Security Sharpe ratio: Read Security Sharpe Ratio