Archive for the ‘Introspection’ category

Perpetual Motion, Hacking, and the Contemporary Philospher’s Stone

October 29th, 2009

Perpetual Motion

At age thirteen, I invented a perpetual motion device. Obviously, I was a genius. Recognizing the magnitude of my discovery, I decided to patent the machine in order to capture the associated rewards. Years of groping through Popular Science magazine — it was my pre-pubescent version of pornography — meant I knew where to find patent lawyers: pages -1 through page -5.

Excitedly, I called the patent attorney that seemed to be the most affordable. I confidently declared that I had invented a perpetual motion machine and required a patent. The attorney did not seem impressed. Apparently, I was not the first person to try and patent a perpetual motion device. In hindsight,  I am willing to bet that patent attorneys who advertise with Popular Science magazine are continuously flooded with similar claims. After signaling irritation that was detectable even to a thirteen year old, she informed me that she would send the requisite forms but could not proceed without a fully functional prototype to submit as evidence. Apparently, this guy named Newton did not think perpetual motion was possible, so the patent office was not very liberal in awarding patents for such inventions (anymore).

I proceeded immediately. First, I spent my accumulated birthday money on magnets from Edmund’s Scientific. Next, I used K’NEX to build the scaffolding for a ring of magnets that would surround the central magnetic rotor. When the magnets arrived, I hastily lashed them to my plastic toys and and let ‘er rip. The magnet slowly swung around before settling in at the weakest point of the rings magnetic field.

Frustrated, I retrenched and thought about what had gone wrong. I was able to deduce that the magnetic fields of the independent magnets become part of a system when joined with the other magnets. They would not independently push the rotor — it didn’t work like that. However, committed to my brilliance, I thought of various ways to work around the problem such as using the momentum of half-filled water canisters to overcome the “humps”. Obviously, I did not overturn the laws of the universe. My idea may have been naive, but I learned a lot about systems while enjoying the exhilaration of experimentation. This experience may have had a major impact on my life.

Hacking

When I was young (before my attempt at overturning the laws of the universe), I asked my father to help me learn how to program. Since these were the days of DOS and Norton Commander, QBasic was to be my playground. Although I learned basic programming logic, I did not progress far enough to be capable of implementing a Gorrillas clone. Sadly, given my age, I enjoyed the instantaneous rewards associated with sports more than the personal satisfaction offered by solving problems with computers. My growth as a programmer was arrested.

Then came the movie Hacker’s. Hacker’s resurrected my interest in programming. Hacker’s — with the help of a young Angelina Jolie — gave programming sex appeal. It became my ambition to become ‘Cereal Killer’ (seriously, Zero Cool/Crash Override was boring).

This happened to be the same era of AOL ‘proggies’ and ICQ. For about six months, a friend and I ran a site called The Digital Underground that was a AOL themed repository while also releasing our own 133t apps. We were cool. We knew it.

That lasted for at most nine months. That is roughly the intellectual half-life of VB, even to a young programmer. I left that world behind and ventured out to C, C++,  and Python. Using better tools, I made applications that were reasonably complex and much more rewarding: spam-bots.

Now, I was a h4×0r. Around freshman year of high school, I was making 1-2k a week working after school. This was when I started hating school. Partially because my after-school work was much more intellectually challenging and mostly because I was making “bank”.

Fortunately, my career in spam was not to be. After a little more than a year, my parents had caught on — they did not approve. This shifted my efforts to a more worthwhile and exponentially more challenging arena: markets.

The Contemporary Philosopher’s Stone

I think reading Matt Ridley’s, The Origins of Virtue, in 9th grade seeded my intellectual development (thanks, Mr. Ridley). I became fasinated with complex systems like Conway’s Game of Life, Rule 30, ants, and Axelrod. Nothing was more interesting to me than Cellular Automata, ANN’s, PSO, and genetic algorithms. Soon, I realized there was a potentially practical application. With spamming out of the way, I now combined all my interests: programming, complex systems, and trying to do the supposedly impossible. I set out to beat the market.

