Skip to content

This is an unofficial interface to make getting started the Schwab API easier.

Notifications You must be signed in to change notification settings

charleswwilson/Schwab-API-Python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Schwab-API-Python

This is an unofficial python program to access the Schwab api.
You will need a Schwab developer account here.
Join the Discord group

Quick setup

  1. Create a new Schwab individual developer app with callback url "https://127.0.0.1" and wait for approval.
  2. Python version 3.11 or higher is recommended.
  3. pip3 install requests websockets window-terminal
  4. Paste keys in modules/universe.py specifically tokens.appKey and tokens.appSecret.
  5. Start by running the main.py file.

What can this program do?

  • Authenticate and access the api (api.initialize())
  • Functions for all api functions (examples in main.py)
  • Auto "access token" updates (api.updateTokensAutomatic())
  • Stream real-time data (stream.startManual())
  • Automatically start/stop stream (stream.startAutomatic())

TBD

  • Automatic refresh token updates. (not started)
  • Customizable stream response handler (20% complete)

Usage and Design

This python client makes working with the TD/Schwab api easier.
The idea is to make an easy to understand, organized, and highly-automatic interface for the api.
Below is a light documentation on how it works, python is pseudocode-esk so if you are confused just read the code and follow the functions.

Organization

The modules folder contains code for main operations:

  • api.py contains functions relating to api calls, requests, and automatic token checker daemons.
  • tokens.txt contains api tokens as well as dates for when they expire.
  • universe.py contains universal variables that need to be accessed across many functions such as credentials, preferences, tokens, etc.
  • stream.py contains functions for streaming data from websockets.

License (MIT)

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.

About

This is an unofficial interface to make getting started the Schwab API easier.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%