quant

Levenshtein distance in C++ and code profiling in R

March 25, 2012 | Dzidorius Martinaitis

At work, the client requested, if existing search engine could accept singular and plural forms equally, e. g. “partner” and “partners” would lead to the same result. The first option – stemming. In that case, search engine would use root of a word, e. g. “partn”. However, stemming has many weaknesses: ... [Read more...]

I see high frequency data

March 1, 2012 | Dzidorius Martinaitis

In the previous post I shared an example how to get high frequency data from IB broker (well, it is retail version of HFD – it has only best bid/ask and the trades). Now, once you saved some data – what should you do next? Next logical step would be data ... [Read more...]

Vectorized R vs Rcpp

February 1, 2012 | Dzidorius Martinaitis

In my previous post, I tried to show, that Rcpp is 1000 faster than pure R and that generated the fuss in the comments. Being lazy, I didn’t vectorize R code and at the end I was comparing apples vs oranges. To fix that problem, I built a new script, ... [Read more...]

The power of Rcpp

January 30, 2012 | Dzidorius Martinaitis

While ago I built two R scripts to track OMX Baltic Benchmark Fund against the index. One script returns the deviation of  fund from the index and it works fast enough. The second calculates the value of the fund every minute and it used to take for while. For example, ... [Read more...]

ai-class.com vs ml-class.com

December 16, 2011 | Dzidorius Martinaitis

For those who did not know, Stanford university offered free off charge 3 courses at beginning of the autumn. It is kind of shocking – US based institution offers education for free! Take any socialism oriented country and one of the promises is education for free. But it seems, that the argument ... [Read more...]

C++ is dead. Long live C++

December 1, 2011 | Dzidorius Martinaitis

During the summer I was contacted by a hedge fund from Bahamas. The fund was looking for someone with R language skills on-site and insisted for phone interview. Besides obvious questions about finance, statistics, coding and how many tennis balls can fit in Boeing 747 (ok, this question was omitted), they ... [Read more...]

Trading volume forecast for an illiquid stock

August 8, 2011 | Dzidorius Martinaitis

When dealing with transaction cost analysis, a stock’s volume is assumed to be stable or foreseeable.  However, there is different picture, then we are dealing with an illiquid stock. It is relatively easy to forecast the volume of a liquid stock, because trading volume has high autocorrelation – the volumes ... [Read more...]

How big block trades affect stock market prices?

July 27, 2011 | Dzidorius Martinaitis

I will be giving a presentation on “Optimal transaction cost” in Vilnius on  16  August. While preparing the presentation and looking for an optimal execution solution, a natural question arises: does the size of the trade affect stock market price? I’m sure, you would say 100 % yes. Well, you would be ... [Read more...]

timezone issue in R

May 14, 2011 | Dzidorius Martinaitis

While investigating Intraday patterns in FX returns and order flow paper I have faced the problem with timezone. I had 3 data sources with different timezones (GMT, CET, CEST). Most confusing thing was, that I didn’t know, how to deal with summer time. But why did I have the data ... [Read more...]

Non-standard assignment with getSymbols

April 21, 2011 | richierocks

I recently came across a rather interesting investment blog, Timely Portfolio. I have a certain soft spot for that sort of thing, because using my data analysis skills to make a fortune is casually on my to-do list. This blog makes regular use of a function getSymbols in the quantmod ... [Read more...]

Transaction cost analysis and pre-trade analysis

April 20, 2011 | Dzidorius Martinaitis

Transaction cost analysis (TCA) is the framework to achieve best execution in trading context. TCA can be split into three groups: pre-trade analysis, intraday analysis, and post-trade measurement. Pre-trade analysis allows us to get insight about the future volatility of the price, forecast intra-day and daily volumes, market impact. It ... [Read more...]

Correlation network

March 22, 2011 | Dzidorius Martinaitis

I came up with an idea to draw correlation network to get a grasp about relationship between a list of stocks. An alternative way to show correlation matrix would be head map, which can have limitations with big matrices (__100). Unfortunately,  ggplot2 package doesn’t have a easy way to draw ... [Read more...]

Tick data retrieval

January 31, 2011 | Dzidorius Martinaitis

I just published Java based code to pull tick data from Interactive Brokers. There are thousands tools to get tick data from IB, but I had one feature in mind. You can get maximum 50 quotes per second from Interactive Brokers (its IB limitation for TWS API) . Imagine a situation, when ... [Read more...]

Interesting volatility measurement, part 2

January 21, 2011 | Dzidorius Martinaitis

A few weeks ago I have mentioned about an interesting volatility prediction. It is based on two periods of historical volatility (standard deviation). The remaining question was – does it really works? I could not give the answer, because I didn’t have VIX futures data at that time. Later on, ...
[Read more...]

Seasonal pair trading

January 10, 2011 | Dzidorius Martinaitis

quanttrader.info is a good quantitative repository, where I found an idea about seasonal spreads play. The idea of seasonal pair trading differs from pairs trading in a way, that it doesn’t try to find deviation from the spread’s mean, but it looks at seasonal spread patterns. In ...
[Read more...]

High readings of VIX index during 2 days

December 28, 2010 | Dzidorius Martinaitis

During last two sessions (December 23th and 27th), VIX index posted returns (close to close) above 6 %. My question is – what return can we expect next day after such event? As you can see from the graph above, expected return is positive. During 1995-2010 were 53 such events and mean return was 1.02 % [...]
[Read more...]

Interesting volatility measurement

December 10, 2010 | kafka

Long time ago I stumbled across interesting volatility measurement at quantifiableedges.blogspot.com. The idea is following: take 3-day historical volatility of S&P 500 index and divide that by 10-day historical volatility. Then mark all points which are less that 0.25 and measure the volatility of 3 following days. On average, the ... [Read more...]
1 2

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)