This is not a huge leap from my past projects. There are strong parallels between perpetual motion and trying to overcome the efficient market hypothesis. And, just like with past projects, my efforts led to procuring new tools. At various stages in the past eight years (I am still pursuing this path), I have become proficient or better in ASM x86, C, C++, Java, Lua, Perl, Python, Ruby, Lisp, Erlang, PHP (front-end), Pascal, and Haskell. I have reproduced many popular financial models while trying to understand and improve them. This was all far more rigorous than that I was being exposed to in school (undergrad) at the time.

This brings me to now. I have spent the past 8 years trying to come up with an algorithm that finds pockets of profitability in a cloud of probable randomness. This has given me what I believe is a powerful understanding of complex systems. Complex systems modeled on computers have become my contemporary Legos — and, I want to play all day long.

In all likelihood, I will not make a breakthrough discovery. The fog that is my ambition may be obscuring reality. I am exploring an alternate area of the landscape of solutions. I may be hill-climbing a local unexplored minima — but hold out because of the potential for maxima. However, f*ck it. I want to spend my time doing what I enjoy most.

Consumerism and Programming Polyglots

October 28th, 2009

This is a follow up to Monday’s blog post, Back to PHP. In the scope of the project I need to develop, PHP is the best choice. My conclusion was correct. The reasoning I used to reach that conclusion was (mostly) incorrect. The post was basically a list of justifications that were a product of “Programming Polyglot Syndrome.” This post is a half-hearted retraction Monday’s post.

I dislike shopping for clothes. Unfortunately for me, social and professional conventions dictate that I must spend some time and energy dressing myself in something other than grey sweatpants and Birkenstocks. Shopping is a necessity and I shop hastily.

For example, I recently noticed my black dress shoes had a hole worn through the sole (oh, Aerosmith) last week. I headed to DSW. For me, the costs imposed by wearing cheap shoes are negligible. For most men, shoes are shoes. If they don’t look dirty, are properly shined, and are not 95% creased they look fine. Moreover, I care more about my checkbook than my feet (the later are mostly self-repairing, the former is not). Once I find a pair of shoes that are not pink, are not expensive, and are not four sizes too large, I am done. I am satisficing.

People who enjoy shopping are not satisficing. That frustrated me until this morning. An introspective friend of mine was describing why she enjoyed shopping so much. She was able to recognize that, for her, shopping is about buying possibilities. She doesn’t shop for new tops. She shops for the experiences she believes – rationally or irrationally – the top will elicit: the attention of some man she finds attractive or the jealousy of some woman she dislikes.* She is buying hope.

Now, because this conversation was taking place via GChat, I was doing other things at the time. At one point, I checked the traffic stats for the unexpectedly popular post I wrote on Monday, Back to PHP. In the Back to PHP post, I tried to justify switching back to PHP, a language with a lot of warts. Thinking about it in the context of my friend’s consumerism, I noticed that it’s roughly the same thing. I have a project that I have no strong interest in but I must write. By switching to PHP I was trying to optimize away most uninteresting parts of development – mainly deployment. Cognitive quirks lead me to half-conclude that PHP would make the development go swimmingly well, with no bugs, deployment issues, or mental energy required. Magic!

This is not the first time I have learned or relearned a language because I fostered the delusion that it would {motivate me; dissolve all complexity; …, cure cancer; bring about world peace}. Actually, for me, this is often the primary impetus. In most cases, given the context of the problem I actually set out to solve, this turns out to poor investment of my time.

That is not to say that learning many programming languages is a bad thing. Different languages have different conventions, paradigms, common practices, etc. Learning many languages and paradigms pays a dividend. You become a better programmer and you carry new ideas across language lines. There is nothing wrong with learning for the sake of learning. However, if you are learning something new to avoid doing something you don’t want to do, you are probably not going to make any gains in productivity for that project. You are just procrastinating.

In the case of my project, PHP is the best choice because initial deployment in environments that I do not control is one of the most important considerations. PHP is very simple to deploy initially and is very common. However, most of the justifications I provided were not related to this issue. I just wanted to (re)learn a language.

