An add-on for Google Sheets that intagrates the TDAmeratrade api to get quotes, fundamental data, and a portfolio breakdown
- Create a TDAmeratrade dev account. Follow the instrctions on their Getting Started Guide.
- When it asks for a
Callback URI
usehttps://srichel.com/callback.html
- When it asks for a
- Within google sheets, click on
Tools
thenScript editor
- Delete anything that may have auto-generated
- Copy all the code in code.gs
- Paste everything into the google script editor
- Paste your TDAmeratrade API key in the quotes on line 1
- Click save and return to sheets
In order to get your portfolio and other price data you must log in to TDAmeratrade, here's how.
- On google sheets, in the top bar, click
TD Ameratrade
thenLog in
- You will be redirected to TDAmeratrade to login. After logging in, you will be redirected to a green webpage
- Click the
copy
button to copy your code - Back on google sheets, click on
TD Ameratrade
thenEnter code
- Paste the code into the box and hit
ok
- You are now logged in!
-
=TDA('ABC')
- gets last market price of a stock
-
=TDA('positions', 0)
- Gets all current postions and info on them. If you have multiple accounts use 1, 2, 3... insted of 0 to get those accounts positions
-
=TDA('ABC', 'quote', data)
- Gets quote data, possable inputs for data are:
- symbol
- description
- bidPrice
- askPrice
- bidSize
- askSize
- openPrice
- highPrice
- lowPrice
- closePrice
- netChange
- totalVolume
- exchange
- 52WkHigh
- 52WkLow
- divAmount
- divYield
- divDate
- Gets quote data, possable inputs for data are:
-
=TDA("ABC", "fundamental", data)
- Gets fundamental data possable inputs for data are:
- peRatio
- pegRatio
- pbRatio
- prRatio
- pcfRatio
- grossMarginTTM
- grossMarginMRQ
- netProffitMarginTTM
- netProffitMarginMRQ
- operatingMarginTTM
- operatingMarginMRQ
- returnOnEquity
- returnOnAssets
- returnOnInvestment
- quickRatio
- currentRatio
- intrestCoverage
- totalDebtToCapital
- ltDebtToEquity
- totalDebtToEquity
- epsTTM
- epsChangePercentTTM
- epsChangeYear
- epsChange
- revChangeYear
- revChangeTTM
- revChangeIn
- sharesOutstanding
- marketCapFloat
- marketCap
- bookValuePerShare
- beta
- Gets fundamental data possable inputs for data are: