GithubHelp home page GithubHelp logo

bdf0506 / schwab-googlesheets Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 13 KB

Script add in for Google Sheets to pull in Charles Schwab account trading data in via their API

JavaScript 89.71% HTML 10.29%

schwab-googlesheets's Introduction

schwab-googlesheets

Script add in for Google Sheets to pull in Charles Schwab account trading data in via their API

Credits go to the following for laying the groundwork on the TD API to Google Sheets, which has been heavily modified to support the new Schwab API.

@santsleo https://github.com/santsleo/AmeritradeAPIonGoogleSheets

@kohjb https://github.com/kohjb/AmeritradeAPIwGoogleScripts

To use:

Set up the Schwab API:

  1. Sign up for a developer account from https://developer.schwab.com/register
  2. Create an app that uses the Trader API - Indidual, Account and Trading Production.
  3. Set the callback URL to https://127.0.0.1 and save.
  4. You'll need to wait until the app changes to "Ready for Use" before things will work - this can take some time, maybe a week or more.
  5. Grab the App Key and Secret from your app, as you will need this later.

In Google Sheets:

  1. Create a new sheet, and navigate to Tools > Script editor
  2. Add the 2 files from this repository into Files on the left side, and save.
  3. Go to Project Settings and navigate to the script properties section. Add a script property of "schwab_apikey" and enter your App Key from the Schwab app, and then add a script property of "schwab_secret" and enter your Secret from the Schwab app.
  4. Go to Schwab.gs, and click run. Google will make you approve this app to run.
  5. Exit script editor and back on the Google Sheet, you should now see a panel on the right side. If you don't see the right panel, go to Schwab API > Authenticate. Click on the link in the panel to login.
  6. Go through the login process to authorize this to connect to your Schwab account. You will be rerouted to a dead link, which is expected. Copy the URL that is now showing in the address bar.
  7. Paste the URL into Response text and then click the Step 2 button. The script will properly extract your code in the URL and get the needed refresh and access tokens.
  8. Now that your account is connected and you can start to call functions from the Google Sheet itself.

Functions available:

  • schwab_Positions
  • schwab_Balance
  • schwab_GetQuote

Easiest way to simply test that it is working, is to enter "=schwab_Positions()" into a single cell and press enter. Your current positions should now be shown in the Google Sheet.

Note:

Unlike the TD Ameritrade API where you only had to authenticate every 90 days, the Schwab API makes you authenticate every 7 days! Poor design of their API, but have not found any workaround to this yet.

schwab-googlesheets's People

Contributors

bdf0506 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.