Although, to be fair, Factor might be my best bet. Forget all this introspection!

* This is actually pretty interesting if you think about it. “Peacockery” in fashion is more apropos than realized. Not only do people wear things that are ostentatious to attract attention, but doing so becomes a requirement for those who otherwise would be happy in sweat pants. Adopting fashion trends is less about conformity than it is about leveling the playing field for attention. It may be less about showing fitness with clothing acting as a proxy for wealth and more about Fisherian runaway. F*cking, peacocks.

P.S. “Programming Polyglot Syndrome” is almost an extension of NIH. Coding something from scratch can be more interesting than learning to properly deploy and use someone else’s code.

To Iterate is Human, to Recurse, Divine

November 30th, 2008
Escher's Hands

Escher's Hands

I have a fancy for functional programming languages; I find recursion intuitively elegant. However, in my mental processes, recursion seems to be a dangerous flaw.

This trade may return 5% if event A occurs-> This trade could return 10% if event A & B occur -> This trade could return 20% if event A & B & C occur -> Well, this trade has returned 20% and now people are going to pile one and it could return 30% -> … -> This trade could return 1,000,000%.

My mind selectively traverses the path on the recursive tree that is most favorable while ignoring the (huge) selection of paths that do not lead to the favorable end-node. Even worse, I forget the necessary conditions that lead to the selected outcome! A favorable outcome is pleasurable and I am a pleasure-seeking animal; It seems that this also applies abstractions.

Furthermore, the recursive thought seems to lack a terminal condition. Instead of building a balanced tree of possibilities, the favorable path gets many more steps, leading to a gross asymmetry. My mind stops traveling only after it has exhausted mental resources.

Mental recursion is dangerous without continuous checks.

* Note to the non-programmer: The title of this entry is actually an oft-repeated L. Peter Deutsch quote.

Lessons Learned from Hot Girls

November 17th, 2008
XKCD #55

XKCD #55

In high school, I managed to score a date with the lovely Jess Gore.

She was far above me on the adolescent social ladder. I was the excessively introspective, semi-nerdy guy with hair that resembled hedgehog spikes (I wasn’t trying to be rebellious; I genuinely thought it looked good); She was the elegant (to the extent that you can be elegant as a teenager anyway), quietly rebellious girl without physical flaw (except for her ears which were perpetually red, but I found that oddly charming.)

Being that I had very little “game” (that’s being kind) back in high school, the entire matter was simply a consequence of a favorable situation. I was placed into a project group where she was one of the members. While working on the project, I got bored (as I am prone to do given a forced faux-intellectual venture) and suggested that we (the group) go grab food. Our other group partner was of the anal-retentive variety and opted to stay in the library to find other sources. (She deemed the suggested number of sources inadequate for our advanced 11th grade abilities.) Jess, who was apparently bored as well, chose to leave with me.

Back then, I never thought about social situations; As I said, I was excessively introspective. So when she had me bring her home first so that she could change out of her group study attire and emerged wearing something that I would describe as datish (yes — I did just say datish), I was confused.

As a consequence of my confusion, I grew progressively awkward as we moved through what I began to view as a date. (In retrospect, it definitely was a date. Or at least, I’d prefer to pretend it was.) This opportunity was unprecedented in my testosterone-dominated mind and I did not want to risk making a mistake. To prevent such a loss, I added (too many) judgemental filters to my behavior and my mind was not able to effectively cope with the stress. (It still is incapable of doing this but, thankfully, I have very few behavioral filters anymore.)

Censoring your actions and behavior makes you look filled with self-doubt. Confidence is ridiculously sexy; Self-doubt is not. She clearly could see that I was not acting like myself. The social instincts of women are superior to men; We are insects by comparison. She grew visibly less interested. Thus, I missed what would have been a very large opportunity at the time.

