VICBee brings its experience in developing models and algorithms to optimize portfolios for one of the worlds' largest sovereign wealth funds into the design of its Optimize API and Models API. The result is an interface that can be used to model and optimize portfolios from a few dozen assets to several thousand assets. Please visit our other case studies to learn more about the importance of carefully crafting models and the role of constraints in portfolio optimization. In the rest of this note we shall provide some details behind the technical design of our APIs.
Our APIs are designed around the concept of microservices which can be easily deployed in a cloud environment. The splitting of responsibilities between modelling, in the Models API, and optimization, in the Optimize API, is the facet of this design that is most evident to our users. What that means is that we can easily deploy and scale our services to meet client's needs. For some costumers, it may be enough to subscribe for access to our public facing services. Others however, may demand a complete deployment in their secure private cloud environment.
Our APIs adhere to the concept of REST. Besides all the clarity and flexibility that it brings to users, there are other reasons that we believe make REST perfect for finance applications. One is that every call to one of our REST API methods contains only the information it needs to solve the problem at hand. Consequently, there is no need to store or manipulate sensitive costumer information. In fact, our APIs do not store or identify any information it processes.
To see how this works in practice, consider the typical flow of information depicted in the following diagram:
When building a model, the Models API does not need to know, for example, how much one owns of a particular asset, or the total value of the portfolio.
Likewise, what is passed to Optimize API for optimization is a set of mathematical models and constraints, which contains as little information as needed to optimize the user portfolio. For example, no tickers are necessary. Of course, at this point, the optimizer would need to know about the initial portfolio, as part of the constraints, but even this information can be stated in relative rather than absolute terms, if privacy is a concern, such that all sensitive information remains in the user application layer.
Another advantage of REST is the ease with which one can incorporate the functionality into their applications. The APIs use standard HTTP methods and protocols which are universally supported. Access is controlled via access tokens and a support library is available to facilitate access in Python.
When it comes to large scale portfolio optimization, it is not possible to strictly adhere to the fast response times of the REST paradigm because of the large time required to process data and perform optimization. Developing historical models and optimizing portfolios with thousands of assets takes more than the typical few seconds we have become used to when interacting with web applications.
With those cases in mind, the Models API and Optimize API defer calculations of large portfolio models according to the Asynchronous Request-Reply pattern . A typical example, in this case for the Models API, is illustrated in the following diagram:
In a nutshell, for large portfolios, instead of the user application waiting a long time to obtain a return and covariance model from the /model API entrypoint, it obtains instead an id for the associated resource, while it is still being calculated. The user application then uses the /resouce/{id}/status entrypoint to obtain status updates and, when the resource finally becomes available, the /resouce/{id}/value entrypoint for retriving the calculation result, in this case the return and covariance model.
All happens asynchronously within the confines of the same REST API interface, giving the user application the ability to do other things while waiting for the long calculation result to materialize. If using our Python support library, all such operations, the ones inside the dashed rectangle above, can be made completely transparent to the user while taking advantage of Python's asyncio facilities.
Finally, when it comes to user applications, we can either support the development of user applications that incorporate out APIs, or develop and deploy complete applications to meet our costumers' needs. We have demo applications that showcase the main features of our interfaces that can be made available for trial upon request.
Copyright © 2009, 2024 VICBee Consulting