Entries Tagged 'code' ↓
January 11th, 2009 — code, contest, crows, investing, stocks, twitter
StockTwits for Idiot Retail Investors: Week #1
Okay, one week into my StockTwits experiment and two trades closed out.
Closed out about half of $NDAQ exposure
First, despite @alphatrends‘ chastisement expression of concern (see my mea culpa for why chastisement was mischaracterization) in last week’s comment thread about not paying close enough attention to his reportage, I managed to turn that failed trade into a good trade by selling all my $NDAQ put options on Thursday’s drop for a ~24% gain. In at cost basis of $2.47, out at 3.10.
The funny story here: I got props from @howardlindzon for the trade, but he said it was too early, teenager:

Only I spent half the day incorrectly thinking he was calling me a teenager. I prefer grasshopper. Or idiot retail investor. I was chagrined. Damn, I missed the insult @howardlindzon day earlier, when I wanted to give him crap about his inability to use apostrophes appropriately in his tweets, and here he was, bagging on me bailing out too soon. Schvitz-behavior-critiquing mofo.
Then I realized about lunchtime that he was talking about $NDAQ as being a teenager (meaning: eventually trading in the teens).
God, I’m a dork.
So I’m still sitting on my $NDAQ short with a cost basis of 23.50. I tried closing it out Friday at a $21 bid, but it didn’t hit. I’ll let this one ride, teenagers.
Sold Some $SRS Premium
Okay, this one worked out—sorta. I sold calls on half my $SRS position. The half (lol) with the $60 cost basis. $70 calls at $1.95 premium. My overall cost basis is $86, so if this gets called, I’m okay (although my cost basis will rise on the overall position to $101 counting these profits.) Not a huge position, so not a lot of premium, and not a lot to write home about.
The one thing I heard this week that intrigued me (on NPR’s Marketplace): commercial property owners are proactively giving retail tenants lease discounts in order to keep them as viable lessors. One example was a top-down mandate to a commercial real estate concern to slash in-progress negotiated leases by 20% to try to keep the retailers from folding. I’m not smart enough to know the best way to play this. It seems like there’s some long-term arbitrage opportunity here. It feels like this is a case of “we all go down together” and the play is to short $RTH and go long $SRS, but I haven’t thought through the game theoretical issues here. Intuition says that it is $SRS that gets hosed no matter what. They lose either way. They give concessions, and margins go down; they don’t, and retailers bail and close stores and they hurt. So despite being way underwater on my $SRS position, I’m liking my 5-6 month chances on turning this one around. The commercial real estate industry is panicking, and they’re counting on retailers of all people to save them. Show me some consumer sentiment and I’ll cover.
In other news: $COST, $AAPL
I just about covered my $COST (Costco) puts this week. They’re good to the tune of about 22% on paper, after Wal-Mart’s fade on Thursday. I’m letting these run a little bit more. While I haven’t disclosed position size yet on any of these trades (waiting for some of last year’s trades to close out before setting that up), if $COST drops to around $48 this upcoming week, I will bank a 45% gain on the puts and the profit will be roughly equal to my $NDAQ put sale this week. This is about 11% of my trading account (and the trading account is in turn is about 16% of my overall brokerage position), so you get the sense of how I view a lot of these trades as tuition in my learning process. In the big picture, I’m trying to stay too small to fail.
I’m still negative on $AAPL with the puts (April 80s at 16.86 cost basis) despite my household buying four $AAPL products over the holidays to the tune of about four grand. Win or lose, I’m going to need to close out this position soon due to the time factor. Right now, I’m down about 6%. While in the long-long term I’m bullish on $AAPL, in the short term I believe it is range bound between $80 and $100, with all the trends pointing to it hitting $65-$70 before it hits $110 (based on lack of transparency around Jobs’ health status). If you’re buying stock for your kids’ college fund, go long. If you’ve got a 12-month time frame, short it north of $90. They have quality management, they have an incredible coherent strategy and management team (second only to $AMZN), but they have the problem in 2009 of a down economy (which will cause them to hold back major innovations) and the doubt around Jobs health. At some point this year, all the bad news will be out (it’s not yet) and AAPL stock will fall and then you can safely load up. Just not at $90. (I expressed similar sentiment in the comments over on Fred Wilson’s blog, with additional info on $GOOG. Great post and comments all around.)
On this trade, the time factor is getting me, so I will look to cover soon and will take whatever profits I can find should it drop to the $85-$86 this week. Hoping for lots of volatility prior to expiration.
What I’m Watching This Week
If you want my play of the upcoming week, it’s going to be this: let’s assume that $PALM ascends another 10-20% Monday/Tuesday based on the announcement of its new Pre platform. And let’s say that $AAPL falls 5% because folks think it’s a zero-sum game and the iPhone is hurt because of this. Then then trade is to cover your $AAPL short on the dip and immediately flip into a $PALM short (or put) situation. I know jack about technical analysis, so I can’t tell you about support, but I sure like $AAPL’s management over $PALM’s, and it should be pretty straightforward to know who the platform winners are going to be. $AAPL and $RIMM we still talk about in a few years; $PALM is just delaying the inevitable. There’s maybe only a 1 in 5 chance this will happen or that I’ll actually go through with the trade, but it’s one thing I’m watching. I like to trade overreactions and irrational exuberance, and any love of $PALM to me oozes irrationality.
What I Owe
I really need to give you the blow-by-blow of my September through December experiences in the market (including my schooling in $SPY and $USO calls), as well as the long-term history of my trading experience and use of online intelligence sources. I’ll sneak those in as posts over the next couple of weeks. It’s important background if you’re trying to judge whether I’m a voice worthy of catching in your filter. And since my day job makes being a day trader (with the requisite attention span needed) impossible, I’ll detail how I trade with a limited attention span and time.
Who I’m Tuning Into
This week I’ve begun to follow @alphatrends blog more carefully, as well as @fortune8 (appreciate the rationality of another part-timer) and @BuyOnTheDip (because I’m bearish as well). Haven’t decided yet on @mandelbrot though—love the art but not sure I can read the correlations between free text tweets and stock prices.
December 31st, 2008 — blogging, code, development, stocks, twitter
The Vision
It’s the time of year for reflection and resolutions. After putting about a month of thought into the exercise, I’ve landed on a few themes revolving around preparedness, agility and serendipity.
Here’s my 2009 game plan.
Invest in Skills
In early 2006, Mark Cuban gave his investment advice for the upcoming year. The moneyshot:
Invest in yourself. Do the things that can get you closer to your goals and dreams. It wont come from a brokerage commercial. It will come from preparing yourself , working hard and standing apart from your competition. You Inc is the best stock you can ever buy…if you are willing to do the work. —Mark Cuban
Lazerow hits the same theme again at 2008 year’s end:
So the question you need to ask is simple: is your annual take home pay, after taxes, really enough for you to justify the status, albeit it potentially fleeting, quo? I’d argue for many of you that the answer is NO by a long shot. And you taking your paycheck and deluding yourself to think that this too will pass is dangerous and short-sighted.
In 2008, I split my investment between infrastructure, upgrading some equipment
and skills (learning a little about the markets.) In 2009, the investments move more towards the skill side of things, as the scarcity of time and attention, and the value that can be created through focus and deliberate practice (pdf) point towards a greater ROI for your attention than for your capital, especially as we look to enter a long economic recovery.
Along these lines, my 2009 skill investments are:
- Learn Objective-C and Cocoa development for the iPhone.
- Create one screencast per quarter.
The learning has already started, thanks to the great Stanford Cocoa Programming course targeting iPhone development. I’ve tried in the past to get started with Objective-C and didn’t have much luck finding an easy path through the weeds; so far, this class looks to be a great guided tour balancing instruction with personal achievement. And it found me through Twitter.