What is the point of this story? My mind has irrational artifacts. To this day, I am incredibly awkward around Jess, even though she does not in any way intimidate me. (I am for the most part socially arrogant; Almost no one intimidates me anymore.) This pattern also holds — albeit to a lesser degree — for other girls that I idolized in high school. It seems that my perceptions are layered; The old socially jittery version of myself still exists and somehow has pre-emptive rights to my actions. I can recognize when I am acting this way but, ironically, it requires effort to be myself!

If this is true, than the layers bellow high school horny also play a role in my decisions. This is probably a convoluted way to think about fear and greed, but it helps me. I still cannot hold a five-minute conversation with Jess Gore because of some old irrational mental fragments. Therefore, I try to recognize that the attractiveness of a trade may be due a lot more to irrational (in the context of trading) mental processes than the brilliance (har har) of my analysis.

…I suppose I am still a bit excessively introspective.

Momentum is Instinctual

August 29th, 2008

One of the earliest trading programs I wrote (circa sophomore year of high school), traded on momentum. It acted quiet naively which is a proper reflection of my mind at the time. If the slope of the price for an asset was greater than and less than some prespecified values the asset was bought until it was lower or greater than a terminal slope value; The inverse applied for shorting. My program then searched for the best combinations of entry and exit slopes over a range of different historic windows.

I was quite excited at first when I found some bots that did extremely well. Then I had the insight to try testing the bot on a different time period to confirm they did just as well; They did not. I am actually proud that I recognized the need for out of sample testing. I think at the time the math taught in my connections class (read: dorky kids) was trig/precalculus. I had no knowledge of statistics outside of averages.

The point to take away from this experience was my sixteen year old brain’s expectation of herding behaviour; It is instinctual. Behaviour finance expounds on this concept. At my young age I believed that if a stock was moving up, people would pile on; If a stock was moving down, people would abandon ship. Eventually, the fundamentalists would correct very large errors, but in the short term, I thought the technical traders set movements.

Currently, I believe that momentum is a huge factor for a certain class of trader; This class is not sophisticated. It may be possible to exploit their actions, or their likely actions, but since they probably dominate only over the short term, their is too much noise relative to signal.

Some people (in this case momentum traders) behave in a predictable way. This capacity for prediction does not mean profit. Predicting the movement of one fish in a school does not mean you know the school’s trajectory — although it might give a hint that is occasionally correct.

I Am a Gluttonous Trader

August 28th, 2008

In addition to being a promiscuous trader, I am a glutton. Not only do I trade too often, but I risk too much of my equity on each individual trade. Perusing my trades from last year, I noticed that eighty-percent of my losses came from about 10% of my trades. It was not that these trades were placed in volatile periods or held for longer than my typical trade but that they represented huge chunks of my equity; Two trades were actually my entire stake!

I believe I do this — stake too much — because I often believe opportunities to be ephemeral; I want to capture profits before my edge disappears. Sometimes, the opportunity may truly be fleeting and should be quickly seized, but the associated mental sloppiness comes at too high a price; It makes me act impulsively.

Furthermore, I sometimes think “well…this could go to point X for Y% return and that would be Z dollars”; This is the antithesis of rationality and discipline. Yes, the asset could move to point X; It could also move to point -X; It could also move to point -2X. I get risk blind when the profit potential is glaring and risk blind people are craps players.

Eventually, I will use more sophisticated methods to quantify risk and lower it appropriately but for now, I am going to intellectually cop out and choose to implement yet another simple rule: Assume each trade is going to result in a 100% loss and limit each trade to 5% of my capital.

I Am A Promiscuous Trader

August 27th, 2008

I spent the morning looking through my trading history for the past year; It was glaringly obvious that I traded too much. As this is one of the most abused platitudes in trading circles, I will expound upon my particular offense.

Obviously, you cannot say from frequency of trade alone that you are “over-trading”. What is too much for one person or team is not necessarily the same for another. People have different capabilities. However, you can state unequivocally, that if action is taken on nearly every asset reviewed, you are a promiscuous trader. The reptilian part of my brain seems to chase every spark.

