Stories/JoseQuintana
Jose Mario Quintana
President
Bayesian Efficient Strategic Trading, LLC
Florida, USA
Developing Quantitative Trading Strategies in J
Although it is unfeasible to capture the full market complexity in a purely mechanical quantitative system, it is also impossible to embed the quantitative complexity that steers the financial markets in the minds of portfolio managers. Consequently, we advocate the use of sophisticated quantitative trading systems supervised by, and assisting, expert portfolio managers to manage investment portfolios. For us, an ideal environment to develop these kinds of systems should offer the following attributes: a fast and versatile method for implementing efficiently the mathematics of Modern Portfolio Theory and Bayesian multivariate stochastic forecasting systems; the ability to process vast amounts of information; the connectivity to other applications; and a reliable development of large complex systems. We find that J excels in fulfilling these requirements due to: its deep mathematical roots; a convenient access to databases and mapped files; interfacing via DLL, ODBC, LAPACK, sockets, etc.; and its object oriented, structured and tacit (functional) programming support.
The latter programming technique is an elegant way to code algorithms without any direct reference to their arguments (and in the process avoiding many potential naming conflicts) and we use it extensively. For instance, the calculation of the expected return and variance of a portfolio can be implemented by the following four lines of actual code:
x=: @:[ NB. Left argument selection (adv.) m=: +/ .* NB. Matrix Multiplication (verb) (e.g., A m B) PortfolioMean=: (|:x)m ] NB. Portfolio mean calculation (verb) NB. for weights W and expected returns E (e.g., W PortfolioMean E) PortfolioVariance=: (|:x)m ] m [ NB. Portfolio variance calculation (verb) NB. for weights W and return variance-covariance G (e.g., W PortfolioVariance G)
Furthermore, the same code without any modification can calculate the expected returns and the variance-covariance of a set of portfolios simply by entering the portfolio weights as the columns of a matrix.
Perhaps the best way to express our opinion of our preferred developing environment is to point out that a quantitative trading system implemented in J is the core of a trading strategy which has been employed in several financial institutions to manage a variety of investment programs and it is used currently for proprietory trading.