As for screencasts, I learned in 2008 the power of a multimedia presentation style from Giles Bowkett. You may not like Ruby or programming, but his presentation at a Ruby conference is worth watching simply to understand how to win a crowd at the rate of around a slide every six seconds. Short screencasts, backed by transcripts and supporting materials, are to long term social influence for change as Twitter messages are to ephemeral, in-the-moment connection.
Building a decent screencast involves developing at least three new skills I don’t have. But thanks to the Creative Commons, it’s possible to start this learning from a much better vantage point than ever before.
Invest in Social Capital
Gary Vaynerchuk struck a chord with me with the insight that “social equity trumps private equity”. “I’d rather have a million friends than $10 million in capital,” @garyvee says. Seeing this with Twitter-era eyes, I don’t necessarily need them to be friends as much as I need them feeding the intake valves of my social filters so that the great ideas find me. Go long serendipity.
The 2009 plan to start down this road is simply:
- Contribute one thoughtful comment per day.
- Construct one reasoned blog post per week.
- Make one insightful tweet per day.
- Write one review (book, movie, tech) per month.
Invest in “Too Small to Fail”
Howard Lindzon said it best: I am TOO small to FAIL!
Being too small to fail means staying lean, not overcommitting, focusing on skills, finding efficiency of purpose, and looking for the highest return with what you have on hand and can build with your own hands. And in 2009, it also means survival, developing options and thinking about alternate income streams.
This is an ongoing process, and to be agile will require adjusting what it means to be too small to fail throughout the year. But for starters:
- Get something in the iPhone App Store.
- Follow through on a couple of StockTwits oriented projects I have in mind.
In terms of writing an iPhone app, I have no idea yet how much of a commitment it will take to complete even a simple one. If it’s on the order of a few hundred hours of spare time, I could pull it off. More than that, then it shifts more towards personal needs.
The StockTwits idea is simple (if not dull): make one trade a week based on ideas gleaned from StockTwits, and transparently document and blog the results. StockTwits seems to be proving its value to daytraders and swingtraders; this project would seek to answer the question of whether it can be used for gain by someone who can’t sit in front of a trading app during market hours. I have a chunk of my too small to fail portfolio to use for this purpose—with the extreme volatility of the last three months, I’ve managed to increase this small amount significantly, with some small props to StockTwits for help and ideas.