The problem with promiscuous trading is not the quantity of trades, but the resulting quality of the aggregate. I noticed that occasionally, I came across trades that seemed too good to be true — but were proved correct. You can argue that I am revising my history, but I should point out that I keep notebooks of all my trades and, looking back at them, the major successes almost always had something along the lines of “VERY GOOD PLAY” scribbled at the conclusion of my analysis. However, these trades make up the minority of my history. The majority of my fills were stocks I looked at, chose a direction, and placed my order. This is promiscuous trading — taking any action because it is available.

At this point in my education, I am not convinced that I have the emotional iron to prevent promiscuity without a set of established rules. Therefore, I am setting the following hard rule: At most I can make one trade every two weeks. Obviously the potential for promiscuous trading still exists (e.g. if I only look at my options once every two weeks) but at least it is somewhat mitigated by my unrelenting interest in the market. I will still take a side on every asset I review, but only send orders on those I feel very strongly about. I will be half paper-trading (for promiscuity’s sake) and half real-trading (for my reptilian brain’s sake).

I Am Relatively Unintelligent

August 27th, 2008

Compared to the average quantitative analyst, I am unintelligent. To be more accurate, I should say I am less experienced and educated; I believe myself to be of equal innate intelligence and discipline but several years to the left of their capabilities on a time line. The confidence I have in my intellectual faculties might be hubris, but for now I am concluding that it is not unfounded.

Given my current stage in intellectual maturity (intellectual adolescence?), I must admit to myself that, in all likelihood, my efforts at trading will presently be unfruitful (as they have been in the past). I am developing my mathematical skills, but they still lag behind; I read much on history (not only economic), but it is likely to be insufficient at this point. Furthermore, the vast majority of academics — who are also more educated and experienced than I am — assert that trading is a ill-advised adventure; You can not beat the market, you can only take on more risk. Some traders may appear successful, but they are just the lucky ones who happen to land on the far right tail.

So where does this leave me?

I respect (highly) the elegance of modern portfolio theory. A sizable part of my mind has already concluded that it is far more rational to build long term portfolios than to pursue the path of active trading. This is the same part of my mind that gets angry when people buy $29.00 in lottery tickets as I wait to buy my pack of Tear ‘n Share Peanut M&M’s.

On the other hand, I am wary of the conclusions drawn by the academic field concerning the efficient market hypothesis. The majority of studies make heavy use of long term historical price sets; I do not believe that valid inferences can be drawn on these data. Given my own experience, I believe this type of study suffers from, at the same time, too much and too little information.

Furthermore, the reptilian side of me that not only is overconfident but also craves the stimulation that trading provides, still harbors the illusion that I can be a successful trader. I have been interested in investing err, speculation) since I was very young — around five to be precise. There is nothing I enjoy more.

So, probably foreshadowing failure, I choose to stay the course because I believe in my own abilities and am skeptical of the conclusions of the EMH; I am relatively unintelligent but I believe myself to be more capable then those above me.

This does sound like hubris, no?

Hello World

August 26th, 2008

I earned (in the loosest sense of the word) an B.S. in finance from the University of Maryland’s Robert H. Smith School Of Business in Summer 2007  (3.2 GPA).

I have been developing financial modeling and forecasting systems since 2002. Early efforts were computationally advanced – employing genetic algorithms, pattern matching, and neural networks — but naïve and unscientific. These systems found combinations of conditions that historically resulted in better-than-average returns, which I then tried to rationalize. Essentially, they were great at finding pretty patterns of faux profitability in clouds of randomness.

Later iterations were more intellectually sophisticated. I began to rigorously adhere to the scientific process, instead of groping blindly through data sets. I no longer searched through data; I started to hypothesize and then attempt to confirm or reject my ideas. I came to understand that true alpha is exceptionally rare and, with incredible regularity, misattributed.

While my efforts did not yield any economically significant findings (yet), I consider my expenditure in time to be tuition paid. I developed a strong respect for risk, a deep understanding of markets, and a disciplined skepticism.

This blog represents the next step of my education; I will be trading with transparency.

Hello, World.