In a normal day two months ago, I would never check the Dow Jones Industrial Average, but with the financial turmoil of recent weeks I’ve wondered more often whether we were getting in deeper or if things had bounced back at all, so I was checking too often. I usually went to CNBC’s home page.
Since I became a regular Twitter user, I’ve also checked that more frequently, and I’d been wondering about a good excuse to play with the Twitter API. I decided that a Twitter account that alerted me to big swings in the Dow would inform me about important news there when I checked Twitter, letting me skip the visits to cnbc.com. I used the python-twitter API to write a script that checks the Dow on Yahoo Finance and tweets if the figure has moved more than 50 points since the last tweet or since the day’s opening, whichever was more recent. I also scheduled a cron job to run this once an hour. (My host provider won’t let me schedule it any more often.) These days, 50 points doesn’t seem like a huge swing, but three or four tweets in one day tell me about big gains, big losses, or big volatility, and no tweets tells me that things are relatively calm.
It’s always nice when minimal coding around a REST-based API from a free service results in something genuinely useful. The account is called DJIA50, and I hope it’s useful to others as well.