At scale, prognostication is a con game, and while we kid ourselves that the social filter makes finding gurus easier, simple probability says that in a million-voice field of 50/50 pickers, there’ll be one voice that through nothing more than luck hits 20 in a row, and there’ll be thirty who are sitting on 15-trade winning streaks on luck alone. What does that leave us with? The lesson is not to look at trades, but to look for ideas, the serendipitous connection that pushes you closer to your goals, whatever they are.
So in 2009, I’m going long serendipity, building social capital, developing skills and staying too small to fail.
(photos used via CC:SA licensing from William Hook and Lisa Brewster)
February 10th, 2008 — code, games, software
The first non-trivial source code I ever read was a Basic listing of an Apple II game called Tuesday Night Football. TNF pitted you against a computer coach in a strategic, text-based duel of American football play calling. We huddled around the green Apple II CRT, trying to outwit the wily computer coach. We became convinced it cheated. We set out to rectify the situation, and the source code was the key.
A Brief History of Being Cheated at Football and Other Games of Chance
The first football game I ever owned was Mattel’s Talking Football. Not the later “Monday Night Talking Football”. Just plain old Talking Football. You got a big box, a cardboard field, a little record player that looked like a red cassette player, and the gramophonic intonations of Dick Enberg calling the plays. The box became the stadium no detail was spared. The game even came with a plastic yellow coin for the opening coin toss.

