Time Weighteed Average Pricing: TWAP is (time weighted average price) the average price of contracts or shares over a specified time. Which makes buy price to be fair price instead of executign order at time of day when price is high.
When it is used? It is used at point of tiime when investor want to distribute its order through out the day.
Comapison with VWAP: In VWAP order is distributed according to volume traded in exchange while in this case time is the main factor. For example in VWAP 45% of the order takes place in first half of the day while rest of the order takes place in the second half of the day.To execute the order evceenly through out the day this algorithm is used.
Algo:
1) Get the order and decide upon the time execution.
2) Submit the order and include delay() function to delay certain order using for loops.
Risk management, portfolio optimization & financial analysis using quantitative techniques and tools in Indian market conditions
Showing posts with label stock market. Show all posts
Showing posts with label stock market. Show all posts
Sunday, January 17, 2010
Why C++ ?
Algorithmic trading whenever we talk about is implemented in c++ irrespective of the fact system or strategy.
One of the reason for c++ being used is low latency. Latency is the delay in the order submitted and order executed .In algrtihmic trading latecny is importnt because as soon as target price arrive, order has to be executed otherwise there is no advantage of setting up these systems.
C++ is code is low level code (very near to hardware) due to which its execution takes place at higher speeed as compare to higher languages code like Java etc which needs time for both compile time and run time.
One question that can come to a programmer mind is why not C ? No doubt C is better in terms of speed but C++ being object oriented emerges out as a best candidate for AT.
Note: Latency is affected by other factors as well like broadband speed,distance to server,Execution speed etc. Execution can be reason HPC (High Performance Computing) role in trading is increasing day by day.
VWAP Algorithm
Value Weighted Average Price: in this algo trader first estimate the volume of the trade that takes place in the market on a particular day. Then depending upon the volume traded in day he/she divides the number of the stocks to be bought depending upon the volume in the market so that effective price should be weighted average price.I will try to write algo for this:
- Find Daily Volume in a stock, Say it came out to be X.
- Number of shares to be bought in day , Say 100.
- At particular time if total volume traded on stock is 10% of X then buy 10% of stock, means buy 10 shares.
This algorithm instead of used for day can be used for long or short duration. VWAP is typically used by HNIs who do not want to sway the market with their orders and do not want to let sniffer know their presence in the market.
Thanks
Sidharth
Subscribe to:
Posts (Atom)