Title: Stock Trading Language [S.T.L.]
1Stock Trading Language S.T.L.
- Rui Hu
- Thomas Lippincott
- Rekha Duthulur
- Matt (Yu-Ming) Chang
- Nikhil Jhawar
2Birth of S.T.L.
- Wanted to develop a language for non-techies who
do not know how to program. - English language considered to be the easiest way
to introduce programming to one and all, but - English with its vast grammar and millions of
different permutations and combination of words
in its domain would require a great deal of time
and effort for any language to parse and make
sense of it. - Hence, we decided to restrict our easy-to-program
language to a particular domain to be able to
capture the essence of our idea and still
generate a language capable of dealing with
non-programmers. - The domain was chosen to be as the one belonging
to the financial industry, more specifically
Stock Trading - Intended users day to day retail traders
looking to bring some automation into their
dealing with the stock market.
3Language Definition
- STL is an interpreted computer language designed
to facilitate the rapid prototyping of stock
trading strategies. The language is mainly aimed
at individuals in the financial industry, with
little or no formal background in computer
science.
4Language Highlights
- Goal The goal of the Stock Trading Language is
to enable a stock trader to write code to trade
in the stock market to automate his
buying/selling requirements. - Ease of use The language is user friendly in the
sense that traders can write simple buy/sell
codes using simple words which they use in their
financial dialect. - Portability The language is also very portable
as the user written code is converted into java
code thus enabling it to be compatible with any
machine running the Java Virtual Machine. - Automation The language brings about automation
for a trader who would have to otherwise sit in
front of the computer for the whole time of the
trading session.
5Implementation Responsibilities
- Tom Lead Tester, GUI, JFL Interfacing
- Nikhil Project Management, Testing,
Documentation - Rekha Interpreter, walker, AST
- Rui Lexer, Parser
- Matt Interpreter, walker, AST
6Implementation - Architecture
7Implementation - Schedule
Date Completed Task
31 January,2007 First Team Project Meeting
02 February,2007 Stock Trading Language Evolves
07 February,2007 White Paper completed
11 February,2007 Code conventions formed
14 February,2007 Lexer started
18 February,2007 Parser started
21 February,2007 Walker started
01 March,2007 Interpreter over Compiler chosen
05 March,2007 Language Reference Manual completed
20 March,2007 Graphical User Interface started, Lexer/Parser Completed.
25 March,2007 Testing of Java and STL code started
April 5,2007 Bugzilla (for error reporting) implemented
April 19,2007 Simple demo with TA
April 26,2007 Walker finalized
April 29,2007 Graphical User Interface completed
May 5,2007 Testing of STL functionality completed
May 6,2007 Final project completed
May 7,2007 Project presented
Chose interpreter over compiler
Implemented grammar early
8Examples Conditional buy
- imoney(10000) //Set the amount of money you
have - jvalue("MSFT") //Assign currently traded
value of Microsoft to a variable - max400 //Set acceptable price limit on a
stock - if(jltmax)
- buy(50,"MSFT") //If the price is favorable
buy 50 stocks of Microsoft else error out - kstocks("MSFT") //assign the number of
stocks of Microsoft currently owned to a variable
- print("You currently own ")
- print(k)
- print(" stocks of Microsoft")
- print("\n")
-
- else
- print("Stock too costly...")
-
- lstocks("MSFT")
- sell(20,"MSFT") //sell 20 shares of Microsoft
from your current portfolio - jstocks("MSFT") //reassign the no. of stocks
of Microsoft currently owned to a variable - print("After selling You currently own ")
- print(j)
9Examples - Delta
- / Program which allows traders to buy stocks
based on their volatility / - imoney(1000)//Set money for transactions
- //Choose your portfolio
- _at_portfolio"IBM","GOOG","YHOO","CECO","MSFT"
- print("Delta Values\n")
- print("-------------------------\n")
- //Prints out the delta values of each stock in
your portfolio - foreach iterate(_at_portfolio)
- print(iterate)
- print(" ")
- print(delta(iterate))
- print("\n")
-
/Go through the list and buy only stocks which
have variance that is acceptable/ foreach
read(_at_portfolio) if(delta(read)lt0.5) buy(10
,read) print(read) print("
bought\n") else //Else do not
buy print(read) print(" too volatile to
buy\n")
10Example - Recursion
- function gcd(x,y)
-
- if(ylt0)
- return(x)
-
- else
- while(x gt y)
-
- x x - y
-
-
-
- return(gcd(y,x))
-
-
11The GUI
Open code from a file
Clear input screen
Money you have
Run all tests
Portfolio Manager
12Lessons learnt - general
- Starting early does not hurt
- Set realistic goals in terms of envisioning the
project and allocating time for the various
components that go into building a project - Team mates should get to know each other well for
optimal results - Good communications an absolute MUST
- Work together at least once every week if not
more
13Lessons learnt - technical
- Divide project components properly based on
strength and weaknesses of team members - A fixed LRM and Grammar go and long way in
stabilizing the project development cycle - Realize, what will be more appropriate for the
project an interpreter or a compiler - Perform tests on every module as it is developed
- Scoping is difficult to implement, so allocate
enough time to get it working
14DEMO TIME!