PSL: An Interpretative Programming Language for Financial Portfolio Simulation and Manipulation Alexander Besidski Xin Li Jian Huang Wei-Chen Lee PSL: Motivation Bridge the Gap between Expanding Financial Market (Despite the crash of .COM’s in NASDAQ index in 2001 … ) Exploding amount of daily generated financial data from trading front desks and the imperative call for automatic trading systems Modularization and regulation of the financial securities: stock, bond, mortgages, mutual fund, hedge fund… And Complexity in existing business software solutions and limited flexibility they provide to external users Growing size of inexperienced investors and business software users who yet need to manipulate and analyze financial securities Growing size of newly trained financial engineers and MBA’s who knows nothing or even feel horrified about programming in C++ and Java yet need to perform “quant” jobs in investment banking PSL: Overview A Finance Oriented Programming Language Common features as most other popular programming languages (types, functions, calculation, control flows, I/O, … ) Built-in Support for Manipulation of Financial Securities (stock & bond) and Portfolios Simulation and Analytical Tools for Financial Instruments Visualization and Computation based on Financial Data PSL: Language Features Java-like syntax Less complicated grammar rules Strongly typed OOP Interface Script-like programming style Intrinsically Expandable PSL: Tutorial To declare a stock stock google = new (Price=150.0); To specify its attributions google.Name=”GOOGLE” google.Return = 5; google.Volatility = 30; Print our its price google.Price.print(); PSL: Tutorial To declare a Bond, it’s easy. bond Treasury10Y = new( Coupon=3.0, Maturity=10, InterestRate=5.0 ); Treasury10Y.Name = “Treasury10Y”; PSL: Tutorial To Declare a portfolio portfolio pf = new(Capital=3000.0); Set the assets pf.addStock(google, 20); pf.addBond(Treasury10Y, 5); pf.addStock(IBM, 8); pf.addStock(google, 16); pf.addCapital(1000.0); PSL: Tutorial Show the final total asset value pf.printContent(); Then Simulate the portfolio’s performance and show them in a chart ("Simulate the portfolio:").print(); pf.simulate(50); PSL: Tutorial PSL: Geometric Brownian Motion Geometric Brownian Motion is a model to simulate the behavior of prices of stocks or other commodities. The transition from the price at one time to the next is price(t )=price(t -1) e ( + 0.5 Z) PSL: Requirements Create an Interpreter Develop in Java Use ANTLR Team work PSL: Development Environment Eclipse chosen as main Dev platform Built in CVS capabilities Easy integration with ANTLR Automatic builds Rapid development and debugging PSL: Language Components Frontend - Lexical scanner, Parser, Tree Walker Interpreter Symbol table Wrapper class for primitive & complex types Backend – Graphics,Simulation, I/O,Statistics Testing Documentation PSL: Roles Xin – Dev Jian – Dev Peter – QA, Doc Alex – Captain, Dev PSL: Assignments Primary Secondary Xin Financial Requirements Frontend-Backend integration Walker Jian Backend Peter QA Doc Alex Lexer Parser Walker PSL: Language Structure Dissection By Value & by Reference semantics Control Flow Java-style Scoping Rules Functions Arrays Properties and methods for complex types PSL: Lessons Learned Financial jargon info. Tools: ANTLR, ECLIPSE+CVS Language without ambiguous Regression test module PSL: Conclusion White paper- production advocating LRM- blueprint PSL- excellent construction for extended development