Monday, March 19, 2007

Quote of the Week

"Brick by brick my citizens, brick by brick" -- Emperor Hadrian of Rome
I haven't posted much in awhile. Mainly because the more I learn the less I know. The less I feel I can share. The less certain I feel about things. The study of the market is a strange bird. So different than anything else I've dug into.

Investing is like programming yet you're switching languages, tools, platforms, users, business rules, etc. every week, day, hour, or even minute.

Just when you feel comfortable about your knowledge...your experience...the market changes on you. So, you're left with a few options. You can...

1) Pontificate. Throw lack of knowledge to the wind and show off that big chip on your shoulder. Pontificate at will as to what the market will and won't do. If your wrong...then so what? Pontificate a little more...and a little louder. Don't stray from your point of view. You are a contrarian after all. Take solice in that.

2) Daytrade. Since the market changes so fast and so often...embrace it. Change with it. You gain a lot of experience this way...no doubt about it. Always expanding, learning...and never getting comfortable. Those are the keys to success with this option. Note: Swing traders fall into this category as well. In fact, you'll find most daytraders have swingtraded and swingtraders have daytraded. All depends upon the speed in which the market is changing and the speed in which the person is comfortable with the changes. :-)

3) Invest for the long haul. Forego all the hip hopping around of the market. Buy and sit on your hands. Yes, I said that right. Cast that chip off your shoulder. Your grasp or lack-of on the ever changing cycles. Give up the notion that working harder equals greater returns. And most importantly, give up the ever incessant discussion as to why the market is top-heavy...bottomed...or bubblicious. Realize that your returns are generated from the market...not from you. Ouch! How's that for an ego buster.

If you haven't figured it out...I've chosen all 3 options at one time or another. But, for the past year I've stuck with option 3 - Buy and Hold (with a trailing stop). And I won't lie to you...it's lonely. Tough. Aggravating. For a workaholic like myself...it has been especially difficult to let the market generate my returns. But, the method is working. Brick by brick.

So, sorry for the lack of posts. Besides not having much to say about the market...I have been busy with completing my backtesting platform project. And for the most part, it's complete. The cool thing is I'm now able to test at the portfolio level all systems and allocations across thousands of stocks (20,000+). In fact, here are 3 things I've learned from this project that is market-related:

1) Important to test your ideas on the market without cash constraints. Because using cash limits your trades. And you need to see the impact of all trades in order to judge whether your idea is worthy of attention. Boot-strap simulations prove helpful here as well.

2) Test ideas with cash constraints. You may have an idea that does amazingly well...but just a few trades will wipe your cash out. And if you wipe your cash out...you're wiped out.

3) Carefully optimize your logic. Curtis Faith explained it better than anyone I've read as to how to best optimize your system. Avoiding the top of the curve is the key.

And here are 3 things I've learned from this project that is programming-related:

1) When looking for the fastest way to read and write vast amounts of simple data...avoid the plethora of databases out there. I've tried everything from PostgreSQL, MySQL, SQLite, BDM, SQL Server, KirbyBase, and many more. Nothing and I mean nothing even comes close to plain vanilla CSV files. Nothing! If you can imagine...it's even faster to sequentially read a CSV file to pickup a record by date than to query a db directly for that row.

2) Python is much faster than Ruby when it comes to processing CSV files and not much slower than C.

3) Programming a backtesting platform is not complicated...actually very simple. But, completing this project sure did test me. Why are the simplest things the hardest to program?

Later Trades,

mt

2 comments:

Byrne Hobart said...

Pontificating is a great test: if you have an idea that you can't articulate, it needs some work -- if you have an idea that you can articulate, you might get a response that helps refine it.

The Ruby folks are (apparently) working on a faster Ruby VM, so that won't stay a problem forever.

Mike Taylor said...

Byrne, thanks for the comment.

I'd sure love a faster Ruby. I prefer coding in Ruby than Python. Things just flowed better when designing the testing platform with Ruby than Python. But, in the end, I couldn't deny the speed difference. When dealing with 20,000 stocks and each stock having possibly 5,000 records...a minor difference in speed avalanched into a big difference overall.

One thing I wondered...is the file system on windows faster or slower than the file system on linux? And then is Python faster or slower on windows versus linux?

I'm currently on a windows box. But, have wondered if I could squeeze a bit more speed out of the application just by switching operating systems.

Take care,

mt