``schwab-py``: A Charles Schwab API Wrapper
===========================================
.. image:: https://img.shields.io/discord/720378361880248621.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2
:target: https://discord.gg/BEr6y6Xqyv
.. image::
https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%TDAAPI%26type%3Dpatrons&style=flat
:target: https://patreon.com/TDAAPI
.. image:: https://readthedocs.org/projects/schwab-py/badge/?version=latest
:target: https://schwab-py.readthedocs.io/en/latest/?badge=latest
.. image:: https://github.com/alexgolec/schwab-py/workflows/tests/badge.svg
:target: https://github.com/alexgolec/schwab-py/actions?query=workflow%3Atests
.. image:: https://badge.fury.io/py/schwab-py.svg
:target: https://badge.fury.io/py/schwab-py
.. image::
http://codecov.io/github/alexgolec/schwab-py/coverage.svg?branch=master
:target: http://codecov.io/github/alexgolec/schwab-py?branch=master
What is ``schwab-py``?
----------------------
``schwab-py`` is an unofficial wrapper around the Charles Schwab Consumer APIs.
It strives to be as thin and unopinionated as possible, offering an elegant
programmatic interface over each endpoint. Notable functionality includes:
* Login and authentication
* Quotes, fundamentals, and historical pricing data
* Options chains
* Streaming quotes and order book depth data
* Trades and trade management
* Account info
I used to use ``tda-api``, how do I migrate?
--------------------------------------------
Now that TDAmeritrade is no more, the old ``tda-api`` library will no longer
work. Check out our `transition guide
<https://schwab-py.readthedocs.io/en/latest/tda-transition.html>`__ for
instructions on getting started.
How do I use ``schwab-py``?
---------------------------
For a full description of ``schwab-py``'s functionality, check out the
`documentation <https://schwab-py.readthedocs.io/en/latest/>`__. Meawhile,
here's a quick getting started guide:
Before you do anything, create an account and an application on the
`Charles Schwab developer site <https://developer.schwab.com/login>`__.
You'll receive an API key and app secret, which you can pass to this wrapper.
You'll also want to take note of your callback URI, as the login flow requires
it. You app must be approved by Schwab before you can use it (this can take
several days). You can find more detailed instructions `here
<https://schwab-py.readthedocs.io/en/latest/getting-started.html>`__.
Next, install ``schwab-py``:
.. code-block:: python
pip install schwab-py
You're good to go! To demonstrate, here's how you can authenticate and fetch
daily historical price data for the past twenty years:
.. code-block:: python
from schwab import auth, client
import json
api_key = 'YOUR_API_KEY'
app_secret = 'YOUR_APP_SECRET'
callback_url = 'https://127.0.0.1:8182/'
token_path = '/path/to/token.json'
c = auth.easy_client(api_key, app_secret, callback_url, token_path)
r = c.get_price_history_every_day('AAPL')
r.raise_for_status()
print(json.dumps(r.json(), indent=4))
Why should I use ``schwab-py``?
-------------------------------
``schwab-py`` was designed to provide a few important pieces of functionality:
1. **Safe Authentication**: Schwab's API supports OAuth authentication, but too
many people online end up rolling their own implementation of the OAuth
callback flow. This is both unnecessarily complex and dangerous.
``schwab-py`` handles token fetch and refreshing for you.
2. **Minimal API Wrapping**: Unlike some other API wrappers, which build in lots
of logic and validation, ``schwab-py`` takes raw values and returns raw
responses, allowing you to interpret the complex API responses as you see
fit. Anything you can do with raw HTTP requests you can do with
``schwab-py``, only more easily.
Why should I *not* use ``schwab-py``?
-------------------------------------
As excellent as Schwab's API is, there are a few popular features it does not
offer:
* While Charles Schwab owns `thinkorswim (AKA TOS)
<https://www.schwab.com/trading/thinkorswim/desktop>`__, this API is
unaffiliated with it. You can access and trade against the same accounts as
TOS, but some of TOS's functionality is not supported by ``schwab-py``
* Paper trading is not supported
* Historical options pricing data is not available.
What else?
----------
We have a `Discord server <https://discord.gg/BEr6y6Xqyv>`__! You can join to
get help using ``schwab-py`` or just to chat with interesting people.
Bug reports, suggestions, and patches are always welcome! Submit issues
`here <https://github.com/alexgolec/schwab-py/issues>`__ and pull requests
`here <https://github.com/alexgolec/schwab-py/pulls>`__.
``schwab-py`` is released under the
`MIT license <https://github.com/alexgolec/schwab-py/blob/master/LICENSE>`__.
**Disclaimer:** *schwab-py is an unofficial API wrapper. It is in no way
endorsed by or affiliated with Charles Schwab or any associated organization.
Make sure to read and understand the terms of service of the underlying API
before using this package. This authors accept no responsibility for any
damage that might stem from use of this package. See the LICENSE file for
more details.*
Raw data
{
"_id": null,
"home_page": "https://github.com/alexgolec/schwab-py",
"name": "schwab-py",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "finance trading equities bonds options research",
"author": "Alex Golec",
"author_email": "bottomless.septic.tank@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a8/a7/196ab8a8e83c83894f8f4afefc5c3b48fc66d4cea78d5dfffe3b506127a1/schwab_py-1.4.0.tar.gz",
"platform": null,
"description": "``schwab-py``: A Charles Schwab API Wrapper\n===========================================\n\n.. image:: https://img.shields.io/discord/720378361880248621.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2\n :target: https://discord.gg/BEr6y6Xqyv\n\n.. image:: \n https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%TDAAPI%26type%3Dpatrons&style=flat\n :target: https://patreon.com/TDAAPI\n\n.. image:: https://readthedocs.org/projects/schwab-py/badge/?version=latest\n :target: https://schwab-py.readthedocs.io/en/latest/?badge=latest\n\n.. image:: https://github.com/alexgolec/schwab-py/workflows/tests/badge.svg\n :target: https://github.com/alexgolec/schwab-py/actions?query=workflow%3Atests\n\n.. image:: https://badge.fury.io/py/schwab-py.svg\n :target: https://badge.fury.io/py/schwab-py\n\n.. image:: \n http://codecov.io/github/alexgolec/schwab-py/coverage.svg?branch=master\n :target: http://codecov.io/github/alexgolec/schwab-py?branch=master\n\nWhat is ``schwab-py``?\n----------------------\n\n``schwab-py`` is an unofficial wrapper around the Charles Schwab Consumer APIs. \nIt strives to be as thin and unopinionated as possible, offering an elegant \nprogrammatic interface over each endpoint. Notable functionality includes:\n\n* Login and authentication\n* Quotes, fundamentals, and historical pricing data\n* Options chains\n* Streaming quotes and order book depth data\n* Trades and trade management\n* Account info\n\nI used to use ``tda-api``, how do I migrate?\n--------------------------------------------\n\nNow that TDAmeritrade is no more, the old ``tda-api`` library will no longer \nwork. Check out our `transition guide \n<https://schwab-py.readthedocs.io/en/latest/tda-transition.html>`__ for \ninstructions on getting started.\n\n\nHow do I use ``schwab-py``?\n---------------------------\n\nFor a full description of ``schwab-py``'s functionality, check out the \n`documentation <https://schwab-py.readthedocs.io/en/latest/>`__. Meawhile, \nhere's a quick getting started guide:\n\nBefore you do anything, create an account and an application on the\n`Charles Schwab developer site <https://developer.schwab.com/login>`__.\nYou'll receive an API key and app secret, which you can pass to this wrapper. \nYou'll also want to take note of your callback URI, as the login flow requires \nit. You app must be approved by Schwab before you can use it (this can take \nseveral days). You can find more detailed instructions `here \n<https://schwab-py.readthedocs.io/en/latest/getting-started.html>`__.\n\nNext, install ``schwab-py``:\n\n.. code-block:: python\n\n pip install schwab-py\n\nYou're good to go! To demonstrate, here's how you can authenticate and fetch\ndaily historical price data for the past twenty years:\n\n.. code-block:: python\n\n from schwab import auth, client\n import json\n\n api_key = 'YOUR_API_KEY'\n app_secret = 'YOUR_APP_SECRET'\n callback_url = 'https://127.0.0.1:8182/'\n token_path = '/path/to/token.json'\n\n c = auth.easy_client(api_key, app_secret, callback_url, token_path)\n\n r = c.get_price_history_every_day('AAPL')\n r.raise_for_status()\n print(json.dumps(r.json(), indent=4))\n\nWhy should I use ``schwab-py``?\n-------------------------------\n\n``schwab-py`` was designed to provide a few important pieces of functionality:\n\n1. **Safe Authentication**: Schwab's API supports OAuth authentication, but too \n many people online end up rolling their own implementation of the OAuth \n callback flow. This is both unnecessarily complex and dangerous. \n ``schwab-py`` handles token fetch and refreshing for you.\n\n2. **Minimal API Wrapping**: Unlike some other API wrappers, which build in lots \n of logic and validation, ``schwab-py`` takes raw values and returns raw \n responses, allowing you to interpret the complex API responses as you see \n fit. Anything you can do with raw HTTP requests you can do with \n ``schwab-py``, only more easily.\n\nWhy should I *not* use ``schwab-py``?\n-------------------------------------\n\nAs excellent as Schwab's API is, there are a few popular features it does not \noffer: \n\n * While Charles Schwab owns `thinkorswim (AKA TOS)\n <https://www.schwab.com/trading/thinkorswim/desktop>`__, this API is \n unaffiliated with it. You can access and trade against the same accounts as \n TOS, but some of TOS's functionality is not supported by ``schwab-py``\n * Paper trading is not supported\n * Historical options pricing data is not available. \n\nWhat else?\n----------\n\nWe have a `Discord server <https://discord.gg/BEr6y6Xqyv>`__! You can join to \nget help using ``schwab-py`` or just to chat with interesting people.\n\nBug reports, suggestions, and patches are always welcome! Submit issues\n`here <https://github.com/alexgolec/schwab-py/issues>`__ and pull requests\n`here <https://github.com/alexgolec/schwab-py/pulls>`__.\n\n``schwab-py`` is released under the\n`MIT license <https://github.com/alexgolec/schwab-py/blob/master/LICENSE>`__.\n\n**Disclaimer:** *schwab-py is an unofficial API wrapper. It is in no way \nendorsed by or affiliated with Charles Schwab or any associated organization.\nMake sure to read and understand the terms of service of the underlying API \nbefore using this package. This authors accept no responsibility for any\ndamage that might stem from use of this package. See the LICENSE file for\nmore details.*\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Unofficial API wrapper for the Schwab HTTP API",
"version": "1.4.0",
"project_urls": {
"Documentation": "https://schwab-py.readthedocs.io/en/latest/",
"Homepage": "https://github.com/alexgolec/schwab-py",
"Source": "https://github.com/alexgolec/schwab-py",
"Tracker": "https://github.com/alexgolec/schwab-py/issues"
},
"split_keywords": [
"finance",
"trading",
"equities",
"bonds",
"options",
"research"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "15db53075a89d15fc98467439b8d508f61de685ee424b56c47354d9399e1013b",
"md5": "1b9f1a9554b50f149f522670cc687fc3",
"sha256": "049854252703095f42a0c322278460b4dd1234645293adb9e7944622dccff08a"
},
"downloads": -1,
"filename": "schwab_py-1.4.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "1b9f1a9554b50f149f522670cc687fc3",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.10",
"size": 99590,
"upload_time": "2024-09-14T13:02:54",
"upload_time_iso_8601": "2024-09-14T13:02:54.810067Z",
"url": "https://files.pythonhosted.org/packages/15/db/53075a89d15fc98467439b8d508f61de685ee424b56c47354d9399e1013b/schwab_py-1.4.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a8a7196ab8a8e83c83894f8f4afefc5c3b48fc66d4cea78d5dfffe3b506127a1",
"md5": "c3cc5d0d8da25f030085b5bfebcfc444",
"sha256": "adbfd79439f488a22e1f9f0247854e9e2c0424f4c15d6f8e3fd92355c095ea15"
},
"downloads": -1,
"filename": "schwab_py-1.4.0.tar.gz",
"has_sig": false,
"md5_digest": "c3cc5d0d8da25f030085b5bfebcfc444",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 92831,
"upload_time": "2024-09-14T13:02:56",
"upload_time_iso_8601": "2024-09-14T13:02:56.662833Z",
"url": "https://files.pythonhosted.org/packages/a8/a7/196ab8a8e83c83894f8f4afefc5c3b48fc66d4cea78d5dfffe3b506127a1/schwab_py-1.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-14 13:02:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "alexgolec",
"github_project": "schwab-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "schwab-py"
}