Unofficial Schwab API wrapper in Python 3.
Project description
Schwab API
This is not an official API or even a stable recreation of a Charles Schwab API. Functionality may change with any updates made by Schwab.
This package enables buying and selling securities programmatically on Charles Schwab using Playwright. Essentially, this package uses headless Chromium to automate the clicks and inputs; it does NOT use web requests (though I'd love to change the code to do so).
Contribution
I would absolutely love contributions; as someone new to open source, I'd appreciate help in setting up a reliable system for PRs as well :)
Getting Started
Installing
Install using pypi and then download and install the playwright binaries:
pip install schwab-api
python -m playwright install
Quickstart
Here's some code that logs in and makes a stock purchase:
from schwab_api import Schwab
# Initialize our schwab instance
# We can only have one instance running at a time
api = Schwab.get_instance(
username=username,
password=password,
user_agent=user_agent
)
# Login
# First-time setup: you will need to enter an SMS confirmation code as input
api.login()
# Make a trade
api.trade(
ticker="ticker",
side="Buy", ## or "Sell"
qty=1
)
Documentation
There is currently no documentation. If there is traction or demand, I will slowly add this in.
Features
- Buying and Selling tickers
- Multiple individual account support
- Persistent authentication (after an initial MFA setup)
- Headless playwright implementation
Todo
- Other functions beyond just trading
- Account information
- Position information
- More advanced trading functions
- Get this setup on a VM or a cloud function
- Randomize and humanize every click and input interaction
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for schwab_api-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2760479e7fcd8b0219e4a73e16fbe5758f211a611f16bc1505367626f41755f5 |
|
MD5 | 19574c467f516e4e3eedac6f22747a6d |
|
BLAKE2b-256 | 56747c5f4cb219103eb3438db72f81cdf7332e37332a02102a76a1bade3de05e |