The BNDES is one of the world’s largest development banks and, today, the main instrument of the Brazilian government for long-term financing and investment in all segments of the economy. BNDES handles almost R$1 trillion in total assets, with thousands of counterparties and millions of financial contracts in its portfolio.
The Assets and Liabilities team was trying to solve a multistage stochastic optimization problem to maximize the bank’s returns by choosing the best allocation, funding and hedge decisions, subject to a wide range of business, political and market restrictions.
Why did they choose Julia?
The BNDES project team, leaded by Diogo Barboza Gobira and Felipe Vilhena Antunes Amaral selected Julia for its “speed, elegance, and JuMP (the Mathematical Optimization Package in Julia).”
According to the project team:
“The kind of project we’re dealing with would typically require a business side user to build prototypes in R, and an IT programmer to speed up the code using C++ or Java. Given the current restrictions of our organization, it’s just not possible to set up a project like that. With Julia, the business side user can build prototypes without having to worry about speeding up code later with C++. It’s very cost effective since there is no need to write glue code to translate R datatypes. Also, the language syntax is even simpler than R. We can write for loops. Goodbye cryptic vectorized code!”
Implementation in Julia produced dividends quickly, yielding “considerable performance improvements” immediately. The core computations involved simulating stochastic models for stocks, interest rate curves and inflation indices. The model was used to perform intensive financial calculations including accrual, coupons, dividends and rating transactions.
BNDES reports an increase in speed of more than 10x. Exploring Julia’s native parallelism could yield even greater improvements in speed, scalability and productivity.