Using Twitter API to beat the (Wall) Street

I made a killer trade the other day. And it came from a buy signal on a side project. It showed me that Instagram was cannibalizing Twitter image traffic over time. Let me walk you through it.

Tweet Farmer

I’ve been farming tweets from cities for years now. They’ve spun out into experimental projects like Urban Events and New Tweet City. When investigating Twitter media, it became apparent that many tweets were actually links to Instagram (IG).


  "id": 703309386622615600,
  "text": "I captured every level of drunk last night 📷🍺 @ 6th Street, Austin, TX",
  "source": "<a href=\"\" rel=\"nofollow\">Instagram</a>",
  "entities": {
    "urls": [{
        "url": "",
        "display_url": "" //Important!

This tweet, despite being all text, has a URL and contains media at the end of the tunnel. So I grabbed the Instagram image and reclassified the tweet as image in my system:

Level Of Drunk
  "mediaType":"image", *Important*
  "mediaUrl":"", //instagram
  "text":"I captured every level of drunk last night 📷🍺..."

How many Images were actually Instagram?

I had to know. Fortunately, all my tweets lived in Elasticsearch, which has a data visualization tool called Kibana. I charted the number of media tweets that were actually Instagram links per city. Let’s start with a look at New York City below:

Twitter NYC Stacked

Man, that’s a lot of Instagram. Let’s check it out as a percentage.

Twitter NYC Percentage

Peaked at 92%! So here’s where I give you the disclaimer about which tweets I’m analyzing. This is only applicable to geotagged tweets with media. After all, if it’s not geotagged I can’t tell if it’s coming out of NYC.

Let’s take a look at some other cities:

Twitter Cities Percentage

Shout out to LA for only having 64% of traffic from Instagram. So on Twitter’s best day, it only had 36% of images on its own platform.


How did Wall Street come in?

I’ve been getting fleeced by the TWTR stock for a while now, even while having this knowledge months ago. I knew of this in the Summer of 2015, when TWTR was $51 (it’s now $17), and did nothing. I was reluctant to use the Twitter API as a buy or sell signal on the stock. My finance world and my development world were completely distinct. And then this happened.

Venn Epiphany

It seems obvious now, but I never went into my side projects to discover signals. Looking at the information, the perfect trade would have been a pair trade shorting TWTR and buying FB (owner of Instagram). But I felt I had missed the boat on TWTR. I actually hadn’t, but I’ve been burned by bottom fishing before and I wasn’t going to do that again. Not me, no sir.

Then in January, I landed on this nugget of information about Instagram:

We’re excited to announce that starting this month, advertisers both large and small can run campaigns on Instagram. In addition, ads are now available in more than 30 new countries—including Italy, Spain, Mexico, India and South Korea—and will be launching in markets around the world on Sept. 30.

September 30th 2015. This means that FB Q4 Earnings, released in January, would be the first earnings release with IG ad revenue for a full quarter. My, my are the stars aligning! Couple this with some napkin math on their estimates (translation: pure speculation), I was going in for the buy.

Buying options for leverage

Facebook Options Confirmation

It’s not a game anymore. The options had a strike price of $99 and cost me just under $900 (that’s all I risked, I know, don’t tell me about it).

When the market bell closed on the 28th, FB stock dipped to $94.50. GG y’all, 🍻, this was fun.

And then earnings were released. It spiked up to as high as $112. I waited until the next morning and I was out of there:

Facebook Call Options BOOM

Exercising 300 FB shares became $32,748, I got my first margin call and needed to shore up some cash. I just dumped the shares and took home a profit of around $3k, just over 300% of the initial ~$900.

Don’t forget the context!

Remembering the context of all this is important. Before 2016, Twitter’s outlook wasn’t so bleak. In December 2014, a Twitter exec threw this jab

Twitter co-founder Evan Williams: ‘I don’t give a shit’ if Instagram has more users

Now add a finding that claims a majority of your image traffic belongs to your rival. Perhaps they’ll say Twitter has always been about the 140 character tweet. After pushing Moments, unlikely.

All of that for only $3K

It was by far the surest I had ever been that a stock would pop on earnings, and I was timid. I needed some Wolf of Wall Street that day and I didn’t have it. But you always say that after a successful trade. It was a great experience and I’m hoping that the stars will align again, but I’ve accepted that it might not happen for months, quarters, or even years.

comments powered by Disqus