New Forum

Visit the new forum at

Thursday, August 30, 2012

Analysis of Hits

If you were to look at the number of hits certain pages of this site generated, you would find that my post entitled WSJ/FT Paywall Bypass has received, by far, the most attention. And it's not like you can't find substantial other sites online with information on how to bypass those paywalls. Quite frankly, I am not even sure I'm very proud of posting that information, and, in fact, thought about withdrawing the posting multiple times. It is, however, still up.

It does tell me something about the type of posts people like to read. I don't think many people like to read extremely quantitative posts. If I were to go for popularity, I should focus on other content. I have yet to decide how to go about utilizing this data, but it will influence my decision as to what to post.

Tuesday, August 28, 2012

AAPL by the Hour

I've been collecting intraday minute data for over a month. Here's a quick set of graphs showing the gain/loss for every hour throughout the day (the first half hour considered an hour by itself). The images are named in PST.
I doubt much can be gleaned from this alone. On average the 7am hour has been the best play for a long, the 9am hour (lunch? in NY) is the best hour to sit, and the last hour is the best to go short. The largest standard deviation in values is in the 7am hour, followed by the 6am half hour.

Sunday, August 26, 2012


Want to watch a replay of the day?

Using the tick data from one could take each data line and print it on the screen at the time the trade was initiated.

Given the smallest interval is a second, in my version of the program below, I divide the second up by however many orders are placed, and then equally spread them throughout the second. Unfortunately, outside of regular trading hours certain seconds have no data. These gaps aren't accounted for in the program below. So going from 15:00:37 to 15:00:49, assuming no data in between, only takes 1 second rather than the 12 seconds it should take. But, given this type of program would generally be used to replay a trading day, I don't think these outside hours matter too much. I'll leave that for a future iteration.

The goal is to ultimately allow for replays at various speeds (1x, 2x, 5x the regular trading day), print the quotes on a graph and allow for sim trading through virtual order tracking. Lots more could be added, such as visual backtesting, but I'll save that for when I get some more of the basics done...

Here's the code:
import string
from time import sleep

f = open('gx120823/ES-2012-09.txt', 'r')

time_data = []
price_data = []
volume_data = []
oldtimeInfo = '15:00:00'

for line in f:
    line_split = string.split(line,',')
    timeInfo = '%s' % str(line_split[3])
    if oldtimeInfo == timeInfo:
        time_data = time_data + [str(line_split[3])]
        price_data = price_data + [float(line_split[4])]
        volume_data = volume_data + [int(line_split[5])]
    if oldtimeInfo != timeInfo:
        sleep_time = float(len(time_data))
        #print 'sleep_time is ', sleep_time
        j = 0
        for i in time_data:
            print i, '|', price_data[j], '|', volume_data[j]
            j = j + 1
            #print float(1/sleep_time)
        time_data = [str(line_split[3])]
        price_data = [float(line_split[4])]
        volume_data = [int(line_split[5])]
    oldtimeInfo = timeInfo

Thursday, August 23, 2012

SPY Gap Statistics

I read some of The Gap Guy yesterday while researching anything I could find online about gap trading. He got me to thinking about ways I could narrow down the gaps that I trade. Anyway, I posted some statistics on individual stock gaps a while back and I will post some stats on individual stocks again; but, the table below is on the SPY. 

The table shows the percentage of gaps that closed based on certain characteristics. These characteristics are whether the "prev day" (i.e. previous day) was positive or negative (i.e. up or down); the percentage of the gap (e.g. >.001<.005 = >0.1%<0.5%), and perhaps least familiar, the "type."

Something is "type 0" if the gap opens above the high of the previous day; "type 1" if it opens between the high and the next position ('prev open' when the last day was down, 'prev close' if the last day was up); "type 2" if it opens between the open and the close of the previous day; "type 3" if it opens below the next position ('prev close' when the last day was down, 'prev open' if the last day was up); and, "type 4" if the gap opens below the previous days' low.  (Check out this page at the gap guy for more visual info)

Note: I highlighted everything with a 55% occurrence or higher. I cannot guarantee the accuracy of the info! And, even if a certain zone has a high occurrence of gap closures, I cannot guarantee trading these gaps will result in profit. Please do your own due diligence and use this info only as a start to your own analysis. 


Friday, August 17, 2012

Wheat Prices, Sunspots, and One-Dimensional Theories