The offensive coach picked the play, for example “Short Pass”, or my personal favorite, the high-risk, high-reward “Gadget” play, inserted the disk into the red “sportscaster”, and the defensive player looked at the back of the disk and rotated it until the specific defensive alignment was chosen, for example, “Prevent Defense”. Then you’d flip the switch to start the record player and listen the result: “Pass over the middle…intercepted!…he’s going to go all the way…TOUCHDOWN!” Or one I can still remember today with its pregnant pause and sudden reversal “Prevent defense, three man rush, trap up the middle for ten…uh oh…penalty.”
There were about 70 combinations of plays and defenses, and one Christmas my older brother, then in grad school as a T.A. for stats courses, calculated the expected value of each defensive and offensive play selection and routinely beat me. This was typical of the competitive torment I endured at the hands of someone with an understanding of probability and statistics which dwarfed my second grade math skills. Once he crushed me in Milton Bradley’s Game of Life by carefully observing the tendency of the spinning wheel’s non-random distribution. As he rolled up on the Day of Reckoning, he opted for the rarely used attempt at becoming a MILLIONAIRE TYCOON. From the instructions (warning: PDF):
Try to become a MILLIONAIRE TYCOON. If you have little or no money, place all that you have (your car if you’re broke) on ONE number on the number strip. Spin again. If you’re sic number comes up, you have become a MILLIONAIRE TYCOON, the WINNER and the game is over. If you lose, the bank takes your money, and you sit out the rest of the game at BANKRUPT.
So he lays it all down on #3, spins and bam, 3 comes up and the frustrating hour of spinning and trying to stuff little pink and blue pegs into those cars goes down the drain. The one in ten chance might as well have been a one in a million chance. That’s still as close to a lottery winner as I’ve ever been.
Subprime crisis, Milton Bradley style. One minute you’ve got a car, six kids stacked up in the back and not a dime to your name, and the next minute you’re a winner.
Fixing What Ailed Us
Fast forward about eight or nine years and I come across the listing for Tuesday Night Football from a copy that a friend apparently cracked. Our relationship with the game was love/hate all the way: because while it made for an entertaining and addictive game, some bug in the code caused way too many fumbles to occur for our tastes. If I recall correctly, each play had about a 5% probability of a fumble; and either a logic bug or a problem with the pseudorandom number generator caused every fumble to be lost by the human coach, while the computer only occasionally lost a fumble. This was an easy fix to make, but what was notable was that in just a few pages of code, a plausible football game could be created. I remember seeing the listing on green and white fanfold paper and thinking, I could do that. When I later got my own Apple IIc, I modified the code to create a more balanced game. And by more balanced, I mean one that probably tilted more in my favor.
Searching for Tuesday Night Football
I set out last night to see if I could find the source code for Tuesday Night Football to confirm whether my recollections were accurate. Were we just complainers who couldn’t handle getting beat fair and square? Or were we right, that the fumble issue was a bug and not a feature? Although I found a disk image that I believe contains the program, and a host of Apple II emulators that might actually run it, I haven’t been able to locate the actual TNF source or even get the original game to run successfully in an emulator.
So Dear Lazyweb, if you’re out there, and you’re an Apple II fanatic who has the Basic source code for Tuesday Night Football, I would love to get a look at it again for research purposes.
update… More digging led me to the author of the original Tuesday Night Football, Charlie Anderson, and some artifacts related to the original version. It appears that after a brief life being sold through Apple dealers with mimeographed manuals and a disk stuffed in a plastic bag, Mr. Anderson was offered the sum of $1000 against 10% net royalties to assign the copyright of the game to Automated Simulations, Inc., which rechristened it as Tuesday Morning Quarterback. What are the chances that the source survives?
January 29th, 2008 — code
From E.M. Forster’s Aspects of the Novel
:
Another distinguished critic has agreed with Gide—that old lady in the anecdote who was accused by her nieces of being illogical. For some time she could not be brought to understand what logic was, and when she grasped its true nature she was not so much angry as contemptuous. ‘Logic! Good gracious! What rubbish!’ she exclaimed. ‘How can I tell what I think till I see what I say?’ Her nieces, educated young women, thought she was passe; she was really more up to date than they were.
And Giles Bowkett’s Let the System Design Itself
And it literally happens like that. If you’re building design-first, you’re saying, “The system will do XYZ – I’ll put that here.” But just because you know it’ll do XYZ, you don’t necessarily know how or where, and deciding ahead of time imposes an arbitrary and unnecessary structure on your code. So then you have a file called XyzFile, which is supposed to do XYZ, and then you have other code elsewhere in the system which actually does XYZ, and it’s in some other file, because the design you imagined will always be different from the design which emerges. It’s like coding in Java. There’s the structure of your actual program, and the structure that Java requires you to accommodate. That second structure is just unnecessary mental overhead, and the bigger your system gets, the more wasteful that overhead is. You’ll have a structure that emerges naturally, whether you want to or not. It’s as inevitable as gravity. You might as well just let the macro follow the micro, like it’s supposed to, and get the good design which emerges naturally as a byproduct of that process.
Forster uses the anecdote to point out how the meaning of the work emerges from the act of writing, much in the same way that Bowkett illustrates how good design, if good design exists at all, naturally emerges from the act of writing the code.
And perhaps in this connection exists a new mantra for agile programming: how can we know the software’s design until we see how it’s coded?
November 1st, 2007 — code
As previously discussed, many of the popular links on del.icio.us tagged toread contained numbers in the titles. Now this can be quantified:

The sparkline above (courtesy Joe Gregorio’s sparklines service) shows the trend of the sum of numbers found in the titles of links in the del.icio.us/popular/toread feed over the last 14 days. (From what I can tell, the popular lists are recalculated about every 4 hours, so each bar represents one sample from each four hour period.) The sum is calculated by a Ruby script that periodically grabs the RSS feed for the popular/toread tag, taking any representation of a number from a title in the feed (e.g.,10, Ten, 101, 2001) and adding it to the total.
The numbers for the last two weeks:
Min: 89.5
Max: 2324.5
Mean: 697.47
Mode: 380
Median: 379
Coming soon…a way you can make a game out of this.