I recently began using Robinhood to purchase and sell stocks. I love Robinhood, as it offers a 100% free, legite, no-gimmick way to buy and sell stock (they make their money from interest on uninvested funds), but I wanted to put my purchases into a spreadsheet so I could track them easier. Typing that data in automatically would be a pain and I didn’t want to do it with every transaction. Fortunately, Robinhood sends a confirmation email with the details of each transaction, so, with the magic of IFTTT, Launch Center Pro, Workflow, and Google Sheets, I was able to create a workflow that does this automatically with one tap.

Here’s the overview:

An IFTTT recipe finds the Robinhood email and sends the text to Launch Center Pro Launch Center Pro gives me a notification on my phone that, when tapped, sends the text into Workflow Workflow parses the email into variables for date, stock symbol, stock price, purchase/sale, calculates the total value, and sends it to IFTTT IFTTT then places the data into a Google spreadsheet where I can do what I please with the data

In detail, here’s what that looks like:

Gmail to IFTT

IFTTT is able to look at Gmail and search for specific criteria to match in an email. Using a search for emails from Robinhood (notifications@robinhood.com) which contain the subject heading “Your order has been executed,” I am able to get the recipe to trigger only on emails containing a Robinhood sale/purchase. (If you don’t use Gmail, the Workflow portion below will still work, which you can access via share extension. Since Mail.app doesn’t support such an extension, I recommend Dispatch or Airmail).

Next, IFTTT sends that data to Launch Center Pro. By setting up a custom URL scheme that treats the text of the email as a variable, I can use IFTTT to send the text to my device via Launch Center Pro (available for iPhone and iPad).

You can download this IFTTT recipe here. You’ll need to ensure that the custom URL scheme contains the right identifier for your workflow. You will need to insert the name of the Workflow on your device into the IFTTT custom URL scheme. This is the nerdiest section of this system, but if you follow the steps below, it shouldn’t be too hard.

If you download the Workflow flow below and do not change its name, I believe that the custom URL scheme in the IFTTT recipe will work. I am unable to test this without a separate account, though (please let me know if you test it and it does not work). My custom URL scheme in the IFTTT recipe should be: workflow://run-workflow?name=Parse%20Stocks&id=941783C6-FA16-40FC-9775-5E9AF7C90702&input=(({{BodyPlain}}))

If that does not work, you’ll need to change it in these steps:

Find your Workflow identifier. If you know how to do that, skip to the next step. If you don’t, follow these sub-steps: Open the Workflow app to the Workflow you downloaded. Click the gear icon, then add it to Launch Center Pro. Open Launch Center Pro and tap “edit” actions. Select the one you just added. In the URL field, you’ll see something like this: workflow://x-callback-url/run-workflow?name=Parse%20Stocks&id=941783C6-FA16-40FC-9775-5E9AF7C90702&x-source={{Launch Center Pro}}&x-success={{launchpro://}} Take the part between “name=” and “&x-source” (the part bolded above). That is the Workflow identifier Add the Workflow identifier into the IFTTT custom URL scheme. It should go in between “name=” and “&input” so that it replaces the bolded text below: workflow://run-workflow?name=Parse%20Stocks&id=941783C6-FA16-40FC-9775-5E9AF7C90702&input=(({{BodyPlain}})) Double check that you have kept the &input=(({{BodyPlain}})) exactly as shown, or else it won’t pass the email text into Workflow and that will defeat the entire point.

Launch Center Pro to Workflow

The IFTTT recipe is set up to give you a Launch Center Pro notification as part of the recipe (note: this is different than an IF notification when the recipe is run. You don’t need that). When you tap the notification, it will trigger the URL scheme which will open Workflow to the correct flow and pass the email text in as input.

To get the URL scheme to fire correctly, you will need to have the app Workflow (HIGHLY recommended) and download this flow.

Workflow to IFTTT

As part of the Club MacStories newsletter (which is awesome, BTW), Federico Viticci made me a flow for the app Workflow that uses regex to isolate the variables, do some price calculations based on the data, and then preps it for my IFTTT recipe based on whether it was a stock purchase or sale.

In the last action, Workflow triggers IFTTT. To get that to work, you’ll have to set up the IFTTT recipe below and connect it to the workflow.

You can download the Workflow flow here.

IFTTT to Google Sheets

Workflow sends the data to IFTTT which then uses this recipe to enter that data into a Google Drive Sheets spreadsheet. This recipe is set up to input 8 different variables into a Google Spreadsheet: Date, stock symbol, number of shares bought, average price of purchased shares, total price of purchased shares, number of shares sold, average price of sold shares, and total price of sold shares. The workflow is set up to correctly put the data into the right column. Here’s an example of the spreadsheet I use, but you can adapt it however you want. Just make sure to change the IFTTT recipe and the workflow to send the data to the right place.

You can download the IFTTT recipe here

You can see the Google Sheet here

Conclusion

That’s it! Once you install all the pieces, each time you buy or sell a stock with Robinhood, you will get a notification and, with one tap, you can enter that information into a spreadsheet to analyze to your heart’s content!

You can subscribe to markdmill.com via RSS, Tumblr or by following MarkDMill on Twitter.

All download links:

* Robinhood app

* IFTTT app

* IFTTT recipe from Gmail to Launch Center Pro

* Launch Center Pro for iPhone OR Launch Center Pro for iPad

* Workflow app

* Workflow flow

* IFTTT recipe from Workflow to Google Sheets

* Google Drive Sheets app

* Sheets spreadsheet example