I meant to post a link to this article on the increase in grain prices a couple weeks ago. It is still an important article especially from a critical thinking point of view. The author begins by noting the assertions by many in the media that the reason for higher grain prices is drought caused by global warming. He then goes on to say:
A better explanation for the drought, and the ensuing spike in grain prices, is that this is all part of the normal 11-year sunspot cycle.  But to find that relationship in the data is what the story is about. 
Given the data presented in the article, I would have to say the information is compelling. But, that is not the point of my post. I have little knowledge of what causes grain prices to fluctuate. In fact, that lack of knowledge is my point. So often people are willing to hurriedly, lazzily, and/or sloppily accept what sounds good. This, of course, can lead to an imperfect idea as to what will happen. What you think may happen, might happen for some time; but then, when the premise on which you built your theory continues to hold (e.g. global warming, drought, etc) but the underlying asset fails to continue its path, you will find that your single loose premise is not much help. Yes, global warming may be a cause, but perhaps it is merely an auxiliary cause of some greater impetus.

Abstract lessons learned in one area and apply to other investments and trades. Grow and profit.

Wednesday, August 15, 2012

Fed Days

I purchased Quantifiable Edge's Fed Guide a day before the last Fed meeting. If you have an interest in reading solid analysis, I suggest you buy it too. For $25, it's not too much to add an extra edge to your trading.

While it definitely doesn't sum up everything presented in QE's Guide, the NY Fed has a paper of its own with the following as an introduction:
This paper documents that stocks in the U.S. and several other major economies have experienced large abnormal returns right before U.S. monetary policy announcements since 1994. These returns are puzzling and difficult to explain with standard asset pricing models.
Despite only a handful of Fed Days throughout the year, it is well worth your time to take notice. The edge provided is enough to strengthen anyone's portfolio with relatively little exposure.

Tuesday, August 14, 2012

Gap Trading

If you were to fade each gap on AAPL that was .5% or bigger (up or down) over the last month or so, this is what you could expect for max gains (i.e. max return: if a negative gap, then you would go long so the max gain would be daily high minus open; and vice versa for gap ups).

PS: Been working on analyzing data like this across a number of stocks and with more info like drawdown before target is reached, contributing factors (e.g. earnings, news releases), etc. 

Tuesday, August 7, 2012

TICK Backtest

As I mentioned in the last post, I want to do a little TICK-NYSE backtesting in order to see if it can aid when making entries and exits. Perhaps it can also give some ideas as to the direction of the market.

The idea is that when the TICK index is "large" in either direction, traders are either dumping shares or grabbing shares. Here's a quick description of a TICK index. Because traders are eager to purchase or sell, it might hint as to the direction of the overall market, or at least, and opportune entry or exit.

Here's the test that I ran:
- If the TICK-NYSE's high > 500, go long SPY on the close of the minute bar.
- Sell after (1,2,3,4 or 5) minutes.
-If the TICK-NYSE's low < -500, go short SPY on the close of the minute bar.
-Cover after (1,2,3,4 or 5) minutes.

Unfortunately this data only goes back a week (I don't have access to more), but it is interesting nonetheless. What you find is gains when going long or short based on the above rules, for 1, 2, 3, 4 or 5 minutes. When the TICK index is high, holding for 3 minutes is opportune, giving a return of 1.3% over the last week. When the TICK index is low, holding for 5 minutes is opportune, giving a 1.3% gain over the last week.

Obviously, this could (and most likely will) change. But, it is nice to see that there are instances (and hopefully I can check more cases in the future) where the TICK index does hint towards the movement of the SPY.

Y-axis should be multiplied by 100 to find percent gain...

Monday, August 6, 2012


Starting to collect data on NYSE's TICK index. Hoping TICK research will aid in position entry and exit.

Sunday, August 5, 2012

VIX Term Structure

Here's a cool link showing the VIX term structure.

PS: Working on some object oriented programming. Trying to improve my programming knowledge...

Saturday, August 4, 2012


Here's an interesting video on the non-linearity of risk with Nassim Taleb.

Wednesday, August 1, 2012

Options Expiration Friday Range

I was curious as to how much the SPY fluctuated every third Friday of the month (options expiration Friday). Here's a graph of SPY range (high minus low) over the opening price. The percentage is shown on the y, and the x has the month.

For reference, the average range percentage over this period is 1.3%. So it doesn't look like options expiration has recently caused that much more volatility than on other days, at least for the SPY itself. (Sorry, I didn't get July's expiration range in there, albeit ~.5%)