How to Import your Tastyworks trades Into Google Sheets

If you defend trades by rolling, you’ll want to keep track of the total credits you have taken in during the lifecycle of that trade.

That was my inspiration for creating a Google Sheet.

But I didn’t want to manually enter numbers in a spreadsheet every time I made a trade. Thankfully Google Sheets allows you to use a scripting language to modify data in your spreadsheet (and perform many other tasks). So I wrote code that can import a CSV file from the Tastyworks platform.

Many folks have asked me to share my script for doing this, so I have provided full instructions and a copy of the code at the link below:

How to Import your Tastyworks trades into Google Sheets

Here is a look at my final result. Enjoy!

finalsheet

-J. Arthur Squiers

Advertisements

4 comments on “How to Import your Tastyworks trades Into Google Sheets

  1. The csv export doesn’t include closed/rolled trades even if you select closed to show from the positions tab

    Like

    • J. Arthur Squiers

      That’s correct. The import code detects if you have a position in the open tab of the spreadsheet, and if there is no longer a position in the csv file, it moves the position to the Closed tab. If you have rolled the position, the import will update the attributes of the position, and the original credit received, of course, won’t change. You do have to manually enter the extra credit you received from the roll in one of the adjustment columns so it knows the total credit you’ve received with the rolls and can calculate the profit of the overall trade.

      The spreadsheet does not look back at the historical trades from before you started importing.

      This works wonderfully for my trading, and can be modified if needed to fit yours. It’s a base to work with.

      Like

  2. Hello, unfortunately it´s not working that well for me. i only get two symbols out of five imported in the open tab. Ande the only other tab that´s created is the closed positions tab which is empty. i closed a position today so it shouldn’t find that one at least. what can be wrong with it?

    Like

    • I made a change in the code to this

      //Now loop through all symbols from import and add new rows for
      //the ones that don’t have open rows in the spreadsheet
      for (var key in netLiqHash) {
      if (spreadsheetContainHash[key] == null) {
      //Make sure it’s not just a closed position
      if (costHash[key] != 0) {
      var lastRow = sheet.getLastRow();
      if (lastRow == 0) {
      createOpenHeaders(sheet);
      lastRow = 1;
      }

      before it was if (costHash[key] > 0) {

      but i noticed from my csv that i had negative costs too. so i changed it and it now shows all my open positions.
      haven´t figured out the closed positions tab yet though.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: