Code Monkey home page Code Monkey logo

schwab-api-python's Introduction

Schwab-API-Python

PyPI - Version Discord PyPI - Downloads Donate YouTube Video Views
This is an unofficial python program to access the Schwab api.
Discord, PyPI, Youtube, Github.

Installation

pip install schwabdev requests websockets
You may need to use pip3 instead of pip

Quick setup

  1. Setup your Schwab developer account here.
    • Create a new Schwab individual developer app with callback url "https://127.0.0.1" (case sensitive)
    • Wait until the status is "Ready for use", note that "Approved - Pending" will not work.
    • Enable TOS (Thinkorswim) for your Schwab account, it is needed for orders and other api calls.
  2. Install packages
    • Install schwabdev and requirements pip install schwabdev requests websockets
    • You may need to use pip3 instead of pip
  3. Examples on how to use the client are in examples/api_demo.py | examples/stream_demo.py (add your keys in the .env file)
    • The first time you run you will have to sign in to your Schwab account using the generated link in the terminal. After signing in, agree to the terms, and select account(s). Then you will have to copy the link in the address bar and paste it into the terminal.
    • Questions? - join the Discord group.
import schwabdev #import the package

client = schwabdev.Client('Your app key', 'Your app secret')  #create a client

client.update_tokens_auto() #start the auto access token updater

print(client.account_linked().json()) #make api calls

What can this program do?

  • Authenticate and access the api
  • Functions for all api functions (examples in examples/api_demo.py)
  • Auto "access token" updates (client.update_tokens_auto())
  • Stream real-time data with customizable response handler (examples in examples/stream_demo.py)

TBD

  • Automatic refresh token updates. (Waiting for Schwab implementation)

Notes

The schwabdev folder contains code for main operations:

  • api.py contains functions relating to api calls, requests, and automatic token checker threads.
  • stream.py contains functions for streaming data from websockets.
  • color_print.py contains functions to print to the terminal with color.

Youtube Tutorials

  1. Authentication and Requests Github code has significantly changed since this video
  2. Streaming Real-time Data

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.

schwab-api-python's People

Contributors

tylerebowers avatar roninio avatar jrstrunk avatar skytech-cyber 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.