Algorithmic Trading Sample App using Oracle Complex Event Processing

This week, I've cooked up something interesting, It's not just an article, but a sample application. 

Objective : Build an application that can read streaming stock market quotes, apply technical analysis algorithms & automatically initiate trades.

Ingredients : 
  • Streaming Stock Market Quotes
  • Technical Analysis Algorithms
  • Transaction platform to record trades
  • A platform to design, build, deploy & run my low latency high throughput Algorithmic trading application
Algorithmic trading, also known as automated trading is the use of an electronic platform for entering trading orders with an algorithm deciding on aspects of the order such as the timing, price, or quantity of the order and initiating the order without human intervention. While Algorithmic trading is also usually High frequency, for this sample App we would have go with a frequency that is available with our publicly available "Quote Engine"

Coming back to the topic ingredients, Here is what I have used.

Streaming Stock Market Quotes : For the streaming stock market quotes, I am using the Yahoo Finance Quote Engine. Yahoo provides an interesting way of querying it's services, it is called YQL (Yahoo Query Language). With YQL, I could fire a query that looks like

select * from yahoo.finance.quotes where symbol in ("WIPRO.NS", "INFY.NS", "TCS.NS" )

convert it into request into a REST query and fetch real-time quotes of the stock listed above.

Technical Analysis Algorithms: This I thought would tricky, but any day-trading book can teach you the details of the technical analysis techniques, here are some of the concepts & algorithms that could be used

Concepts: Uptrend Identification,Downtrend Identification,support,resistance,Double bottom identification,identification of breakthrough, price, volume
Algorithms: Double Confirmed Minimum Profit, Profit locking risk management,Support & Resistance,Profit Targets,Reversal Formations at bottoms,pivot point,fibonacci,Stochastic,MACD (Moving Average convergence divergence)

I have used a simple algorithm to initiate trades(buy, sell, no trade only) in my sample application. Since I am sharing my sample App, you are free to make the algorithms as sophisticated as you'd like to. 


Transaction platform to record trades : I've used Google Finance java API's to record my trades. Google Finance transaction engine allows me to constantly record trades & monitor performance on my trades. The Google Finance APIs have been used in the PaperTrader bean.

Platform to run my Algorithmic Paper Trader: The AlgorithmicPaperTrader App. runs on the Oracle Complex Event Processing Platform. I've modeled my EPN (Event Processing Network) and implemented the entire solution using Eclipse  & Oracle Complex Event Processing feature-set plug-in for Eclipse 3.5 + .


Notes:

  • Please set or unset System proxies as needed in the source code
  • You will need the following libraries to be added to you Weblogic Event Server & Eclipse project classpath : gdata-base-1.0, gdata-client-1.0,gdata-core-1.0,gdata-finance-2.0, gdata-finance-meta-2.0,guava-r09
  • Please create your own Yahoo API key. I have deleted the key I have used for myself 
  • The Username/password of the Google account used for paper trading is left blank. Please use your own credentials. The application uses the default portfolio "My Portfolio" to record transactions

 You could download the Sample Application here

Comments:

Hi Manish,

I am a student at the HTWG Konstanz (Constance, Germany) and I am currently working at my master thesis which has to do with CEP. For this purpose I wanted to implement a simple stock trading application, which is why I stumbled upon your blog here. Do you have any information for me regarding how you designet your events or the algorithms to detected stock chart patterns, trends and so on? Any advice or references would be very helpful!

Thank you in advance.

Regards,
Max

Posted by Max on June 03, 2013 at 02:58 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Oracle Fusion Middleware based Solutions for business use cases.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today