How to Import your Tastyworks trades into Google Sheets

First, you need to create a Google Sheet. This is done by going to http://docs.google.com/sheets. If you do not have a Google account, you will be required to sign up for one.

Once you have created a new Google Sheet, open the script editor under the Tools menu.

openscripteditor

This will open a new tab with an editor and create a Google Script file that is associated with your Google Sheet. Now copy the Google Script code at the link below and past it into the editor.

Get the Google Script Here

scripteditor

After copying the script into the editor, make sure you click the save icon. You will then go into the Tastyworks platform and export a CSV file from your portfolio page.

You first need to make sure the following columns are added to your portfolio page.

“Delta Per Qty” “Net Liq” “Cost” “Days to Expiration”

When you export the CSV file save it to your computer.

csvexport

Once you have saved the CSV file, you will need to change the filename to firebyarthur.csv and upload it to your Google drive. This can be found at http://drive.google.com (again, you will need your Google account for this).

Note: The Google Sheet script will be able to find the CSV file with that name anywhere on your Google drive. So it doesn’t matter where you put it.

Now you will need to close your Google Sheet and reopen it. This is because the action of opening the Sheet will run the onOpen() method that is now within the script you pasted into the editor, and that method creates the Trading Integrations | Load Positions CSV menu at the top of the sheet.

loadcsv

When you select “Load Positions CSV” for the first time, you will need to authorize the script to run. I invite you to browse through the script to ensure that it’s not going to do anything bad. This is your script now, and I take no responsibility for it.

authorize

So if you want to authorize YOUR script, you will click “Continue.”

You would also need to click “Advanced” and click “Go to . . . .” to trust the script.

authorize2

If you have trusted this script and let it run, it will load the positions from your CSV file into a new tab called “Open Positions.” (You can delete the original default tab)

From that point on, anytime you upload a new CSV file to your Google drive and run the script from the Sheet menu, it will update the existing positions, add any new ones, and move the ones that have been closed to a “Closed Positions” tab.

importedsheet

If you roll a trade, you will want to keep track of how much additional credit you get from the roll and enter that in one of the Adj Credit… columns for that stock. Then when you reload a CSV file, the current amounts for the underlying will be up to date and the roll credit will be calculated into your total position P/L.

Now you can customise your Google Sheet however you want, the column order just has to stay the same.

finalsheet

You will notice I only keep track of one line for each stock with totals for my position, so if you want to have individual options listed, you will need to modify the script to add that in.

And that’s it!

If I add more features, I will be sure to provided an updated script. If you are interested in a full featured trade tracker and position analysis service, be sure to check out Ben Latz’s Wingman product.

Have fun and happy trading!

-J. Arthur Squiers

Advertisements