Automating TLH at Vanguard

Discuss all general (i.e. non-personal) investing questions and issues, investing news, and theory.
Post Reply
User avatar
car733
Posts: 100
Joined: Sun Feb 25, 2018 10:07 am
Location: Chicago, IL

Automating TLH at Vanguard

Post by car733 » Mon Aug 13, 2018 11:36 pm

Hello!

I've been toying with the idea of automating TLH at Vanguard for a while.
I just finished the most basic functionality inside a Userscript and I am sharing it just in case someone else is interested.

What it does so far:

1) When you visit https://personal.vanguard.com/us/XHTML/ ... mary.xhtml it shows a TLH button next to the Buy | Sell. (Sample)


2) When you click it, it will go through all the instrument lots and sum the reds. (Sample)


I wrote the logic as a Tampermonkey script (https://tampermonkey.net/).
You will need to install the plugin to your browser and add the following script:
https://pastebin.com/9408GVKH

Code is licensed under MIT:
Copyright 2018 car733

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Scooter57
Posts: 782
Joined: Thu Jan 24, 2013 9:20 am

Re: Automating TLH at Vanguard

Post by Scooter57 » Tue Aug 14, 2018 9:55 am

How wise is it to install a plugin to your browser that could potentially be harvesting your Vanguard login and account info and directing it elsewhere?

Mind you, I'm not saying this one does that but without reading the code a person would have no way of knowing.

User avatar
car733
Posts: 100
Joined: Sun Feb 25, 2018 10:07 am
Location: Chicago, IL

Re: Automating TLH at Vanguard

Post by car733 » Tue Aug 14, 2018 10:40 am

Scooter57 wrote:
Tue Aug 14, 2018 9:55 am
How wise is it to install a plugin to your browser that could potentially be harvesting your Vanguard login and account info and directing it elsewhere?
100%! Everyone should do their research.
If you can't read code, read about how secure tampermonkey is. Hint: It requires additional permissions to do outgoing requests. This script does not have it, so no information leaves your browser.

livesoft
Posts: 62294
Joined: Thu Mar 01, 2007 8:00 pm

Re: Automating TLH at Vanguard

Post by livesoft » Tue Aug 14, 2018 11:06 am

I recommend you sell this idea to Vanguard. They need all the help they can get.
Wiki This signature message sponsored by sscritic: Learn to fish.

H-Town
Posts: 1231
Joined: Sun Feb 26, 2017 2:08 pm

Re: Automating TLH at Vanguard

Post by H-Town » Tue Aug 14, 2018 11:46 am

It's cool but how much does that help? You can pull out a 10-key and total up your short-term loss, right? You still need to have a strategy for TLH: which lot to sell, which ETF to replace, and how much, etc.

User avatar
car733
Posts: 100
Joined: Sun Feb 25, 2018 10:07 am
Location: Chicago, IL

Re: Automating TLH at Vanguard

Post by car733 » Tue Aug 14, 2018 11:54 am

thangngo wrote:
Tue Aug 14, 2018 11:46 am
You still need to have a strategy for TLH: which lot to sell, which ETF to replace, and how much, etc.
I am doing my first steps with TLH. So far, my process is the following:
- Go to cost basis
- Sum the quantity of the losses
- If the loss amount feels enough, so far +20usd, I create an order

And that's true, I haven't automated what to buy, check for wash sales, etc. This is just a first step, it just covers the summing losses part.

thangngo wrote:
Tue Aug 14, 2018 11:46 am
You can pull out a 10-key and total up your short-term loss, right?
mmm what's a 10-key?

H-Town
Posts: 1231
Joined: Sun Feb 26, 2017 2:08 pm

Re: Automating TLH at Vanguard

Post by H-Town » Tue Aug 14, 2018 12:40 pm

car733 wrote:
Tue Aug 14, 2018 11:54 am
thangngo wrote:
Tue Aug 14, 2018 11:46 am
You still need to have a strategy for TLH: which lot to sell, which ETF to replace, and how much, etc.
I am doing my first steps with TLH. So far, my process is the following:
- Go to cost basis
- Sum the quantity of the losses
- If the loss amount feels enough, so far +20usd, I create an order

And that's true, I haven't automated what to buy, check for wash sales, etc. This is just a first step, it just covers the summing losses part.

thangngo wrote:
Tue Aug 14, 2018 11:46 am
You can pull out a 10-key and total up your short-term loss, right?
mmm what's a 10-key?
A calculator.

User avatar
car733
Posts: 100
Joined: Sun Feb 25, 2018 10:07 am
Location: Chicago, IL

Re: Automating TLH at Vanguard

Post by car733 » Tue Aug 14, 2018 12:43 pm

thangngo wrote:
Tue Aug 14, 2018 12:40 pm
A calculator.
I thought it was a form or a way to download the cost basis information :oops:
I could use a calculator, but I trust my code more than my fat fingers :)

H-Town
Posts: 1231
Joined: Sun Feb 26, 2017 2:08 pm

Re: Automating TLH at Vanguard

Post by H-Town » Tue Aug 14, 2018 12:45 pm

car733 wrote:
Tue Aug 14, 2018 12:43 pm
thangngo wrote:
Tue Aug 14, 2018 12:40 pm
A calculator.
I thought it was a form or a way to download the cost basis information :oops:
I could use a calculator, but I trust my code more than my fat fingers :)
Haha fair enough. I trust my excel as I use it to make decision on TLH orders.

User avatar
car733
Posts: 100
Joined: Sun Feb 25, 2018 10:07 am
Location: Chicago, IL

Re: Automating TLH at Vanguard

Post by car733 » Tue Aug 14, 2018 12:46 pm

thangngo wrote:
Tue Aug 14, 2018 12:45 pm
Haha fair enough. I trust my excel as I use it to make decision on TLH orders.
How do you copy information from the cost basis page to your excel?

H-Town
Posts: 1231
Joined: Sun Feb 26, 2017 2:08 pm

Re: Automating TLH at Vanguard

Post by H-Town » Tue Aug 14, 2018 1:46 pm

car733 wrote:
Tue Aug 14, 2018 12:46 pm
thangngo wrote:
Tue Aug 14, 2018 12:45 pm
Haha fair enough. I trust my excel as I use it to make decision on TLH orders.
How do you copy information from the cost basis page to your excel?
I keep track of cost basis on excel. Every time I download confirmation of a buy order, I convert PDF to Excel and import it to my spreadsheet. It's not that I don't trust Vanguard, it's just my way to cross checking their accounting and record keeping system.

For you question, you can save PDF as Excel. There might be some excel manipulation to get it to work.

There's other approaches: set up Alert with Vanguard https://investor.vanguard.com/investing/alert-messaging or follow "U.S. stock in freefall" topic :mrgreen:

Your method is pretty cool as well.

User avatar
car733
Posts: 100
Joined: Sun Feb 25, 2018 10:07 am
Location: Chicago, IL

Re: Automating TLH at Vanguard

Post by car733 » Tue Aug 14, 2018 10:55 pm

thangngo wrote:
Tue Aug 14, 2018 1:46 pm
I keep track of cost basis on excel. Every time I download confirmation of a buy order, I convert PDF to Excel and import it to my spreadsheet. It's not that I don't trust Vanguard, it's just my way to cross checking their accounting and record keeping system.
Interesting! Thanks for sharing.
How do you decide what to buy? How do make sure you don't make a wash sale?

Post Reply