|
| 1 | +<p align="center"><img width="50%" src="https://github.com/Patch-Code-Prosperity/Pythonic-Schwab-API/assets/31261577/a8f48499-fac4-400a-afe1-72f0dadf9631"></p> |
1 | 2 |
|
2 | 3 | # Pythonic-Schwab-API |
3 | 4 | This is an unofficial Python wrapper for accessing the Schwab API, designed for developers who require a straightforward and efficient method to interact with financial data and trading operations. |
4 | 5 |
|
| 6 | +Credit to [Tyler Bowers](https://github.com/tylerebowers) for inspiring this work. This is a blatant rip-off of his work formatted in a more pythonic way. We started as a fork but felt this would likely end up going in a whole different direction as far as our intended purpose and scope. Thank you, Tyler, for your work. |
| 7 | + |
5 | 8 | Before you can use this wrapper, ensure you have a Schwab developer account, which you can obtain [here](https://beta-developer.schwab.com/). |
6 | 9 |
|
7 | 10 | For community support and discussions, join our [Pythonic Discord group](https://discord.gg/6XMYKEFr). |
8 | 11 |
|
9 | 12 | ## Quick Setup |
10 | | -1. **Create a Schwab Developer App**: Register a new application with a callback URL set to "https://127.0.0.1". Ensure the app status changes to "Ready for use", as "Approved - Pending" status may not function correctly. |
| 13 | +1. **Create a Schwab Developer App**: Register a new application with a callback URL set to "https://127.0.0.1". Ensure the app status changes to "Ready for use", as "Approved - Pending" status means it has not yet been approved. |
11 | 14 | 2. **Enable Thinkorswim (TOS)**: This is necessary for order placements and other critical API functionalities. |
12 | 15 | 3. **Install Python**: This wrapper requires Python version 3.11 or higher. |
13 | | -4. **Install Dependencies**: Run `pip install requests python-dotenv websockets`. |
14 | | -5. **Configure Environment**: Populate your `.ENV` file with your `APP_KEY` and `APP_SECRET`. |
| 16 | +4. **Install Dependencies**: Run `pip install -r requirements.txt`. |
| 17 | +5. **Configure Environment**: Populate your `.env` file with your `APP_KEY` and `APP_SECRET`. |
15 | 18 | 6. **Run the Program**: Start by executing `main.py`. |
16 | 19 |
|
17 | 20 | ## Capabilities |
18 | | -- **API Authentication**: Utilizes OAuth for secure access (`api.initialize()`). |
19 | | -- **Comprehensive API Function Coverage**: Includes ready-to-use functions for all API endpoints (`api.perform_request()`). |
20 | | -- **Automatic Token Management**: Handles access token renewals (`api.update_tokens_automatically()`). |
21 | | -- **Real-Time Data Streaming**: Facilitates streaming via websockets (`stream.start_manual()`). |
22 | | -- **Automated Stream Management**: Automates the start and stop of data streams (`stream.start_automatically()`). |
| 21 | +- **API Authentication**: Utilizes OAuth for secure access (`schwab-api.initialize()`). |
| 22 | +- **Comprehensive API Function Coverage**: Includes ready-to-use functions for all API endpoints (`schwab-api.perform_request()`). |
| 23 | +- **Automatic Token Management**: Handles access token renewals (`schwab-api.update_tokens_automatically()`). |
| 24 | +- **Real-Time Data Streaming**: Facilitates streaming via websockets (`schwab-api.stream.start_manual()`). |
| 25 | +- **Automated Stream Management**: Automates the start and stop of data streams (`schwab-api.stream.start_automatically()`). |
23 | 26 |
|
24 | 27 | ## Additional Features (TBD) |
25 | 28 | - **Refresh Token Automation**: Pending Schwab's API enhancements. |
26 | 29 | - **Custom Stream Handlers**: Pending implementation for user-defined data handling. |
27 | 30 |
|
28 | 31 | ## Usage and Design |
29 | | -This Python client simplifies interactions with the TD/Schwab API by providing a user-friendly, organized, and automated interface. The design focuses on clear structure and maintainability. |
| 32 | +This Python client simplifies interactions with the Schwab API by providing a user-friendly, organized, and automated interface. The design focuses on clear structure and maintainability. |
30 | 33 |
|
31 | 34 | ### Project Structure |
32 | | -- **`main.py`**: Serves as the entry point of the application, includes usage examples. |
33 | | -- **`.ENV`**: Stores sensitive credentials like the API key and secret. |
| 35 | +- **`main.py`**: Serves as the entry point of the application, and includes usage examples. |
| 36 | +- **`.env`**: Stores sensitive credentials like the API key and secret. |
34 | 37 | - **`tokens.json`**: Maintains API tokens and their expiration metadata. |
35 | 38 |
|
36 | 39 | ### Modules |
37 | | -- **`api.py`**: Manages API interactions, token lifecycle, and request handling. |
38 | | -- **`stream.py`**: Handles websocket connections for live data feeds. |
| 40 | +- **`schwab-api.py`**: Manages API interactions, token lifecycle, and request handling. |
| 41 | +- **`stream.py`**: Handles web socket connections for live data feeds. |
39 | 42 | - **`terminal.py`**: Enhances terminal output with color-coded messages and supports additional terminal operations. |
40 | 43 |
|
41 | 44 | ## License (MIT) |
|
0 commit comments